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 |
|---|---|---|---|---|---|---|
Returns a list of projects for the given account
|
def projects
return [] unless basecamp
@projects ||= basecamp.projects
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_by_account(account)\n raise SecurityError if account.nil?\n projects = []\n if(account.is_a? Worker)\n account.worker_groups.each do |group| #TODO convert to this to a JOIN model to avoid N^2 hits to the db\n group.projects.each do |project|\n projects << project\n end\n end\n else\n account.client_groups.each do |group| #TODO convert to this to a JOIN model to avoid N^2 hits to the db\n group.projects.each do |project|\n projects << project\n end\n end\n end\n return projects\n end",
"def projects\n\t\tProject.order(\"created_at\").find_all_by_account_id(account_id).reverse\n\tend",
"def projects(params = {})\n make_get_request('/account/projects', params)\n end",
"def listprojects\n get('listprojects.json')['projects']\n end",
"def projects\n request(method: 'getAllProjects')\n end",
"def get_projects\n me = request('/services/v5/me')\n me['projects']\n end",
"def list_projects # :nologin:\n query = create_query(:Project, :all, :by => :title)\n show_selected_projects(query)\n end",
"def listProjects\n if user_signed_in?\n @project_lists = ProjectStrong.where(user_id: current_user.id)\n end\n end",
"def projects(params = {})\n fetch_all('projects', 'projects', params)\n end",
"def projects\n if is_deploy_key\n [project]\n else\n user.projects\n end\n end",
"def projects\n if is_deploy_key\n [project]\n else\n user.authorized_projects\n end\n end",
"def available_projects_list\n uri = \"#{@api_url}?access_token=#{@access_token}\"\n get uri\n end",
"def projects\n Sifter.\n get(\"/api/projects\").\n parsed_response[\"projects\"].\n map { |p| Sifter::Project.new(p) }\n end",
"def list_projects(company_id: )\n url = \"#{@base_url}/vapid/projects?company_id=#{company_id}\"\n HTTParty.get(url, headers: procore_headers(token: @customer_info[:token], company_id: @customer_info[:company_id] )).parsed_response\n end",
"def projects\n return forbidden unless current_account # already returns a 401 if credentials aren't supplied\n opts = { :include_document_ids => params[:include_document_ids] != 'false' }\n @response = {'projects' => Project.accessible(current_account).map {|p| p.canonical(opts) } }\n render_cross_origin_json\n end",
"def view_projects(uid)\n cl = client(\"Projects\", uid)\n response = cl.call(:view_projects, message: { uid: uid })\n\n return [response.to_hash[:view_projects_response][:return] || []].flatten.map do |p|\n members = [ p[:members] ].flatten.map do |m|\n ProjectMember.new(m[:uid], m[:permissions])\n end\n\n Project.new(p[:project_id], p[:owner], p[:approved], members)\n end\n rescue Savon::SOAPFault => e\n process_error e\n end",
"def list(params = {})\n response = get_request('/projects/', params)\n response.map { |project| TheShiningSource::Project.new(project) }\n end",
"def projects(options = {})\n get(\"projects\", options).projects\n end",
"def index\n @accounts = @project.accounts\n end",
"def index\n @all_projects = Project.by_user_plan_and_tenant(params[:tenant_id], current_user)\n end",
"def social_accounts_for_a_project\n uri = \"#{@api_url}/#{@project_id}/accounts?access_token=#{@access_token}\"\n get uri\n end",
"def find_all\n api.command(:listProjects).collect do |project|\n project[1]['project'].map { |p| self.new p }\n end.flatten\n end",
"def show_all_projects\r\n json = GoodData.get GoodData.profile.projects\r\n puts \"You have this project available:\"\r\n json[\"projects\"].map do |project|\r\n pid = project[\"project\"][\"links\"][\"roles\"].to_s\r\n puts \"Project name: #{project[\"project\"][\"meta\"][\"title\"].bright} Project PID: #{pid.match(\"[^\\/]{32}\").to_s.bright}\"\r\n end\r\n end",
"def projects\n PivotalTracker::Project.all\n end",
"def query_projects(options = nil)\n require_relative 'telerivet/project'\n self.cursor(Project, get_base_api_path() + \"/projects\", options)\n end",
"def top_active_projects(account)\n return nil if account.nil?\n top_active = nil\n if account.is_a?(Worker)\n if account.has_role?(Role::ADMIN)\n top_active = self.all(:limit => Project::NUMBER_OF_TOP_ACTIVE_PROJECTS, :order => \"activity DESC\")\n else\n worker_group_ids = account.worker_groups.collect {|g| g.id}\n top_active = self.all(:conditions => {:worker_group_id => worker_group_ids}, :limit => Project::NUMBER_OF_TOP_ACTIVE_PROJECTS, :order => \"activity DESC\")\n end\n else\n client_group_ids = account.client_groups.collect {|g| g.id}\n top_active = self.all(:conditions => {:client_group_id => client_group_ids}, :limit => Project::NUMBER_OF_TOP_ACTIVE_PROJECTS, :order => \"activity DESC\")\n end\n return top_active\n end",
"def all_projects()\n @endpoint = \"/projects.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"projects\"].sort_by { |proj| proj[\"name\"] }\n end",
"def projects\n @projects ||= Harvest::API::Projects.new(credentials)\n end",
"def projects\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Project)\n end",
"def list_projects\n handle_action_exceptions(__method__) do\n cmd_line = ['listprojects']\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end",
"def projects\n @projects ||= begin\n http = Net::HTTP.new(API_HOST, API_PORT)\n http.use_ssl = true\n http.ca_file = (Twigg.root + 'files' + 'github.pem').to_s\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n uri = ORG_REPOS_ENDPOINT % Config.github.organization\n headers = { 'Authorization' => \"token #{Config.github.token}\" }\n\n [].tap do |names|\n begin # loop: page through project list\n request = Net::HTTP::Get.new(uri, headers)\n response = http.request(request)\n raise \"Bad response #{response.inspect}\" unless response.is_a?(Net::HTTPOK)\n names.concat JSON[response.body].map { |repo| repo['name'] }\n uri = parse_link(response['Link'])\n end until uri.nil?\n end\n end\n end",
"def projects\n projects = object.projects.select { |p| !current_user || p.users.include?(current_user) }\n projects.map { |p| p.id }\n end",
"def projects(org_id, options = {})\n paginate \"organizations/#{org_id}/projects\", options\n end",
"def projects\n @projects ||= begin\n user = api('user')\n api(\"users/#{user['id']}/projects\").sort_by { |p| p['id'] }\n end\nend",
"def list\n get 'projects'\n end",
"def my_projects\n @projects = Project.where(:client_id => current_user.client_id)\n end",
"def get_org_projects\n unless organization.nil?\n client.org_projects(organization)\n end\n end",
"def list_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:pattern] = '/projects'\n\t\targs[:query]['Action'] = 'ListProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tif optional.key? :project_owner\n\t\t\targs[:query]['ProjectOwner'] = optional[:project_owner]\n\t\tend\n\t\tself.run(args)\n\tend",
"def get_projected_accounts\n\t\t #@projected_accounts_info = Hash[ACCOUNT_INFO.dup.find_all{|k,v| v[:discretionary]}]\n\t\t #@projected_accounts_info = accounts_with_projections(@projected_accounts_info)\n\t\t #@projected_accounts_info = @accounts.find_all{|acc| info = ACCOUNT_INFO[acc.name] and info[:discretionary]} \n projected_accounts = @accounts.find_all{|acc| acc.info and acc.info[:discretionary]}\n @projected_accounts_info = accounts_with_projections(projected_accounts)\n\tend",
"def projects\n tmp = client.get @json['user']['links']['projects']\n tmp['projects'].map do |project_meta|\n project_uri = project_meta['project']['links']['self']\n project = client.get project_uri\n client.factory.create(GoodData::Project, project)\n end\n end",
"def projects\n projects = object.projects\n unless current_user.admin?\n projects = object.projects.select { |project| project.users.include?(current_user) }\n end\n projects.map { |p| p.id }\n end",
"def projects\n projects = object.projects\n unless current_user.admin?\n projects = object.projects.select { |project| project.users.include?(current_user) }\n end\n projects.map { |p| p.id }\n end",
"def projects(params = nil)\n params = params.merge({ :current_user => @options[:current_user]})\n params = params.except(:manufacturer_id, :catg_slug, :office_id, :max_matches)\n params[:order] ||= 'recently_active'\n\n @projects_response = ProjectsIndexPresenter.new(params[:current_user], params).response\n projects = @projects_response[:projects] || []\n projects\n end",
"def projects_list\n projects.inject({}) do |h, project|\n h.merge( project['id'] => project['name'] )\n end\n end",
"def index\n @user = User.find(current_user.id)\n @projects = @user.projects.all\n end",
"def projects\n Easybill::Api::Projects\n end",
"def projects\n result = []\n load_attributes\n @attributes['projects'].each do |project|\n result << project['name']\n end\n puts \"Workspace projects #{result}\"\n result\n end",
"def list_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'ListProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tif optional.key? :project_owner\n\t\t\targs[:query]['ProjectOwner'] = optional[:project_owner]\n\t\tend\n\t\tself.run(args)\n\tend",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def auth_projects\n projects =\n services.identity.auth_projects(@scoped_domain_id).sort_by(&:name)\n render json: { auth_projects: projects }\n end",
"def projects_charge_accounts(_projects)\n _array = []\n _ret = nil\n\n # Adding charge accounts belonging to current projects\n _ret = ChargeAccount.where(project_id: _projects)\n ret_array(_array, _ret)\n # _projects.each do |i|\n # _ret = ChargeAccount.where(project_id: i.id)\n # ret_array(_array, _ret)\n # end\n\n # Adding global charge accounts\n _ret = ChargeAccount.where('project_id IS NULL')\n ret_array(_array, _ret)\n\n # Returning founded charge accounts\n _ret = ChargeAccount.where(id: _array).order(:account_code)\n end",
"def projects_charge_accounts(_projects)\n _array = []\n _ret = nil\n\n # Adding charge accounts belonging to current projects\n _ret = ChargeAccount.where(project_id: _projects)\n ret_array(_array, _ret)\n # _projects.each do |i|\n # _ret = ChargeAccount.where(project_id: i.id)\n # ret_array(_array, _ret)\n # end\n\n # Adding global charge accounts\n _ret = ChargeAccount.where('project_id IS NULL')\n ret_array(_array, _ret)\n\n # Returning founded charge accounts\n _ret = ChargeAccount.where(id: _array).order(:account_code)\n end",
"def index\r\n @projects = current_user.projects\r\n end",
"def index\n @projects = current_user.projects.all\n end",
"def projects(req_params = {})\n name = 'Projects'\n params = { req: req_params }\n\n data = endpoint(name: name, params: params).do_get\n\n collection name, data\n end",
"def index\n @projects = Project.where(user_id: @current_user.id)\n end",
"def projects\n records \"project\", \"/project/list\"\n end",
"def projects\n settings.projects.map do |project_settings|\n Project.new(project_settings)\n end\n end",
"def get\n CircleCi.request(conf, '/projects').get\n end",
"def index\n @user = current_user\n @projects = @user.projects.all\n end",
"def projects\n config[:projects]\n end",
"def list_all\n query = create_query(:Project, :all, by: default_sort_order)\n show_selected_projects(query)\n end",
"def index\n if (current_user.role == \"admin\" || current_user.role == \"manager\")\n @projects = Project.order('name').page(params[:page])\n else\n userprojects = current_user.users_projects.where(\"user_project_role = ?\", \"manager\")\n @projects = current_user.projects.where(id: userprojects.pluck(:project_id)).order('name').page(params[:page])\n end\n end",
"def find_projects\n @projects = Project.all\n end",
"def index\n if current_user.has_role? :admin\n @projects = Project.all\n elsif current_user.has_role? :developer\n @projects = Project.is_dev_here(current_user.developer.id)\n else\n @projects = []\n end\n end",
"def projects_charge_accounts(_projects)\n _array = []\n _ret = nil\n\n # Adding charge accounts belonging to current projects\n _ret = ChargeAccount.expenditures.where(project_id: _projects)\n ret_array(_array, _ret, 'id')\n # _projects.each do |i|\n # _ret = ChargeAccount.expenditures.where(project_id: i.id)\n # ret_array(_array, _ret, 'id')\n # end\n\n # Adding global charge accounts belonging to projects organizations\n _sort_projects_by_organization = _projects.sort { |a,b| a.organization_id <=> b.organization_id }\n _previous_organization = _sort_projects_by_organization.first.organization_id\n _sort_projects_by_organization.each do |i|\n if _previous_organization != i.organization_id\n # when organization changes, process previous\n _ret = ChargeAccount.expenditures.where('(project_id IS NULL AND charge_accounts.organization_id = ?)', _previous_organization)\n ret_array(_array, _ret, 'id')\n _previous_organization = i.organization_id\n end\n end\n # last organization, process previous\n _ret = ChargeAccount.expenditures.where('(project_id IS NULL AND charge_accounts.organization_id = ?)', _previous_organization)\n ret_array(_array, _ret, 'id')\n\n # Returning founded charge accounts\n _ret = ChargeAccount.where(id: _array).order(:account_code)\n end",
"def projects_charge_accounts(_projects)\n _array = []\n _ret = nil\n\n # Adding charge accounts belonging to current projects\n _ret = ChargeAccount.expenditures.where(project_id: _projects)\n ret_array(_array, _ret, 'id')\n # _projects.each do |i|\n # _ret = ChargeAccount.expenditures.where(project_id: i.id)\n # ret_array(_array, _ret, 'id')\n # end\n\n # Adding global charge accounts belonging to projects organizations\n _sort_projects_by_organization = _projects.sort { |a,b| a.organization_id <=> b.organization_id }\n _previous_organization = _sort_projects_by_organization.first.organization_id\n _sort_projects_by_organization.each do |i|\n if _previous_organization != i.organization_id\n # when organization changes, process previous\n _ret = ChargeAccount.expenditures.where('(project_id IS NULL AND charge_accounts.organization_id = ?)', _previous_organization)\n ret_array(_array, _ret, 'id')\n _previous_organization = i.organization_id\n end\n end\n # last organization, process previous\n _ret = ChargeAccount.expenditures.where('(project_id IS NULL AND charge_accounts.organization_id = ?)', _previous_organization)\n ret_array(_array, _ret, 'id')\n\n # Returning founded charge accounts\n _ret = ChargeAccount.where(id: _array).order(:account_code)\n end",
"def index\n authorize Project\n # Only index projects of the current user\n @projects = current_user.projects\n @public_projects = policy_scope(Project)\n @help_context = \"Projects\"\n end",
"def index\n get_logged_in_user\n @projects = Project.all.select {|project| project.user_id == logged_in_user_id }\n end",
"def project_list\n project_folders = Dir::entries(::File.join(Msf::Config.log_directory, 'projects'))\n projects = []\n framework.db.workspaces.each do |s|\n if project_folders.include?(s.name)\n projects << s.name\n end\n end\n return projects\n end",
"def projects_charge_accounts(_projects)\n _array = []\n _ret = nil\n\n # Adding charge accounts belonging to current projects\n _ret = ChargeAccount.incomes.where(project_id: _projects)\n ret_array(_array, _ret, 'id')\n\n # Adding global charge accounts belonging to projects organizations\n _sort_projects_by_organization = _projects.sort { |a,b| a.organization_id <=> b.organization_id }\n _previous_organization = _sort_projects_by_organization.first.organization_id\n _sort_projects_by_organization.each do |i|\n if _previous_organization != i.organization_id\n # when organization changes, process previous\n _ret = ChargeAccount.incomes.where('(project_id IS NULL AND charge_accounts.organization_id = ?)', _previous_organization)\n ret_array(_array, _ret, 'id')\n _previous_organization = i.organization_id\n end\n end\n # last organization, process previous\n _ret = ChargeAccount.incomes.where('(project_id IS NULL AND charge_accounts.organization_id = ?)', _previous_organization)\n ret_array(_array, _ret, 'id')\n\n # Returning founded charge accounts\n _ret = ChargeAccount.where(id: _array).order(:account_code)\n end",
"def projects\n @projects ||= Project.all\n end",
"def list\r\n @projects = Project.where(user:current_user).order(created_at: :desc).page(params[:page])\r\n respond_with(@projects)\r\n end",
"def all\n @projects\n end",
"def all\n @projects\n end",
"def all_projects(type:)\n if type == :admin\n GitlabService.get_all_projects(self)\n else\n GitlabService.get_visible_projects(self)\n end\n end",
"def projects\n @projects\n end",
"def my_projects\n\t\tif params[:cat].present?\n\t\t\tst = params[:cat] == \"in_progress\" ? \"in progress\" : \"completed\"\n\t\t\t@my_projects = Project.where(user_id: current_user.id, project_status: st)\n\t\telse\n\t\t\t@my_projects = Project.where(user_id: current_user.id, project_status: \"in progress\")\n\t\tend\n\t\t@report_options = ProjectReport.previous_reports(current_user.id)\n\t\t@project_report = ProjectReport.new\n\tend",
"def index\n\tif @current_user.is_admin?\n\t\t@projects = Project.all\n\telse \n\t\t@projects = @current_user.projects\n\tend\n end",
"def get_projects\n @params=task_params\n @client=current_user.clients.find(@params[:client_id])\n counter=0\n @res=[]\n @client.projects.each do |c|\n if c.users.include? current_user\n @res[counter]={\n project_id: c.id, \n name: c.name\n }\n counter+=1\n end\n end\n respond_to do |format|\n format.json {render json: @res.uniq}\n end\n end",
"def users_projects(user_id, params = {})\n make_get_request(\"/user/#{user_id}/projects\", params)\n end",
"def index\n @projects = Project.order(is_billable: :desc, name: :asc)\n .includes(:team, contracts: [:full_reports])\n .search(params[:search]).page(params[:page])\n end",
"def index\n @projects = @user.active_projects + @user.collaboration_projects\n end",
"def index\n @projects = @projects.includes(:latest_iteration).where(:tenant_id => current_user.tenant).order(\"name\").page(params[:page]).per(DEFAULT_ROWS_PER_PAGE)\n\n respond_with @projects\n end",
"def index\n\t\t@projects = Project.where(user_id: current_user.id).order(created_at: :asc)\n\tend",
"def index\n @projects = Project.order_by_company_and_project.paginate(page: params[:page] || 1, per_page: helpers.pager_per_page)\n respond_to do |format|\n message = @projects.present? ? \"\" : \"There are no projects available at this time\"\n format.json do\n status = @projects.present? ? :ok : :not_found\n render json: { response: @projects, status: status, message: message }\n end\n format.html do\n # Only authorize html format, json is okay because we use it as\n # an api.\n authorize(:project)\n flash[:alert] = message unless message.blank?\n @projects\n end\n end\n end",
"def index\n @projects = @namespace.projects.all\n end",
"def index\n @user_projects = UserProject.all\n end",
"def index\n # @user = User.find(params[:user_id]) \n @projects = current_user.projects\n end",
"def github_projects\n Rails.cache.fetch(\"/users/#{self.id}/github_projects\", :expires_in => 1.day) {\n gh = Github.new(authentications.where(:provider => 'github').first.provider_token)\n gh.repos\n }\n end",
"def show\n @all = Account.all\n @user = Account.find(params[:id])\n @project = Project.all\n end",
"def test_it_can_get_list_of_projects\n VCR.insert_cassette 'projects'\n projects = @api.projects('writer1')\n\n assert_kind_of Array, projects\n assert_equal 3, projects.size\n\n assert_kind_of Hash, projects.first\n assert_kind_of Hash, projects.last\n\n assert_equal \"xjywplmhejceb6j3ezzlxiganmjavqio\", projects.last[\"pid\"]\n assert_equal \"l7eqkx6daomtv5iw2912p019anskzt1n\", projects.first[\"pid\"]\n assert_equal 1, projects.first[\"active\"]\n assert_equal 1, projects.first[\"main\"]\n end",
"def index\n if current_user.school\n @projects = current_user.school.projects\n elsif current_user.site\n @projects = current_user.site.projects\n else\n @projects = Project.all\n end\n @projects = @projects.order('updated_at DESC', 'id DESC').limit(400)\n end"
] |
[
"0.78678536",
"0.77663654",
"0.7715734",
"0.750573",
"0.73739934",
"0.73426306",
"0.7341505",
"0.7304716",
"0.7261574",
"0.7152481",
"0.7112637",
"0.70168626",
"0.7016141",
"0.7012475",
"0.69722277",
"0.6960922",
"0.694568",
"0.69422114",
"0.69133073",
"0.6894679",
"0.68920386",
"0.6887126",
"0.68770087",
"0.6855186",
"0.68520284",
"0.685015",
"0.6834814",
"0.68294156",
"0.67720884",
"0.67478484",
"0.67420155",
"0.67151463",
"0.67067057",
"0.6692855",
"0.6679966",
"0.66756606",
"0.6673813",
"0.6671501",
"0.6647202",
"0.6642904",
"0.6640294",
"0.6640294",
"0.66367716",
"0.6633542",
"0.6633178",
"0.66228414",
"0.66220385",
"0.6589436",
"0.6584587",
"0.6584587",
"0.6584587",
"0.6584587",
"0.6584587",
"0.6584587",
"0.6584587",
"0.6584587",
"0.657039",
"0.65572906",
"0.65572906",
"0.65447915",
"0.65438646",
"0.6543618",
"0.6534324",
"0.6522864",
"0.6503993",
"0.6495949",
"0.6494869",
"0.646702",
"0.6457044",
"0.64508075",
"0.64495885",
"0.6435713",
"0.6423525",
"0.6423525",
"0.6422446",
"0.6415179",
"0.64091104",
"0.64044535",
"0.6397896",
"0.6395084",
"0.6393263",
"0.6393263",
"0.6379279",
"0.6357727",
"0.63568777",
"0.6356807",
"0.63312167",
"0.6318854",
"0.6303028",
"0.6302138",
"0.62974626",
"0.62811774",
"0.6280787",
"0.62792397",
"0.62686807",
"0.6265866",
"0.62650865",
"0.6246784",
"0.62392366",
"0.62381774"
] |
0.64030164
|
78
|
Returns a list of todos for the given account and project_id. TODO: Can we return a blank project id and get all todo lists for all objects???
|
def todos(project_id)
return [] if project_id.blank? || !basecamp
@todos[project_id] ||= Basecamp::TodoList.all(project_id, false)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def lists(project_id, complete=nil)\n records \"todo-list\", \"/projects/#{project_id}/todos/lists\", :complete => complete\n end",
"def get_items(projectid, todolistid)\n get(\"projects/#{projectid}/todolists/#{todolistid}.json\")\n end",
"def get_all_withassigned(projectid)\n get(\"projects/#{projectid}/assigned_todos.json\")\n end",
"def todo_list\n TodoList.find_by(user_id: current_user['sub'])\n end",
"def index\n if(current_user.has_role?(:developer))\n @todos = Todo.where(developer_id: current_user.id, project_id: params[:project_id])\n else\n @todos = Todo.where(project_id: params[:project_id])\n end\n render json: @todos\n end",
"def projects\n\t\tProject.order(\"created_at\").find_all_by_account_id(account_id).reverse\n\tend",
"def set_todo_list\n begin\n @todo_list = current_user.todo_lists.where(project_id: params[:project_id]).find(params[:id])\n rescue => exception\n head 401\n end\n end",
"def index\n @todo_projects = TodoProject.all\n end",
"def list_todo_items(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n )\n\n # resource path\n path = path_replace(\"/v1/users/self/todo\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def listProjects\n if user_signed_in?\n @project_lists = ProjectStrong.where(user_id: current_user.id)\n end\n end",
"def todos(id, sort = 'recent', options = {})\n deprecated(\"todos\", \"list_todos\")\n get(\"users/#{id}/todos\", { :sort => sort }.merge(options)).todos\n end",
"def show\n @project_todo = @project.project_todos.find(params[:id])\n end",
"def get_completed(projectid)\n get(\"projects/#{projectid}/todolists/completed.json\")\n end",
"def index\n authorize! :index, Todo\n if current_employee.admin?\n @todos = @project.todos\n else\n raise CanCan::AccessDenied.new(\"Not authorized!\", :read, Todo)\n end\n end",
"def list_projects # :nologin:\n query = create_query(:Project, :all, :by => :title)\n show_selected_projects(query)\n end",
"def get(id:)\n list = client.get_list(id: id)\n\n Todoable::List.new(list)\n end",
"def index\n @project_todo_comments = @project_todo.project_todo_comments.all\n end",
"def tasks(project_id)\n account = Config.details \n c = FreshBooks::Client.new(account[\"account\"], account[\"token\"])\n c.task.list :project_id => project_id\n end",
"def index\n\t\t@list = current_user.lists.find(params[:list_id])\n @todos = @list.todos\n end",
"def index\n @project = Project.find(params[:project_id])\n @to_dos = @project.to_dos.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @to_dos }\n end\n end",
"def index\n @project = Project.find(params[:project_id])\n @tasks = @project.tasks.all\n end",
"def index\n\t\t@projects = Project.where(user_id: current_user.id).order(created_at: :asc)\n\tend",
"def index\n @project = Project.find(params[:project_id])\n @tasks = @project.tasks\n end",
"def index\n @projects = Project.find_all_by_user_id current_user[:id]\n @project_issues = ProjectIssue.find_all_by_user_id current_user[:id]\n end",
"def list(project_id, options)\n @_client.get(resource_root(project_id), options)\n end",
"def list\n @title = \"Project List\"\n\n conditions = nil\n @status = nil\n @sortby = nil\n\n if params[:status]\n conditions = [ \"project_status = ?\", params[:status] ]\n @status = params[:status]\n end\n\n sortbylookup = {\n 'name' => \"project_title\",\n 'start' => \"start_date\",\n 'end' => \"actual_finish_date\"\n }\n\n if sortbylookup[params[:sortby]]\n order = sortbylookup[params[:sortby]]\n @sortby = params[:sortby]\n else\n order = 'project_title'\n end\n order += ' DESC'\n\n @projects = Project.paginate( :page => params[:page], :per_page => 20, :conditions => conditions, :order => order)\n end",
"def get_list(id)\n record \"/todos/list/#{id}\"\n end",
"def index\n\n if params[:project_id].nil?\n results = current_user.tasks\n\n else\n @project = Project.user_readable(current_user).find(params[:project_id])\n results = @project.tasks\n end\n\n @tasks = paginate_results(params[:page], results)\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n\t\t@projects = current_user.projects.order(\"created_at ASC\")\n\tend",
"def index\n @project_todos = @project.project_todos.all\n \n #render :json => @project_todos\n \n end",
"def index\n @todo_lists = TodoList.where(work_id: params[:id]).order(\"created_at\").page(params[:page]).per(5)\n end",
"def set_project_todo\n @project_todo = ProjectTodo.find(params[:id])\n end",
"def set_todo\n @todo = @project.todos.find(params[:id])\n end",
"def index\n get_logged_in_user\n @projects = Project.all.select {|project| project.user_id == logged_in_user_id }\n end",
"def index\n @projects = Project.where(user_id: @current_user.id)\n end",
"def get_tasks_in_project(project_id)\n body = get_json_data(\"https://app.asana.com/api/1.0/tasks?project=#{project_id}&assignee=me\")\n tasks = {}\n body[\"data\"].each do |element|\n tasks[element[\"id\"]] = element[\"name\"].gsub(\"'\", '').gsub(\"\\n\", '')\n end\n\n tasks\n end",
"def list(project_id, opts = {})\n super(project_id, ListRequest.new(opts))\n end",
"def list(project_id, opts = {})\n super(project_id, ListRequest.new(opts))\n end",
"def list(project_id, opts = {})\n super(project_id, ListRequest.new(opts))\n end",
"def index\n respond_with Project.all\n # cookies[:user_id] = current_user.id\n\n end",
"def set_todo\n # this will search todos of only current user, securing the project this way\n @todo = current_user.todos.find(params[:id])\n end",
"def index\n @all_projects = Project.by_user_plan_and_tenant(params[:tenant_id], current_user)\n end",
"def projects\n @projects ||= begin\n user = api('user')\n api(\"users/#{user['id']}/projects\").sort_by { |p| p['id'] }\n end\nend",
"def find_by_project(client, project: nil, projectId: nil, per_page: 20, options: {})\n params = { limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.get(\"/projects/#{project != nil ? project : projectId}/tasks\", params: params, options: options)), type: self, client: client)\n end",
"def user_todos user_id=\"self\", options={}\n response = get(\"/lists/#{user_id}/todos\", options)[\"response\"]\n Foursquared::Response::List.new(self, response[\"list\"])\n end",
"def index\n if params[:project_id]\n @invoices = Invoice.where(project: params[:project_id]).order(created_at: :asc)\n else\n @invoices = Invoice.where(company: current_user.company).order(created_at: :asc)\n end\n end",
"def index\n @user = User.find(current_user.id)\n @projects = @user.projects.all\n end",
"def index\n @projects = current_user.projects.all\n end",
"def list_all\n query = create_query(:Project, :all, by: default_sort_order)\n show_selected_projects(query)\n end",
"def list\r\n @projects = Project.where(user:current_user).order(created_at: :desc).page(params[:page])\r\n respond_with(@projects)\r\n end",
"def index\n @todoit_lists = TodoitList.all\n end",
"def refresh\n response = Logan::Client.get \"/projects/#{project_id}/todos/#{id}.json\"\n initialize(response.parsed_response)\n end",
"def refresh\n response = Logan::Client.get \"/projects/#{project_id}/todos/#{id}.json\"\n initialize(response.parsed_response)\n end",
"def get_todo model, cohort\n return [] unless model && cohort\n ids = adminned_memberships_by_tag(cohort).map(&:id)\n records = model.where(membership_id: ids).todo\n end",
"def index\n @project_tasks = ProjectTask.all\n end",
"def index\n @project_tasks = ProjectTask.all\n end",
"def index\n @user = current_user\n @projects = @user.projects.all\n end",
"def index\n @to_dos = ToDo.all\n end",
"def show\n @project = Project.find(params[:project_id])\n @to_do = @project.to_dos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @to_do }\n end\n end",
"def index\n @to_do = current_user.stuk_todo_tasks.where(state: 'to_do')\n @doing = current_user.stuk_todo_tasks.where(state: 'doing')\n @done = current_user.stuk_todo_tasks.where(state: 'done')\n end",
"def index\n\tif @current_user.is_admin?\n\t\t@projects = Project.all\n\telse \n\t\t@projects = @current_user.projects\n\tend\n end",
"def index\n @todos = @list.todos.all\n end",
"def contents(project)\n # Se crea un hash de condiciones para hacer la busqueda de contenidos\n cond = Hash[:project_id => project.id]\n # Se obtiene el usuario conectado\n us = User.find(session[:user_id])\n # Si es contacto se setea la condicion de acceso a clientes\n cond[:access_client] = true if us.class == Contact\n # Si es administrador se setea la condicion de acceso a administrador o usuario moove-it\n cond[:access_moove_it] = true if us.class != Contact and !us.is_admin\n # Se buscan los contenidos, asociados al proyecto dado, que cumples las condiciones dadas anteriormente\n Content.find(:all, :conditions => cond, :order => 'created_at desc')\n end",
"def set_todo_project\n @todo_project = TodoProject.find(params[:id])\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @todolist = Todolist.find(params[:todolist_id])\n @task = @todolist.tasks.find(params[:id])\n\n @tasks = @todolist.tasks.where(completed: false).order('created_at ASC')\n @completed_tasks = @todolist.tasks.where(completed: true).order('updated_at')\n end",
"def list\n get 'projects'\n end",
"def create_list(project_id, list)\n record \"/projects/#{project_id}/todos/create_list\", list\n end",
"def list\n @todos = Todo.paginate(:all, :page => params[:page], :conditions => [\"user_id = ?\", session[:user_id]])\n end",
"def index\r\n @projects = current_user.projects\r\n end",
"def find_by_project(project_id, options = {})\n options.merge!({project_id: project_id })\n result = Paymo::API.get :entries, :find_by_project, options\n if result['status'] == 'ok'\n result['entries']['entry'].map! do |entry|\n Paymo::Entry.new(entry)\n end\n end\n end",
"def index\n #return unless only_admin 'see all tasks'\n #@tasks = Task.all\n @q = Task.ransack(params[:q])\n @tasks = @q.result.page(params[:page])\n # raise '999'\n if params[:q].has_key? :project_id_eq\n render \"projects/show\", project: @project = Project.find(params[:q][:project_id_eq]), tasks: @tasks, q: @q, id: params[:q][:project_id_eq]\n end\n # Parameters: {\"utf8\"=>\"✓\", \"q\"=>{\"title_cont\"=>\"T\", \"project_id_eq\"=>\"4\"}, \"commit\"=>\"Search\"}\n end",
"def index\n @todoas = Todoa.where(user_id: current_user.id,done: false).order(\"due, created_at DESC\")\n end",
"def get_completed_todos\n return Todo.where({\"user_id\" => self.id, \"completed\" => true})\n end",
"def create(name, description, projectid)\n body = {:name => name, :description => description}\n post(\"projects/#{projectid}/todolists.json\", JSON.generate(body))\n end",
"def projects\n records \"project\", \"/project/list\"\n end",
"def index\n @contacts = Contact\n\n if params[:project_id]\n # https://stackoverflow.com/q/680141/6594668\n @contacts = Contact.where(contactable_type: 'Project')\n .joins('INNER JOIN projects ON contacts.contactable_id = projects.id')\n .where(projects: { identifier: params[:project_id] }).all\n end\n\n @contacts = @contacts.where(id: params[:id]) if params[:id]\n\n @contacts = @contacts.all\n end",
"def projects_list\n projects.inject({}) do |h, project|\n h.merge( project['id'] => project['name'] )\n end\n end",
"def listprojects\n get('listprojects.json')['projects']\n end",
"def index\n if @project\n if ProjectUser.verify_role(current_user.id, @project, 'client')\n @tickets = Ticket.all_for_project(@project)\n render json: @tickets, status: 200\n else\n render json: { error: 'You must be a member of a project to see its content' }, status: :unauthorized\n end\n else\n render json: { error: \"no project found with id of #{params[:project_id]}\" }, status: 404\n end\n end",
"def index\n @projects = current_user.projects.ordered_by_creation\n # render :layout => \"index\"\n\n # @projects = Project.all(project_params)\n # if @project.user_id = current_user.id\n # end\n end",
"def index\n if current_user.school\n @projects = current_user.school.projects\n elsif current_user.site\n @projects = current_user.site.projects\n else\n @projects = Project.all\n end\n @projects = @projects.order('updated_at DESC', 'id DESC').limit(400)\n end",
"def index\n @project = Project.find(params[:project_id])\n @tasks = @project.tasks.order('id DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def task_lists(current_token)\n session = RedboothRuby::Session.new(token: current_token)\n client = RedboothRuby::Client.new(session)\n\n client.task_list(:index, project_id: self.id).all\n end",
"def find_list(id)\n check_token\n response = self.class.get(\"/lists/#{id}\", headers: headers)\n check_and_raise_errors(response)\n Todoable::List.build_from_response(response.parsed_response)\n end",
"def index\n @projects = current_user.projects.order(created_at: :desc).all\n @new_project = Project.new\n @new_task = Task.new\n end",
"def all\n cookies[:allProjects]=true\n @all_projects=true\n @projects={\n \"current\"=> Project.find_all_by_state('current'),\n \"finished\"=> Project.find_all_by_state('finished'),\n \"aborted\"=> Project.find_all_by_state('aborted')\n }\n\t\tself.bread\n authorize! :list_all, @projects\n render 'index'\n end",
"def index\n @project = Project.where(\"id=?\", params[:project_id]).first\n if @project.nil?\n redirect_to \"/\", error: 'Not exist project'\n return\n else\n @project_users = @project.project_users\n end\n end",
"def projects\n projects = object.projects.select { |p| !current_user || p.users.include?(current_user) }\n projects.map { |p| p.id }\n end",
"def project_get(project)\n project_find(project)\n projects = @project.all('a[class=table-link]') if @project\n\n project_names = []\n if projects\n projects.each do |proj|\n project_names << proj.text\n end\n else\n project_names = nil\n end\n project_names\n end",
"def index\n @todolists = Todolist.all\nend",
"def index\n # @user = User.find(params[:user_id]) \n @projects = current_user.projects\n end",
"def get_task_list(id)\n response = request(\n :expects => 200,\n :idempotent => true,\n :method => 'GET',\n :parser => Fog::ToHashDocument.new,\n :path => \"tasksList/#{id}\"\n )\n ensure_list! response.body, :Task\n response\n end"
] |
[
"0.704227",
"0.69164544",
"0.6630713",
"0.66013193",
"0.6564256",
"0.6552887",
"0.65388757",
"0.6512203",
"0.62591076",
"0.62354654",
"0.6223964",
"0.6217156",
"0.6206288",
"0.6192626",
"0.618925",
"0.61635625",
"0.6134018",
"0.6092453",
"0.6082023",
"0.6072686",
"0.60657704",
"0.6024597",
"0.60002816",
"0.59995115",
"0.59869206",
"0.5960513",
"0.5947838",
"0.59400815",
"0.5925637",
"0.59182626",
"0.59093684",
"0.5909216",
"0.59072584",
"0.58767647",
"0.587601",
"0.58540136",
"0.5831485",
"0.5831485",
"0.5831485",
"0.58147913",
"0.58132696",
"0.5810423",
"0.57977533",
"0.5792315",
"0.5790806",
"0.57740366",
"0.5772276",
"0.5769617",
"0.57681316",
"0.5767559",
"0.5760836",
"0.5757998",
"0.5757998",
"0.5751581",
"0.5747121",
"0.5747121",
"0.57161146",
"0.5707746",
"0.5706971",
"0.5701484",
"0.5689646",
"0.5677227",
"0.56651646",
"0.5652341",
"0.564673",
"0.564673",
"0.564673",
"0.564673",
"0.564673",
"0.564673",
"0.564673",
"0.564673",
"0.56450695",
"0.5615438",
"0.56086427",
"0.56065774",
"0.56049687",
"0.56044424",
"0.559263",
"0.55853575",
"0.5576931",
"0.55701745",
"0.55691975",
"0.5568155",
"0.5565087",
"0.5560577",
"0.5557545",
"0.55570406",
"0.5551532",
"0.5548545",
"0.55435854",
"0.5541076",
"0.5538602",
"0.5532078",
"0.5528833",
"0.552733",
"0.55231553",
"0.552138",
"0.5518993",
"0.55179846"
] |
0.8015326
|
0
|
Create a new time entry for a todo item
|
def create_todo(fact, todo_id = nil)
response = basecamp_connection.post("/todo_items/#{todo_id}/time_entries.xml",
"<time-entry>
<person-id>#{fact.activity.category.account.user_id}</person-id>
<date>#{fact.start_time.to_date}</date>
<hours>#{fact.hours}</hours>
<description>#{fact.description.gsub(/\&/, "&")}</description>
</time-entry>", "Content-Type" => "application/xml")
if response.code == '201'
time_entry_id = response['location'].split('/').last
fact.time_entry.update_attribute(:time_entry_id, time_entry_id)
return true
else
puts response.inspect
return false
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n\t\t@project = Project.find(get_stored_project_id)\n\t\t@time_entry = @project.time_entries.build(params[:time_entry])\n\t\tif @time_entry.save\n\t\t\tflash[:success] = \"New entry saved!\"\n\t\t\tredirect_to project_path(@project)\n\t\telse\n\t\t\trender project_path(@project)\n\t\tend\n\tend",
"def create\n @time_entry = TimeEntry.new(params[:time_entry])\n\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully created.' }\n format.json { render json: @time_entry, status: :created, location: @time_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_entry = TimeEntry.new(params[:time_entry])\n\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully created.' }\n format.json { render json: @time_entry, status: :created, location: @time_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_entry = TimeEntry.new(params[:time_entry])\n\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully created.' }\n format.json { render json: @time_entry, status: :created, location: @time_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_entry = TimeEntry.new(time_entry_params)\n\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully created.' }\n format.json { render :show, status: :created, location: @time_entry }\n else\n format.html { render :new }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @timeentry = Timeentry.new(params[:timeentry])\n\n respond_to do |format|\n if @timeentry.save\n format.html { redirect_to @timeentry, notice: 'Timeentry was successfully created.' }\n format.json { render json: @timeentry, status: :created, location: @timeentry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @timeentry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def insert_time_entry cat_id, description ,time=nil\n entry = DB::Time_entries.find_by(finishtime: nil)\n entry.finishtime=time\n entry.save if DB::Time_entries.create(category_id: cat_id, name: description, starttime: time)\n end",
"def create\n @todo = Todo.new(params[:todo])\n @todo[:user_id] = current_user.id\n @todo[:time] = Record::hours_to_numeric(@todo[:time])\n\n respond_to do |format|\n if @todo.save\n format.html { redirect_to(@todo, :notice => 'Todo was successfully created.') }\n format.xml { render :xml => @todo, :status => :created, :location => @todo }\n format.js { @notice = \"Todo #{@todo.title} was successfully created\"}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @todo.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end",
"def create_todo_item(title, description)\n new_item = Todoitem.new\n new_item.title = title\n new_item.description = description\n new_item.save\n end",
"def set_time_entry\n @time_entry = TimeEntry.find(params[:id])\n end",
"def set_time_entry\n @time_entry = TimeEntry.find(params[:id])\n end",
"def handle_new_entry t1, t2, description\n t1, t2 = [t1.strip, t2.strip].map do |t|\n if t =~ REGEX_FLOAT\n # time is in a decimal hour format e.g. 7.5\n t.to_f\n elsif t =~ /^(\\d{1,2}):(\\d\\d)$/\n # time is in a h:mm or hh:mm format\n $1.to_f + $2.to_f / 60.0\n else\n raise 'parse error - invalid hours'\n end\n end\n t2 += 24.0 if t2 < t1 # time period spanning midnight\n task_hours = t2 - t1\n @current_day[:entries] += 1\n @current_day[:hours] += task_hours\n puts \"#{format_time_from_hour(t1.to_f)} (%2.2f) #{description}\" % task_hours\n end",
"def create\n\n # binding.pry\n\n unless params[:name].nil?\n\n if Task.where(name: params[:name]).exists?\n\n task = Task.find_by_name(params[:name])\n else\n task = Task.create(name: params[\"name\"])\n end\n @time_record = TimeRecord.new(state: \"open\", task_id: task.id)\n\n else\n @time_record = TimeRecord.new(state: \"open\")\n\n end\n\n\n\n respond_to do |format|\n if @time_record.save\n if task\n task.time_records << @time_record\n end\n format.html { redirect_to edit_time_record_path(@time_record), notice: 'Time record was successfully created.' }\n format.json { render json: @time_record, status: :created, location: @time_record }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_todo\n puts\n desc = description('Todo description (required):')\n return if desc.nil?\n due = due_date\n priority = item_priority\n @list.add('todo',desc, { due: due, priority: priority})\n puts\n end",
"def initialize(item_description)\n @description = item_description\n @completed_status = false\n @created_time = Time.now.strftime(\"%H:%M\") #Time now\n @due_time = (Time.now + 18000).strftime(\"%H:%M\") # TIme now = 5hrs\n end",
"def createToDo title, description\n item = Todo.new\n item.title = title\n item.description = description\n item.save\nend",
"def make_todo(attributes)\n ToDo.create(attributes)\n end",
"def create\n create_entry\n end",
"def create\n @time_entry = current_user.time_entries.build(params[:time_entry])\n @time_entry.entry_user_id = current_user.id\n\n if @time_entry.invoice_id.nil?\n # create from index page\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to firm_time_entry_path(current_firm, @time_entry), notice: 'Time entry was successfully created.' }\n format.json { render json: @time_entry, status: :created, location: @time_entry }\n else\n format.html { index }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n else\n # create from edit invoice page\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to edit_firm_invoice_path(current_firm, @time_entry.invoice_id), notice: 'Time entry was successfully created.' }\n format.json { render json: @time_entry, status: :created, location: @time_entry }\n else\n format.html { new_from_invoice }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def add_an_item\n item = Item.new\n item.description = \"Task number #{to_do_list.size+1}\"\n to_do_list << item\n end",
"def add_timesheet_entry(login_id, project_id, task_id, entry_date, time_in, time_out, comment)\n [{ \"Action\" => \"Edit\",\n \"Type\" => \"Replicon.Suite.Domain.EntryTimesheet\",\n \"Identity\" => login_id,\n \"Operations\" => [\n { \"__operation\" => \"CollectionAdd\",\n \"Collection\" => \"TimeEntries\",\n \"Operations\" => [\n { \"__operation\" => \"SetProperties\",\n \"CalculationModeObject\" => { \"__type\" => \"Replicon.TimeSheet.Domain.CalculationModeObject\", \"Identity\" => \"CalculateDuration\" },\n \"EntryDate\" => { \"__type\" => \"Date\", \"Year\" => entry_date.year, \"Month\" => entry_date.month, \"Day\" => entry_date.day },\n \"TimeIn\" => { \"__type\" => \"Time\", \"Hour\" => time_in.hour, \"Minute\" => time_in.min },\n \"TimeOut\" => {\"__type\" => \"Time\", \"Hour\" => time_out.hour, \"Minute\" => time_out.min },\n \"Comments\" => comment,\n \"Task\" => { \"Identity\" => task_id },\n \"Activity\" => { \"Identity\" => \"1\" }\n },\n { \"__operation\" => \"SetTimeEntryBilling\",\n \"BillingType\" => { \"__type\" => \"Replicon.Project.Domain.Timesheets.TimesheetBillingType\", \"Identity\" => \"NonBillable\" },\n \"Project\" => { \"__type\" => \"Replicon.Project.Domain.Project\", \"Identity\" => project_id }\n }\n ]\n }\n ]\n }\n ]\nend",
"def create_time=(time)\n @create_time = time\n update_times\n end",
"def new\n\t\t# @project = Project.find(params[:project_id])\n\t\t@time_entry = @project.time_entries.new\n\tend",
"def create\n note_id = task_params[\"note_id\"]\n new_task_params = task_params\n new_task_params.delete(\"note_id\")\n @task = Task.new(new_task_params)\n if task_params[\"color\"].nil?\n @task.color = 'purple'\n else\n @task.color = task_params[\"color\"]\n end\n # when note gets dropped on calendar\n if (!note_id.nil?)\n note = Note.find(note_id)\n @task.title = note.title\n @task.description = note.description\n @task.color = note.color\n end\n @task.start = task_params[\"start\"].to_time.utc\n @task.end = task_params[\"end\"].to_time.utc\n # note dragged on all-day area\n if (@task.start == @task.end)\n @task.end = @task.start + 1.days\n end\n # for Google API post\n event = Google::Apis::CalendarV3::Event.new({\n start: {date_time: @task.start.localtime.iso8601},\n end: {date_time: @task.end.localtime.iso8601},\n summary: @task.title,\n description: @task.description\n })\n event = @service.insert_event(\"primary\", event)\n @task.google_id = event.id\n @task.user_id = current_user.id\n @task.save\n end",
"def initialize(options)\n options = options\n\n @task_id = options.fetch(:task_id) { raise 'Creating a time entry requires a task_id'}\n @duration = options.fetch(:duration) { raise 'Creating a time entry requires a duration in seconds'}\n @date = options[:date]\n @note = options[:note]\n end",
"def create\n t_start = params[:item][:start_time].to_date.to_s + ' ' + params[:start_hour]\n t_end = params[:item][:end_time].to_date.to_s + ' ' + params[:end_hour]\n params[:item][:start_time] = DateTime.parse(t_start)\n params[:item][:end_time] = DateTime.parse(t_end)\n params[:item][:start_time] = params[:item][:start_time].change(:offset => \"-5\")\n params[:item][:end_time] = params[:item][:end_time].change(:offset => \"-5\")\n\n @item = Item.new(params[:item])\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @timetable_entry = TimetableEntry.new(timetable_entry_params)\n\n respond_to do |format|\n if @timetable_entry.save\n format.html { redirect_to @timetable_entry, notice: 'Timetable entry was successfully created.' }\n format.json { render action: 'show', status: :created, location: @timetable_entry }\n else\n format.html { render action: 'new' }\n format.json { render json: @timetable_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def redmine_add_time_entry(m, params, certificate)\n begin\n \t#Initialisation des paramètres\n \tif (params[:message] && !params[:message].empty?)\n \t\tmessageEntry = params[:message].to_s.strip\n \telse\n \t\tmessageEntry = \"#{@redmine_l_defaultcommentmessage}\"\n \tend \n\t\t## Save a new time entry\n\t\t# Configuration of the connector\n\t\t::TimeEntry.site = @redmine_rapid_url\n\t\t::TimeEntry.user = certificate[:username]\n\t\t::TimeEntry.password = certificate[:password]\n\t\t# Saving the new timelog\n\t\tnewtimeentry = TimeEntry.new(:issue_id => params[:task], :comments => messageEntry, :activity_id =>@redmine_dev_activity, :hours => params[:spent_time])\n\t\tif ! newtimeentry.save\n \t\treturn false\n \telse \n \t\treturn true\n \tend\n rescue Exception => e\n m.reply \"error: #{e.message}\"\n end\n end",
"def create_todo(todo)\n post_params = {\n :body => todo.post_json,\n :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})\n }\n \n response = Logan::Client.post \"/projects/#{@project_id}/todolists/#{@id}/todos.json\", post_params\n Logan::Todo.new response\n end",
"def maketime\n\n openingtime = OpeningTime.new do |u|\n u.day = params[:opening_times][:day]\n u.from = \"9:00\"\n u.to = \"12 Noon\"\n u.on = true\n u.position = params[:opening_times][:position]\n \n \n end\n openingtime.save\n redirect_to \"/\"\n end",
"def time_entry_insert(h)\n \t\trows = @database.execute <<-SQL\n\t\t\tINSERT INTO time_entries\n\t\t\t\t(time_entry_id\n\t\t\t\t, staff_id\n\t\t\t\t, project_id\n\t\t\t\t, task_id\n\t\t\t\t, hours\n\t\t\t\t, date\n\t\t\t\t, notes\n\t\t\t\t, billed\n\t\t\t\t)\n\t\t\tVALUES\n\t\t\t\t('#{h['time_entry_id']}'\n\t\t\t\t, '#{h['staff_id']}'\n\t\t\t\t, '#{h['project_id']}'\n\t\t\t\t, '#{h['task_id']}'\n\t\t\t\t, '#{h['hours']}'\n\t\t\t\t, '#{h['date']}'\n\t\t\t\t, '#{h['notes']}'\n\t\t\t\t, '#{h['billed']}'\n\t\t\t\t)\n\t\tSQL\n\tend",
"def create\n @item = Todo.create title: params[:title], done: false, created_at: DateTime.now, done_at: nil\n render :json => @item.to_json\n end",
"def create(params, projectid, todolistid)\n\n data = params[:due_at]\n data = Date.parse(data.to_a.sort.collect{|c| c[1]}.join(\"-\"))\n\n body =\n {\n :content => params[:content],\n :due_at => data,\n :assignee =>\n {\n :id => params[:assignee_id],\n :type => params[:assignee_type]\n }\n }\n\n post(\"projects/#{projectid}/todolists/#{todolistid}/todos.json\", JSON.generate(body))\n\n end",
"def create\n \n params[:task][:time] = parse_task_time(params[:task][:time],params[:anytime][:anytime])\n @task = Task.new(params[:task])\n \n # unless the following 2 commands are executed, the time is saved in the wrong time zone\n @task.start_date = @task.start_date.advance({:hours=>0})\n @task.end_date = @task.end_date.advance({:hours=>0})\n # can't understand why...\n \n respond_to do |format|\n if @task.save\n format.html { redirect_to(tasks_url, :notice => 'Task was successfully created.') }\n format.xml { render :xml => @task, :status => :created, :location => @task }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def time_entry_params\n params.require(:time_entry).permit(:user_id, :task_id, :description, :seconds, :worked_on)\n end",
"def new_time_entry_home\n\t\tauthorize!(:new_time_entry_home,current_user) unless current_user.has_access?('Time & Expense')\n\t\tdata=params\n\t\tflash[:notice] = nil\n\t\t@time_entry = current_company.time_entries.new\n\t\t@expense_entry = Physical::Timeandexpenses::ExpenseEntry.new\n\t\tunless data[:physical_timeandexpenses_time_entry].blank?\n\t\t\t@entry_date = data[:physical_timeandexpenses_time_entry][:time_entry_date]\n\t\telse\n\t\t\t@entry_date = data[:time_entry_date] || Time.zone.now.to_date.strftime('%m/%d/%Y')\n\t\tend\n\t\t@note_id=params[:id]\n\t\t@note_name=StickyNote.find(params[:id],:conditions=>{:assigned_to_user_id=>assigned_user}) if params[:id]\n\t\t@time_entry.employee_user_id = get_employee_user_id\n\t\t@lawyers = current_company.users.find(:all, :joins => [:employee], :conditions => [\"users.id = employees.user_id\"])\n\t\tget_unexpired_matters(@entry_date,@time_entry.employee_user_id)\n\t\tget_contacts\n\t\tunless params[:commit].nil?\n\t\t\tadd_breadcrumb params[:commit].include?('Add') ? params[:commit].gsub('Add', 'New') : params[:commit] , {:controller=>\"physical/timeandexpenses/time_and_expenses\",:action=>\"new_time_entry\"} unless params[:height]\n\t\tend\n\t\tunless params[:commit].nil?\n\t\t\tif params[:commit].eql?(\"Add Expense Entry\")\n\t\t\t\tadd_breadcrumb params[:commit].include?('Add') ? params[:commit].gsub('Add', 'New') : params[:commit] , request.request_uri unless params[:height]\n\t\t\telsif params[:commit].eql?(\"Add Time Entry\")\n\t\t\t\tadd_breadcrumb params[:commit].include?('Add') ? params[:commit].gsub('Add', 'New') : params[:commit] , request.request_uri unless params[:height]\n\t\t\tend\n\t\tend\n\t\trender :action =>\"add_expense_entry\" ,:locals=>{:expense_entry_date => @entry_date} and return if params[:commit] == \"Add Expense Entry\"\n\t\tdefault_activity_type_id = CompanyActivityType.find(:first,:conditions=>\"company_id=#{current_company.id}\").id\n\t\t@time_entry.activity_rate = @time_entry.actual_activity_rate = rounding(Physical::Timeandexpenses::TimeEntry.get_billing_rate(get_company_id, get_employee_user_id, default_activity_type_id, get_user_designation_id,get_employee_user_id))\n\t\t@time_entry.activity_rate = @time_entry.actual_activity_rate = rounding(Physical::Timeandexpenses::TimeEntry.get_billing_rate(get_company_id, get_employee_user_id, default_activity_type_id, get_user_designation_id,@time_entry.employee_user_id))\n\t\trender :layout => false if params[:height]\n\tend",
"def create_todo_item(name, list_id)\n data = {\n item: {\n name: name\n }\n }\n rest(\"post\", \"lists/#{list_id}/items\", data)\n end",
"def submit(hours, message = \"\")\n\n account = Config.details\n c = FreshBooks::Client.new(account[\"account\"], account[\"token\"])\n project = Config.details(Dir.pwd)\n entry = c.time_entry.create(\n :time_entry => {\n project_id: project[\"project_id\"],\n task_id: project[\"task_id\"],\n hours: hours.to_f,\n notes: message.gsub(/\\n/,\"\\n\\n\").to_s,\n date: Date.today.to_s\n }\n )\n return validate(entry)\n end",
"def create\n puts \"Olemme create\"\n puts current_user.id\n @todo = Todo.new(todo_params)\n @todo.user_id = current_user.id\n @todo.closed = false\n @todo.created = DateTime.now.to_datetime\n respond_to do |format|\n if @todo.save\n format.html { redirect_to todos_path, notice: 'Tehtävä luotu.' }\n format.json { render :index, status: :created, location: @todo }\n else\n format.html { render :new }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.find(params[:project_id])\n @project_entry = @project.project_entries.new(params[:project_entry])\n @project_entry.start = Time.now\n\n respond_to do |format|\n if @project_entry.save\n format.html { redirect_to @project, notice: 'Project entry was successfully created.' }\n format.json { render json: @project_entry, status: :created, location: @project_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @todo_item = TodoItem.new(todo_item_params)\n\n respond_to do |format|\n if @todo_item.save\n format.html { redirect_to :root, notice: 'Your new task was successfully created.' }\n format.json { render :show, status: :created, location: @todo_item }\n else\n format.html { render :new }\n format.json { render json: @todo_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task_entry = TaskEntry.new(task_entry_params)\n\n respond_to do |format|\n if @task_entry.save\n format.html { redirect_to @task_entry, notice: 'Task entry was successfully created.' }\n format.json { render :show, status: :created, location: @task_entry }\n else\n format.html { render :new }\n format.json { render json: @task_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def insert(todo)\n todo = Rutodo::Database::Todo.new(\n title: todo.title,\n description: todo.description,\n done: todo.status == :finished\n )\n\n todo.save\n\n todo.as_entity\n end",
"def create_time_entry(xero_tenant_id, project_id, time_entry_create_or_update, opts = {})\n data, _status_code, _headers = create_time_entry_with_http_info(xero_tenant_id, project_id, time_entry_create_or_update, opts)\n data\n end",
"def create\n @todo_item = @todo_list.todo_items.new(todo_item_params)\n\n if @todo_item.save\n redirect_to @todo_list, notice: 'Todo item was successfully created.'\n else\n redirect_to @todo_list, alert: 'Todo item failed to be created.'\n end\n end",
"def create\n @working_time = WorkingTime.new(params[:working_time])\n\n respond_to do |format|\n if current_user.time_tables[0].working_times << @working_time\n format.html { redirect_to time_tables_path }\n format.json { render json: @working_time, status: :created, location: @working_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @working_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_meeting_with_child_records(params, existing_time_entry=nil)\n Meeting.transaction do\n if params[:time_entry] && (params[:time_entry][:hours].present? || params[:time_entry][:comments].present?) && User.current.allowed_to?(:log_time, project)\n @time_entry = existing_time_entry || TimeEntry.new\n @time_entry.project = project\n @time_entry.meeting = self\n @time_entry.user = User.current\n @time_entry.spent_on = User.current.today\n @time_entry.attributes = params[:time_entry]\n self.time_entries << @time_entry\n end\n \n if save\n true\n else\n raise ActiveRecord::Rollback\n end\n end\n end",
"def and_i_add_a_new_timeline_entry\n click_on(I18n.t(\"coronavirus.pages.show.timeline_entries.add\"))\n end",
"def create\n @time_table_entry = TimeTableEntry.new(params[:time_table_entry])\n\n respond_to do |format|\n if @time_table_entry.save\n flash[:notice] = 'TimeTableEntry was successfully created.'\n format.html { redirect_to(@time_table_entry) }\n format.xml { render :xml => @time_table_entry, :status => :created, :location => @time_table_entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @time_table_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_new_todo(list_id, todo_name)\n sql = \"INSERT INTO todos (name, list_id) VALUES ($1, $2)\"\n query(sql, todo_name, list_id)\n end",
"def new\n @todo = Todoo.new\n end",
"def create\n @time_task = TimeTask.new(params[:time_task])\n\n respond_to do |format|\n if @time_task.save\n flash[:notice] = 'TimeTask was successfully created.'\n format.html { redirect_to(@time_task) }\n format.xml { render :xml => @time_task, :status => :created, :location => @time_task }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @time_task.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def createItem(title, description, date)\n new_item = List.new\n new_item.title = title\n new_item.description = description\n new_item.save\n new_item.date = date\n end",
"def create\n \t\t@to_do_list = ToDoList.find(params[:to_do_list_id])\n \t@to_do_item = @to_do_list.to_do_items.new(to_do_items_params)\n \n\t if @to_do_item.save\n\t \tflash[:notice] = \"You successfully created a todo item.\"\n\t \tflash[:color]= \"valid\"\n\t \tredirect_to to_do_list_path(@to_do_list)\n\t else\n\t \tflash[:notice] = \"Fail to create a todo item.\"\n\t \tflash[:color]= \"invalid\"\n\t \trender \"/to_do_list/:id/to_do_item/:id/new\"\n\t end\n\n end",
"def add(todo)\n @items << Item.new(todo)\n save\n @items.last\n end",
"def create\n todolist = params['todolist']\n \n \n \n firstTask = todolist['tasks']['0']\n if not firstTask.nil?\n if not firstTask.empty?\n \n \n @project = @project = $project_collection.find({:_id => BSON::ObjectId(params['projectId']) } ).to_a[0]\n \n date = params['date']\n\n todolist['projectId'] = @project['_id']\n todolist['date'] = date\n \n totalEstManHours = calcTotalEstimatedManHours newtodolist\n todolist['totalEstManHours'] = totalEstManHours\n \n id = $todolist_collection.insert(todolist)\n \n \n \n if not @project.has_key? 'plan'\n @project['plan'] = Hash.new\n end\n \n if not @project['plan'].has_key? date\n @project['plan'][date] = Hash.new\n end\n @project['plan'][date]['todolist_id'] = id \n $project_collection.save(@project)\n \n \n \n redirect_to action: 'show', id: id\n \n end\n end\n \n return\n \n end",
"def add_task task\n time, obj = task\n if time.is_a? Numeric\n time = Time.now + time\n elsif time.is_a? DateTime\n time = time.to_time\n end\n @schedule << [time, obj]\n sort_schedule\n write_schedule\n end",
"def create(properties={})\n entry = LiveJournal::Entry.new\n properties[:time] ||= Time.now\n unless properties[:body]\n raise BodyRequired, \"You must pass a :body.\"\n end\n assign_properties(entry, properties)\n LiveJournal::Request::PostEvent.new(@user, entry).run\n entry.itemid\n end",
"def create\n @event = Event.find(params[:event_id])\n @eventtime = @event.eventtimes.create(params[:eventtime])\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to(@event, :notice => 'Eventtime was successfully created.') }\n format.xml { render :xml => @eventtime, :status => :created, :location => @eventtime }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @eventtime.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(\n name: params[:task][:name],\n description: params[:task][:description],\n completed_at: params[:task][:completed_at]\n )\n if @task.save\n redirect_to task_path(@task.id)\n else\n render :new\n end\n end",
"def add_item_to_with_date(item)\n @to_do_with_date.push(item)\n end",
"def create_project_time_if_needed(date, time, is_date)\n date = date + ' ' + time unless is_date\n\n # let's do some validations\n if can_insert_times? date, is_date\n @time = @project.project_times.new(date_time: date, is_date: is_date)\n return @time.save\n end\n false\n end",
"def set_time_table_item\n @time_table_item = TimeTableItem.find(params[:id])\n end",
"def create\n @task_entry = TaskEntry.new(task_entry_params)\n\n respond_to do |format|\n if @task_entry.save\n format.json { render action: 'show', status: :created, location: @task_entry }\n else\n format.json { render json: @task_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_time(time)\n unless time['duration'].is_a? Integer\n duration = duration_to_seconds(time['duration'])\n time['duration'] = duration\n\n # Duration at this point contains an error_msg if it's not an int\n return duration unless time['duration'].is_a? Integer\n end\n\n if time['duration'] < 0\n return Hash[@error => 'time object: duration cannot be negative']\n end\n\n create_or_update(time, nil, 'time', 'times')\n end",
"def create\n @todo_item = @todo_list.todo_items.create(todo_item_params) \n redirect_to @todo_list, notice: \"Todo item added\"\n end",
"def add_entry(task, measurement)\n entry = Entry.new(task.label, measurement)\n entries.push(entry)\n entry\n end",
"def create_log_entry\n Rails.logger.debug(\"@@@ create_log_entry: task = #{@task.inspect} event = #{@event.inspect}\")\n params = Hash.new\n params[:user_id] = current_user.id\n params[:role_id] = current_user.role.id\n params[:ot_id] = @task.ot.id\n params[:task_id] = @task.id\n params[:description] = \"Transicion de #{@task.current_state} a #{@task.current_state.events[@event.to_sym].transitions_to}\"\n log_entry = Audit.new(params)\n log_entry.save\n end",
"def timelog_issue\n begin\n if params[:issue_id]\n @issue = Issue.find(params[:issue_id])\n @project = @issue.project\n else\n render_404\n return false\n end\n rescue ActiveRecord::RecordNotFound\n render_404\n end\n\n @time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, \n :user => User.find_by_login( params[:user] ), :spent_on => Date.today)\n @time_entry.hours = params[:hours]\n @time_entry.comments = params[:comments]\n @time_entry.activity_id = params[:activity_id]\n \n if @time_entry.save\n render :text => 'ok' \n else\n render :text => @time_entry.errors.full_messages.to_s\n end\n end",
"def create_new_task(data)\n new_task.click\n new_task_title.when_present.set data[:title] if data[:title]\n new_task_description.set data[:description] if data[:description]\n new_task_status.select data[:status] if data[:status]\n save_new_task.click\n end",
"def create_time_entry_with_http_info(xero_tenant_id, project_id, time_entry_create_or_update, options = {})\n opts = options.dup\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectApi.create_time_entry ...'\n end\n # verify the required parameter 'xero_tenant_id' is set\n if @api_client.config.client_side_validation && xero_tenant_id.nil?\n fail ArgumentError, \"Missing the required parameter 'xero_tenant_id' when calling ProjectApi.create_time_entry\"\n end\n # verify the required parameter 'project_id' is set\n if @api_client.config.client_side_validation && project_id.nil?\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling ProjectApi.create_time_entry\"\n end\n # verify the required parameter 'time_entry_create_or_update' is set\n if @api_client.config.client_side_validation && time_entry_create_or_update.nil?\n fail ArgumentError, \"Missing the required parameter 'time_entry_create_or_update' when calling ProjectApi.create_time_entry\"\n end\n # resource path\n local_var_path = '/Projects/{projectId}/Time'.sub('{' + 'projectId' + '}', project_id.to_s)\n\n # camelize keys of incoming `where` opts\n opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?\n\n # query parameters\n query_params = opts[:query_params] || {}\n \n # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:\n query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?\n query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Xero-Tenant-Id'] = xero_tenant_id\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(time_entry_create_or_update) \n\n # return_type\n return_type = opts[:return_type] || 'TimeEntry' \n\n # auth_names\n auth_names = opts[:auth_names] || ['OAuth2']\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, \"ProjectApi\", new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectApi#create_time_entry\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n self[:created] = Time.now.to_s\n save\n end",
"def create\n @entry = @time_sheet.entries.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n # [@user, @time_sheet, @entry]\n # user_time_sheet_entries_path(@user, @time_sheet)\n format.html { redirect_to user_time_sheet_entries_path(@user, @time_sheet), notice: 'Hours were successfully added.' }\n format.json { render json: [@user, @time_sheet, @entry], status: :created, location: [@user, @time_sheet, @entry] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_task\n @p=task_params\n if !@p[:activity_id] || !@p[:project_id]\n flash[:error]='Please make sure to fill out the form correctly'\n return redirect_to action:'new_task'\n end\n @activity=Activity.find(@p[:activity_id])\n @c=current_user\n if !@activity.users.include? @c\n flash[:error]='Please make sure to fill out the form correctly'\n return redirect_to action:'new_task'\n end\n @ass=@activity.assignments.find_by_user_id(@c.id)\n @ass.tasks.create(\n hours: @p[:hours],\n notes: @p[:notes],\n date: @p[:date]\n )\n flash[:notice]='Task has been submitted'\n redirect_to '/user/new_entry'\n end",
"def create\n @timesheet_entry = TimesheetEntry.new(params[:timesheet_entry])\n @timesheet_entry.user_id=current_user.id\n\n respond_to do |format|\n if @timesheet_entry.save\n format.html { redirect_to @timesheet_entry, notice: 'Timesheet entry was successfully created.' }\n format.json { render json: @timesheet_entry, status: :created, location: @timesheet_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @timesheet_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def created(item)\n end",
"def create\n prompt = TTY::Prompt.new\n system 'clear'\n\n # Prompts\n @title = prompt.ask(\"Enter task title: \") do |q|\n q.validate -> (input) {input.chomp.length > 0}\n q.messages[:valid?] = \"Invalid Title: Title cannot be blank!\"\n end\n @body = prompt.ask(\"Enter task description: \")\n @importance = prompt.slider(\"Importance: \", min: 0, max: 10, step: 1)\n @urgency = prompt.slider(\"Urgency: \", min: 0, max: 10, step: 1)\n @time_required = prompt.slider(\"Task estimate duration in hours: \",\n min: 0, max: 4, step: 0.2)\n @date_response = prompt.ask(\"Enter task due date (dd/mm/yyyy): \") do |q|\n q.required true\n q.convert :date\n q.validate ->(input) {Date.today <= Date.parse(input)}\n q.messages[:valid?] = \"Invalid Date: Date must be in future!\"\n end\n\n #Default Actions\n @creation_time = Date.today\n prompt.ok(\"Task has been added!\\n\")\n end",
"def add_task(db, task, date_needed, notes)\n db.execute(\"INSERT INTO list (task, date_needed, notes) VALUES (?, ?, ?)\", [task, date_needed, notes])\nend",
"def running_new\n entry = Entry.new\n entry.reference = \"\"\n entry.user = current_user\n entry.set_property(\"entrydate\", params[:data][:StartTime])\n entry.set_property(\"entrylocation\", params[:data][:location])\n entry.set_property(\"comment\", params[:data][:comment])\n entry.set_property(\"publicvisible\", 2)\n entry.set_property(\"courselength\", params[:data][:courselength])\n entry.set_property(\"coursetype\", params[:data][:coursetype])\n entry.public_visible = 2\n\n base_new(params, \"Running\", entry)\n end",
"def create\n @timed_task = TimedTask.new(timed_task_params)\n\n respond_to do |format|\n if @timed_task.save\n format.html { redirect_to @timed_task, notice: 'Timed task was successfully created.' }\n format.json { render :show, status: :created, location: @timed_task }\n else\n format.html { render :new }\n format.json { render json: @timed_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n todo_text = params[:todo_text]\n due_date = params[:due_date]\n new_todo = Todo.new(todo_text: todo_text, due_date: due_date, completed: false, user_id: current_user.id)\n new_todo.save\n if new_todo.save\n redirect_to todos_path\n else\n flash[:error] = new_todo.errors.full_messages.join(\" , \")\n redirect_to todos_path\n end\n end",
"def create\n @todo = Todo.new(todo_params)\n @todo.save\n end",
"def todo_params\n params.require(:todo).permit(:title, :notes, :deadline, :time)\n end",
"def add_item(db, new_item, new_date)\n db.execute(\"INSERT INTO todolist (item, date, done) VALUES (?, ?, ?)\", [new_item, new_date, \"false\"])\nend",
"def newitem\n entry = Pages::Storage::Entry.new(self)\n\n entry.title = ''\n entry.tags = []\n entry.date = Time.new\n entry.content = ''\n entry.draft = false\n\n @items << entry\n\n return entry\n end",
"def create\n @to_do_item = ToDoItem.new(params[:to_do_item])\n\n respond_to do |format|\n if @to_do_item.save\n format.html { redirect_to @to_do_item, notice: 'To do item was successfully created.' }\n format.json { render json: @to_do_item, status: :created, location: @to_do_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @to_do_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def addItem\n begin\n ProgrammeItem.transaction do\n @assignment = nil\n if !params[:cancel]\n item = ProgrammeItem.find(params[:itemid])\n room = Room.find(params[:roomid])\n day = params[:day]\n time = params[:time].to_time # The start time\n\n @assignment = addItemToRoomAndTime(item, room, day, time)\n end\n\n render :layout => 'content'\n end\n rescue => ex\n render status: :bad_request, text: ex.message\n end\n end",
"def create\n @task_item = TaskItem.new(task_item_params)\n @task_item.task_id = @task.id\n\n respond_to do |format|\n if @task_item.save\n format.html { redirect_to task_item_path(@task, @task_item), notice: 'Task Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: task_item_path(@task, @task_item) }\n else\n format.html { render action: 'new' }\n format.json { render json: @task_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @todo = Todo.new(todo_params)\n @todo.task_list_id = @list.id\n respond_to do |format|\n if @todo.save\n format.html { redirect_to @todo, notice: 'Todo was successfully created.' }\n format.json { render :show, status: :created}\n else\n format.html { render :new }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if current_user\n @task = current_user.tasks.new(params[:task])\n @task.update_attributes(:assigned_date => Time.now, :opened_date => nil, :expectation_date => nil, :closed_date => nil)\n respond_to do |format|\n if @task.save\n format.html { redirect_to tasks_path, notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to tasks_path, notice: 'Please Log In First.'\n end\n end",
"def task_entry_params\n params.require(:task_entry).permit(:task_id, :duration, :note, :start_time)\n end",
"def make_task_due(title, description, done=false, due_date)\n taskdue = Task.new\n taskdue.title = title\n taskdue.description = description\n taskdue.done = done\n taskdue.due_date = due_date\n taskdue.save\nend",
"def create\n if get_case\n @task = @case.tasks.create(task_params)\n path_tasks = case_tasks_path\n else\n @task = Task.new(task_params)\n path_tasks = tasks_path\n end\n\n @task.user = @user\n @task.firm = @firm\n\n respond_to do |format|\n if @task.save\n track_activity @task\n if @task.add_event && @task.due_date.present?\n @task.create_event\n end\n format.html { redirect_to path_tasks, notice: 'Task successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_task(db, table_name, name, time, importance)\n\tdb.execute(\"INSERT INTO #{table_name} (task_name, task_time, importance) VALUES (?, ?, ?)\", [name, time, importance])\nend",
"def create_event(action, todo, meta={})\n Event.create(\n user_id: todo.creator_id,\n action: action,\n target: todo,\n project_id: todo.project_id,\n meta: meta,\n )\n end",
"def create_empty_record\n \n @todo = Todo.new\n @todo.name= \"New Todo Item\"\n @todo.priority = 100\n @todo.user_id=session[:user_id]\n @todo.todo_list_id=params[:todo_list_id] || 0\n @todo.save\n \n redirect_to(:controller=>:todos, :action=>:edit, :id=>@todo)\n end",
"def create\n @todo_list = current_user.todo_lists.build(todo_list_params)\n @todo_list.unique_id = Time.now.to_f\n\n respond_to do |format|\n if @todo_list.save\n format.html { redirect_to root_path, notice: 'Lista criada com sucesso.' }\n format.json { render :show, status: :created, location: @todo_list }\n else\n format.html { render :new }\n format.json { render json: @todo_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_task (db, task, due_date, completed)\r\n db.execute(\"INSERT INTO tasks (task, due_date, completed) VALUES (?, ?, ?)\", [task, due_date, completed])\r\nend",
"def create\n @work_entry = WorkEntry.new(duration_to_minutes(params[:work_entry]))\n\n respond_to do |format|\n if @work_entry.save\n format.html { redirect_to @work_entry, notice: 'Work entry was successfully created.' }\n format.json { render json: @work_entry, status: :created, location: @work_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @todo_task = TodoTask.new(params[:todo_task])\n\n respond_to do |format|\n if @todo_task.save\n format.html { redirect_to @todo_task, notice: 'Todo task was successfully created.' }\n format.json { render json: @todo_task, status: :created, location: @todo_task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @todo_task.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6905482",
"0.67226046",
"0.67226046",
"0.67226046",
"0.6716773",
"0.65780985",
"0.6569305",
"0.6525802",
"0.6366464",
"0.6357043",
"0.6357043",
"0.6354616",
"0.6339933",
"0.6269349",
"0.623345",
"0.62332565",
"0.6230968",
"0.62197655",
"0.6199245",
"0.61868274",
"0.6108667",
"0.60637975",
"0.60561943",
"0.6055051",
"0.6054444",
"0.60521215",
"0.60432357",
"0.6035105",
"0.59763926",
"0.59655267",
"0.5958703",
"0.59460324",
"0.59369254",
"0.59351885",
"0.5934661",
"0.59324014",
"0.5931807",
"0.5931565",
"0.59173626",
"0.5899833",
"0.5894457",
"0.58869255",
"0.5883439",
"0.5873025",
"0.5871156",
"0.58637315",
"0.58603024",
"0.5854211",
"0.5845269",
"0.58391464",
"0.58319664",
"0.5827738",
"0.58241105",
"0.57947385",
"0.5783249",
"0.5782911",
"0.5781228",
"0.578041",
"0.57747006",
"0.577389",
"0.5770775",
"0.57659405",
"0.5756064",
"0.5750705",
"0.573754",
"0.5730693",
"0.5717992",
"0.5717091",
"0.5715897",
"0.5695632",
"0.56953996",
"0.56881535",
"0.5684368",
"0.56812346",
"0.56680244",
"0.5664609",
"0.56634444",
"0.5660249",
"0.5649535",
"0.56494516",
"0.5647414",
"0.5635375",
"0.56285065",
"0.5626808",
"0.5624182",
"0.5610026",
"0.5606012",
"0.56045943",
"0.5602225",
"0.5601692",
"0.5595008",
"0.55935174",
"0.5589953",
"0.5579666",
"0.55796164",
"0.55784386",
"0.5565888",
"0.55624247",
"0.55605614",
"0.5554086"
] |
0.74935913
|
0
|
Destroy a time entry
|
def destroy_time_entry(time_entry_id)
response = basecamp_connection.delete("/time_entries/#{time_entry_id}.xml")
if response.code == '200'
return true
else
return false
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete_time_entry(id)\n send(:delete, \"time_entries/#{id}\")\n end",
"def destroy\n @time_slot.destroy\n end",
"def destroy\n @timeslot.destroy\n end",
"def destroy\n @time_entry = TimeEntry.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to time_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_entry = TimeEntry.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to time_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_entry.destroy\n respond_to do |format|\n format.html { redirect_to time_entries_url, notice: 'Time entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @timing.destroy\n end",
"def destroy\n @timeentry = Timeentry.find(params[:id])\n @timeentry.destroy\n\n respond_to do |format|\n format.html { redirect_to timeentries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_entry = TimeEntry.with_deleted.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to time_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @anime.destroy\n end",
"def destroy\n @time_entry = current_firm.all_time_entries.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to params[:ret] || firm_time_entries_path(current_firm) }\n format.json { head :ok }\n end\n end",
"def remove_time_slot\n\n end",
"def destroy\n @time_table_entry = TimeTableEntry.find(params[:id])\n @time_table_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(time_table_entries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @clock_event.destroy\n end",
"def deletetime\n OpeningTime.find(params[:id]).destroy\n redirect_to \"/admin\"\n end",
"def destroy\n self.unuse_pto_hours\n @time_off_instance.destroy\n respond_to do |format|\n format.html { redirect_to time_off_instances_url, notice: 'Time off instance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n update(deleted_at: Time.current)\n end",
"def destroy\n @timetable_entry.destroy\n respond_to do |format|\n format.html { redirect_to timetable_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @allocated_time.destroy\n respond_to do |format|\n format.html { redirect_to allocated_times_url, notice: 'Allocated time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hour_entry = HourEntry.find(params[:id])\n @hour_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(hour_entry_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @entry = @time_sheet.entries.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to user_time_sheet_entries_url }\n format.json { head :no_content }\n end\n end",
"def delete_time(uuid = nil)\n # Check that user has authenticated\n @local_auth_error = local_auth_error\n return Hash[@error => @local_auth_error] if @local_auth_error\n\n return Hash[@error => 'missing uuid; please add to method call'] unless uuid\n\n delete_object('times', uuid)\n end",
"def destroy\n @time_record = TimeRecord.find(params[:id])\n @time_record.destroy\n\n respond_to do |format|\n format.html { redirect_to time_records_url,\n notice: (crud_notice('destroyed', @time_record) + \"#{undo_link(@time_record)}\").html_safe }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_clock.destroy\n respond_to do |format|\n format.html { redirect_to time_sheet_index_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @big_time_entry.destroy\n respond_to do |format|\n format.html { redirect_to big_time_entries_url, notice: 'Big time entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @p_time.destroy\n respond_to do |format|\n format.html { redirect_to p_times_url, notice: 'P time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @timesheet_entry = TimesheetEntry.find(params[:id])\n @timesheet_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to timesheet_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @moment.destroy\n end",
"def destroy\n @cal_time.destroy\n respond_to do |format|\n format.html { redirect_to cal_times_url, notice: 'Cal time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_record.destroy\n respond_to do |format|\n format.html { redirect_to time_records_url, notice: 'Time record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_period.destroy\n format.json { head :no_content }\n end",
"def delete_loc_time\n delete_loc = user_choice_of_object_in_class(LocationTime)\n try_to_update_database{\n if LocationTime.delete_record(delete_loc.location_id, delete_loc.timeslot_id)\n puts \"Deleted.\"\n else\n puts \"Not deleted. This object id exists in another table.\"\n end\n }\n loc_time_menu\n end",
"def destroy\n @hurdle_time = HurdleTime.find(params[:id])\n @hurdle_time.destroy\n\n respond_to do |format|\n format.html { redirect_to hurdle_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @timeslot = current_event.timeslots.find(params[:id])\n @timeslot.destroy\n\n respond_to do |format|\n format.html { redirect_to(timeslots_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @timetable.destroy\n redirect_to timetables_url, notice: 'Timetable was successfully destroyed.'\n end",
"def destroy\n @cooking_time.destroy\n respond_to do |format|\n format.html { redirect_to cooking_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offset_time = OffsetTime.find(params[:id])\n @offset_time.destroy\n\n respond_to do |format|\n format.html { redirect_to offset_times_url }\n format.json { head :no_content }\n end\n end",
"def after_destroy(entry)\n expire_cache_for(entry)\n end",
"def destroy\n @eventtime = Eventtime.find(params[:id])\n @eventtime.destroy\n\n respond_to do |format|\n format.html { redirect_to(eventtimes_url) }\n format.xml { head :ok }\n end\n end",
"def delete_time_entry(xero_tenant_id, project_id, time_entry_id, opts = {})\n delete_time_entry_with_http_info(xero_tenant_id, project_id, time_entry_id, opts)\n nil\n end",
"def destroy\n @ztime = Ztime.find(params[:id])\n @ztime.destroy\n\n respond_to do |format|\n format.html { redirect_to(ztimes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @member_time = MemberTime.find(params[:id])\n @member_time.destroy\n\n respond_to do |format|\n format.html { redirect_to member_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @timetable = Timetable.find(params[:id])\n \n if @timetable != nil\n \n res_day = Day.where(:TIMETABLE_ID => @timetable.ID)\n res_day.each do |day|\n res_hour = Hour.where(:DAY_ID => day.ID)\n res_hour.each do |hour|\n hour.destroy\n end\n day.destroy\n end\n \n @timetable.destroy\n \n end\n \n respond_to do |format|\n format.html { redirect_to timetables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n send_calendar_request(\"/#{@id}\", :delete)\n end",
"def destroy\n @section_time.destroy\n respond_to do |format|\n format.html { redirect_to section_times_url, notice: 'Section time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_line.destroy\n respond_to do |format|\n format.html { redirect_to time_lines_url, notice: 'Time line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule.destroy\n end",
"def destroy\n if params[:time] && !WebHookFailures.valid_time?(params[:time])\n render_error 'invalid time', status: :bad_request\n else\n failures.delete(params[:time])\n respond_with(failures, head: :ok)\n end\n end",
"def delete(time, date_type=RailsRank::Types::Date::HOURLY, session=nil)\n start_kvs_session(session) do |kvs|\n kvs.delete(key_name(time, date_type))\n end\n end",
"def destroy\n @timer.destroy\n\n head :no_content\n end",
"def destroy\n @time_of_day.destroy\n respond_to do |format|\n format.html { redirect_to time_of_days_url, notice: 'Time of day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket_time = TicketTime.find(params[:id])\n @ticket_time.destroy\n\n respond_to do |format|\n format.html { redirect_to(ticket_times_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @time_punch.destroy\n respond_to do |format|\n format.html { redirect_to time_punches_url, notice: 'Time punch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_table.destroy\n respond_to do |format|\n format.html { redirect_to time_tables_url, notice: 'Time table was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @work_time.destroy\n respond_to do |format|\n format.html { redirect_to work_times_url, notice: 'Work time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @working_time = WorkingTime.find(params[:id])\n @working_time.destroy\n\n respond_to do |format|\n format.html { redirect_to time_tables_url }\n format.json { head :no_content }\n end\n end",
"def delete\n d = DateTime.now.strftime('%Y-%m-%d %H:%M:%S')\n self.update_attribute(:deleted, d)\n end",
"def destroy\n @time_record = TimeRecord.find(params[:id])\n @time_record.destroy\n\n respond_to do |format|\n format.html { redirect_to time_records_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_record = TimeRecord.find(params[:id])\n @time_record.destroy\n\n respond_to do |format|\n format.html { redirect_to time_records_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_task = TimeTask.find(params[:id])\n @time_task.destroy\n\n respond_to do |format|\n format.html { redirect_to(time_tasks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @titletime.destroy\n respond_to do |format|\n format.html { redirect_to titletimes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_slot.destroy\n respond_to do |format|\n format.html { redirect_to time_slots_url, notice: 'Time slot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroyed_at() ; info_time(:destroyed_datetime) ; end",
"def destroyed_at() ; info_time(:destroyed_datetime) ; end",
"def destroy\n @class_time.destroy\n respond_to do |format|\n format.html { redirect_to class_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @planned_time = PlannedTime.find(params[:id])\n @planned_time.destroy\n\n respond_to do |format|\n format.html { redirect_to planned_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n update_attribute(:deleted_at, Time.now)\n end",
"def destroy\n @timing = Timing.find(params[:id])\n @timing.destroy\n\n respond_to do |format|\n format.html { redirect_to(timings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n set_user\n @time_off.destroy\n respond_to do |format|\n format.html { redirect_to user_time_offs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location_time.destroy\n respond_to do |format|\n format.html { redirect_to location_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meeting_time.destroy\n respond_to do |format|\n format.html { redirect_to meeting_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_gap = TimeGap.find(params[:id])\n @time_gap.destroy\n\n respond_to do |format|\n format.html { redirect_to time_gaps_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @time_control.destroy\n respond_to do |format|\n format.html { redirect_to time_controls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @timecard.destroy\n render status: :ok\n end",
"def destroy\n @daytime = Daytime.find(params[:id])\n @daytime.destroy\n\n respond_to do |format|\n format.html { redirect_to daytimes_url }\n format.json { head :no_content }\n end\n end",
"def create_timed_delete(timeout, port_entry)\n mtimer = EM.add_timer(timeout.to_i) do\n time_left = port_entry.lifetime_left\n if time_left > 0\n #puts \"object has #{time_left} seconds left, #{Time.now}\"\n create_timed_delete(time_left, port_entry)\n else\n #puts \"timed delete writer #{Time.now}\"\n @portentries.delete(@portentries.key(port_entry))\n end\n end\n port_entry.timer = mtimer\n end",
"def destroy\n @time_registration.destroy\n respond_to do |format|\n format.html { redirect_to time_registrations_url, notice: 'Time registration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_table = TimeTable.find(params[:id])\n @time_table.destroy\n\n respond_to do |format|\n format.html { redirect_to(time_tables_url) }\n format.xml { head :ok }\n end\n end",
"def remove_time\n ticket_time = [self.ticket.actual_time - self.time, 0].max\n self.ticket.update_column :actual_time, ticket_time\n end",
"def destroy\n @last_hour = LastHour.find(params[:id])\n @last_hour.destroy\n\n respond_to do |format|\n format.html { redirect_to(last_hours_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @poi_time.destroy\n respond_to do |format|\n format.html { redirect_to poi_times_url, notice: 'Poi time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_slot = TimeSlot.find(params[:id])\n @time_slot.destroy\n\n respond_to do |format|\n format.html { redirect_to time_slots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @working_start_time.destroy\n respond_to do |format|\n format.html { redirect_to working_start_times_url }\n format.json { head :no_content }\n end\n end",
"def delete_entry(aliaz)\n\n end",
"def destroy\n @time_log = TimeLog.find(params[:id])\n @time_log.destroy\n\n respond_to do |format|\n format.html { redirect_to time_logs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @showtime.destroy\n respond_to do |format|\n format.html { redirect_to showtimes_url, notice: \"Showtime was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @timecard = Timecard.find(params[:id])\n @timecard.destroy\n\n redirect_to(timecards_url)\n end",
"def destroy\n @day_timeslot.destroy\n respond_to do |format|\n format.html { redirect_to day_timeslots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.story.touch #update the story's timestamps since its hierarchy has been modified\n @task.destroy\n end",
"def destroy\n @time_tracker.destroy\n respond_to do |format|\n format.html { redirect_to time_trackers_url, notice: 'Time tracker was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @anime = Pusher.destroy_anime(params)\n\n head :no_content\n end",
"def destroy\n @time_section = TimeSection.find(params[:id])\n @time_section.destroy\n\n respond_to do |format|\n format.html { redirect_to time_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @timelog.destroy\n respond_to do |format|\n format.html { redirect_to timelogs_url, notice: 'Timelog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @receiver_time = ReceiverTime.find(params[:id])\n @receiver_time.destroy\n\n respond_to do |format|\n format.html { redirect_to receiver_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_treinador.destroy\n respond_to do |format|\n format.html { redirect_to time_treinadors_url, notice: 'Time deletado com sucesso' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @punchtime.destroy\n respond_to do |format|\n format.html { redirect_to current_user, notice: 'Punchtime was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datetime.destroy\n\n respond_to do |format|\n format.html { redirect_to request.env['HTTP_REFERER'] }\n format.xml { head :ok }\n end\n end",
"def destroy\n @providers_opening_time.destroy\n respond_to do |format|\n format.html { redirect_to providers_opening_times_url, notice: 'Opening time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n self.update_column(:deleted_at, object_zone_time)\n end",
"def destroy\n @nursing_time = NursingTime.find(params[:id])\n @nursing_time.destroy\n\n respond_to do |format|\n format.html { redirect_to nursing_times_url }\n format.json { head :ok }\n end\n end"
] |
[
"0.77992654",
"0.7590809",
"0.74623907",
"0.7444488",
"0.7444488",
"0.7431935",
"0.7351253",
"0.72916806",
"0.7277229",
"0.6959602",
"0.69578123",
"0.69498515",
"0.689085",
"0.68891627",
"0.6864954",
"0.6813109",
"0.6696011",
"0.6674523",
"0.6649583",
"0.664586",
"0.6645859",
"0.6634012",
"0.65884185",
"0.6587804",
"0.6581406",
"0.65744567",
"0.65466344",
"0.6481438",
"0.64609396",
"0.64497817",
"0.6441071",
"0.64366853",
"0.64362025",
"0.6428952",
"0.64132816",
"0.64074665",
"0.6404902",
"0.64010024",
"0.6390077",
"0.63874805",
"0.63808584",
"0.6378103",
"0.63747424",
"0.6358662",
"0.6345149",
"0.63331777",
"0.63274413",
"0.6327037",
"0.6316773",
"0.6309194",
"0.6298892",
"0.62694776",
"0.6256202",
"0.62368387",
"0.62281996",
"0.62239295",
"0.62160605",
"0.6214764",
"0.6214764",
"0.6206906",
"0.62036395",
"0.6201982",
"0.61960024",
"0.61960024",
"0.61734736",
"0.6161037",
"0.6160819",
"0.6149022",
"0.6141968",
"0.61393636",
"0.61382943",
"0.6136851",
"0.6131499",
"0.61313736",
"0.61250824",
"0.6124048",
"0.61211413",
"0.6120389",
"0.6117277",
"0.6115569",
"0.6114155",
"0.6111645",
"0.61064243",
"0.6101139",
"0.6100229",
"0.6097941",
"0.6095598",
"0.6093011",
"0.608098",
"0.607962",
"0.6074119",
"0.60738367",
"0.6069118",
"0.6065083",
"0.6056104",
"0.6055403",
"0.6054161",
"0.6053828",
"0.60493743",
"0.6039183"
] |
0.7660365
|
1
|
Fast way of fetching the value of the cell table.get("my_id", :info, :name) => "Bob"
|
def get(id, column_family_name, column_name)
get_cell(id, column_family_name, column_name).try :value
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get(field)\n # Get the first/only row as a Hash.\n result = CONNECTION.execute(\"SELECT * FROM #{table_name} WHERE id = #{@id}\").first\n\n # Return only the value for the key of the field we're seeking.\n return result[field]\n end",
"def get(field)\n result = CONNECTION.execute(\"SELECT * FROM '#{tablename}' WHERE id = ?;\", @id).first\n result[field]\n end",
"def get_cell(id, column_family_name, column_name)\n if cell = connection.get(name, id, \"#{column_family_name.to_s}:#{column_name.to_s}\", {}).first\n MassiveRecord::Wrapper::Cell.populate_from_tcell(cell)\n end\n end",
"def get_cell(cell)\n query_cell_info '/cell/get', cell\n end",
"def return_value(db, table, id, key)\r\n\tvalue_array = db.execute(\"SELECT #{key} FROM #{table} WHERE id=#{id}\")\r\n\r\n\t# If not defined, return nil\r\n\tif value_array.empty?\r\n\t\treturn nil\r\n\tend\r\n\tif value_array.length > 1\r\n\t\tputs \"ERROR! Multiple matches for id #{id}!\"\r\n\t\treturn nil\r\n\tend\r\n\t# If id is found, return value associated with key\r\n\treturn value_array[0][key]\r\nend",
"def [](key)\n @table.get(key)\n end",
"def getvalue(row, column)\n rows[row][column]\n end",
"def get(row, column)\n cell(normalize_key(row), normalize_key(column))\n end",
"def get(row, column)\n cell(normalize_key(row), normalize_key(column))\n end",
"def getCell(row,col)\n the_row = @rows[row]\n the_cell = the_row.cells[col]\n return the_cell\n end",
"def get(key)\n key = normalize(key) or return\n table[key]\n end",
"def cell_with_id(cell_id)\n cell(:id, cell_id).text\n end",
"def get(row_key, col_key)\n get!(row_key, col_key)\n rescue KeyError\n nil\n end",
"def get(x,y)\n row = @rows[y]\n if row == nil\n nil\n else\n # puts \"GLayer.get got a row: #{row.inspect} and the value is #{row[x]}\"\n row[x]\n end\n end",
"def get_row(game,row)\n return game[row]\nend",
"def get_row(game,row)\n return game[row]\nend",
"def get(table_name, row, column, options={})\n safe_exec do\n return nil unless row\n table = connect_table(table_name)\n\n # Retreive only the last version by default\n options[:versions] ||= options[:num_versions]\n options[:versions] ||= 1\n\n # validate the arguments\n raise ArgumentError, \"versions must be >= 1\" unless options[:versions] >= 1\n\n # get the raw data from hbase\n unless options[:timestamp]\n if options[:versions] == 1\n raw_data = table.get(row, column)\n else\n raw_data = table.get(row,\n column,\n options[:versions])\n end\n else\n raw_data = table.get(row,\n column,\n options[:timestamp],\n options[:versions])\n end\n\n # Return either a single value or an array, depending on the number of version that have been requested\n if options[:versions] == 1\n return nil unless raw_data\n raw_data = raw_data[0] if options[:timestamp]\n to_ruby_string(raw_data)\n else\n return [] unless raw_data\n raw_data.collect do |raw_data_version|\n to_ruby_string(raw_data_version)\n end\n end\n end\n end",
"def get(row, col)\n validate_pos(row, col)\n @fm[row*@cols + col]\n end",
"def get_value(name)\n collection.find_one(get_search_query)[\"#{name}\"]\n end",
"def get_table(table, identifier)\n if table['quick_look'].has_key?(identifier)\n table['table_data'].reverse_each do |elem|\n return elem[1] if elem[0].eql?identifier\n end\n end\n return nil\nend",
"def get_table(table, identifier)\n if table['quick_look'].has_key?(identifier)\n table['table_data'].reverse_each do |elem|\n return elem[1] if elem[0].eql?identifier\n end\n end\n return nil\nend",
"def select_value(sql, name = nil)\n if result = select_one(sql, name)\n result.values.first\n end\n end",
"def get(name)\n return @table[name] if @table.has_key?(name)\n return @parent.get(name) unless @parent.nil?\n return nil\n end",
"def fetch_value(value); end",
"def get(expr)\n dataset.get(expr)\n end",
"def get(expr)\n dataset.get(expr)\n end",
"def get_cell(row, column)\n @fields[row][column]\n end",
"def [](name)\n @table[name.to_sym]\n end",
"def find(k)\n @cells[k]\n end",
"def value_at(row, col)\n row = convert_indicies(row, self.rows)\n col = convert_indicies(col, self.cols)\n return @data.get(row.first, col.first)\n end",
"def fetch(key); end",
"def getTable() \n puts @table[0][\"name\"];\n end",
"def fetch_value(sql)\n # Get the row\n row = fetch_row(sql)\n\n # Check field count\n if row.count > 1\n check.critical(\"Expected to receive a single value, but result has more than one field\", \"SQL: #{sql}\\nResult: #{row.inspect}\")\n end\n\n return row.values.first\n end",
"def get_value(name)\n name = name.to_s.upcase.to_sym\n return @values_changed[name] if @values_changed.has_key?(name)\n return nil if new_record?\n column = @table.column(name)\n raise UnknownColumnError.new(name) unless column\n @values_cached[name] ||= column.unpack(@data[column.offset, column.size])\n end",
"def get(key)\n run_hook(:before_get, key)\n value = db[key]\n run_hook(:after_get, key, value)\n value\n end",
"def get(key)\n node = @table[key]\n return -1 if node.nil?\n\n make_most_recent_used(node)\n node.value\n end",
"def fetch(name); end",
"def get_value name\n get name\n end",
"def get(field)\n @dataset.get(field)\n end",
"def fetchValue(data, x, y)\n if data.has_key?(x) and data[x].has_key?(y)\n return data[x][y]\n else\n return 0\n end\nend",
"def row(row_id); get(\"#{link('rows')}/#{row_id}\"); end",
"def read!(key)\n @table[key.to_sym]\n end",
"def cell_with_id(cell_id, options = {})\r\n if options && options[:index] then\r\n cell(:id => cell_id.to_s, :index => options[:index]).text\r\n else\r\n cell(:id, cell_id).text\r\n end\r\n end",
"def fetch(name, offset=0)\n addr = pfa(name)\n @vm.fetch(addr + cells(offset))\n end",
"def find(id)\n @data[id]\n end",
"def getResult(_name, _nth = :all, _sync = false)\n _resultTab = getResultTable(_nth, _sync) ;\n if(_resultTab.is_a?(Array)) then\n return _resultTab.map{|_tab| _tab[_name]} ;\n elsif(_resultTab) then\n return _resultTab[_name] ;\n else\n return nil ;\n end\n end",
"def get(key)\n i = key.hash % @table.size\n node = @table[i]\n while node\n return node.value if key == node.key\n node = node.next\n end\n nil\n end",
"def get(key)\n db.get(key)\n end",
"def read_field_for_id(id, field)\n Sidekiq.redis do |conn|\n conn.hmget(id, field)[0]\n end\n end",
"def [](name)\n @table[name.to_sym]\n end",
"def find_record(table, id)\n result = DB[table].where(id: id).first\n result ? Hashie::Mash.new(result) : nil\nend",
"def get_name(conn, id)\n conn.exec_params(\"SELECT name FROM actors WHERE id=$1\",\n [id])[0][\"name\"]\nend",
"def [](attr_name)\n if attr_name.class == Fixnum\n cells.joins(:row).where(rows: {position: attr_name}).first\n else\n read_attribute(attr_name) { |n| missing_attribute(n, caller) }\n end\n end",
"def get_row(row)\n board = $boggle_board\n return board[row]\nend",
"def get(name)\n name_in_transaction?(name) ? get_value_from_deepest_transaction(name) : self.database[name]\n end",
"def get(name)\n lookup(key(name.to_s))\n end",
"def get_elem cell\n\t\treturn @elements[cell]\n\tend",
"def get(key)\n response = db.get_item(@table_name, {'HashKeyElement' => {'S' => key}})\n get_item_from_body(response.body)\n end",
"def view_event(id)\n result = CONNECTION.execute(\"SELECT name FROM check_splitter WHERE id = #{id};\")\n result.first[\"name\"]\n # result[0][\"name\"]\nend",
"def column_value\n row.fetch(column){row[@column.to_s]}\n end",
"def fetch( id )\n r = nil\n begin\n r = lib.tcidbget( @db, id )\n rescue => e\n # if we have 'no record found' then return nil\n if lib.tcidbecode( @db ) == 22 then\n return nil\n else\n raise_error\n end\n end\n return r\n end",
"def get_row(board, row)\n board[row]\nend",
"def get_row(board, row)\n board[row]\nend",
"def tableView_objectValueForTableColumn_row_(view, col, row)\n\t\t\tcase col.identifier.to_s\n\t\t\twhen \"ID\"\n\t\t\t\treturn @customers[row].id\n\t\t\twhen \"FNAME\"\n\t\t\t\treturn @customers[row].first_name\n\t\t\twhen \"LNAME\"\n\t\t\t\treturn @customers[row].last_name\n\t\t\twhen \"STREET1\"\n\t\t\t\treturn @customers[row].street_1\n\t\t\twhen \"CITY\"\n\t\t\t\treturn @customers[row].city\n\t\t\twhen \"ZIP\"\n\t\t\t\treturn @customers[row].zip\n\t\t\twhen \"EMAIL\"\n\t\t\t\treturn @customers[row].email\n\t\t\telse\n\t\t\t\treturn nil\n\t\t\tend\n end",
"def tableView_objectValueForTableColumn_row_(view, col, row)\n\t\t\tcase col.identifier.to_s\n\t\t\twhen \"ID\"\n\t\t\t\treturn @customers[row].id\n\t\t\twhen \"FNAME\"\n\t\t\t\treturn @customers[row].first_name\n\t\t\twhen \"LNAME\"\n\t\t\t\treturn @customers[row].last_name\n\t\t\twhen \"STREET1\"\n\t\t\t\treturn @customers[row].street_1\n\t\t\twhen \"CITY\"\n\t\t\t\treturn @customers[row].city\n\t\t\twhen \"ZIP\"\n\t\t\t\treturn @customers[row].zip\n\t\t\twhen \"EMAIL\"\n\t\t\t\treturn @customers[row].email\n\t\t\telse\n\t\t\t\treturn nil\n\t\t\tend\n end",
"def get_hash_val(name)\n\t\tfetch(name) if has_key?(name)\n\tend",
"def get_row(row)\n $boggle_board[row]\nend",
"def cellAt(row, col)\n\t\treturn @rows[row][col]\n\tend",
"def get_username_for_id(user_id)\n return $db.execute(\"SELECT username FROM users WHERE user_id = ?\", user_id)[0][\"username\"]\nend",
"def [](key)\n @table[key.to_s]\n end",
"def cell(row, col, sheet = nil)\n sheet ||= @default_sheet\n read_cells(sheet)\n\n @cell[sheet].fetch(normalize(row, col).to_a, nil)\n end",
"def get_row(board, row)\n return board[row]\nend",
"def grid_cell_value(index, attribute)\n wait_for_ajax do\n page.driver.browser.execute_script(<<-JS)\n return Ext.ComponentQuery.query('gridpanel, treepanel')[0].getStore().getAt(#{index}).get('#{attribute}');\n JS\n end\n end",
"def get(name)\n data[name]\n end",
"def get_row(row,board)\n return board[row] \nend",
"def get(element)\n i = element.hash % @table.size\n node = @table[i]\n while node\n return node.item if element == node.item\n node = node.next\n end\n return nil\n end",
"def get(value)\n @client.execute_udf(@key, @PACKAGE_NAME, 'get', [@bin_name, value], @policy)\n end",
"def [](key)\r\n assert_exists\r\n arr_rows = rows\r\n return arr_rows[key - 1]\r\n end",
"def fetch_value( oid, key )\n\t\toid = normalize_oid( oid )\n\t\tkey = normalize_key( key )\n\t\tdata = @storage[ oid ] or return nil\n\n\t\treturn data[ key ]\n\tend",
"def cursor_value(row_idx: c_y, col_idx: c_x)\n map.value(row_idx, col_idx)\n end",
"def index_get(key, value, index_type = :exact, clazz = Neo4j::Node)\n indexer = Indexer.instance_for(clazz)\n indexer.index_get(key, value, index_type)\n end",
"def get value, option={}\n if value.is_a? Hash\n if value[:index]\n get_from_local_index value, option\n elsif option[:noindex]\n option.delete(:noindex)\n query_without_index value, option\n else\n get_from_index value, option\n end\n else\n get_from_key value, option\n end\n end",
"def get_cell(x, y)\n grid[x][y]\n end",
"def [](id)\n id = get_id(id) if id.is_a?(Symbol)\n id = 0 unless id.is_a?(Integer) && id_valid?(id)\n return @data[id]\n end",
"def get_row_by_idx(idx)\n @row[idx]\n end",
"def find_with(hash)\n\t\tcolumn = hash.keys.first\n\t\tcheck_column(column.to_s)\n\t\tvalue = hash[column]\n\t\tresult = @db.execute(\n\t\t\t\"SELECT * FROM #{@table} WHERE #{column.to_s} IS ?\", \n\t\t\tvalue\n\t\t)\n\n\t\tif(result.size == 0)\n\t\t\tnil\n\t\telse\n\t\t\tresult[0]\n\t\tend\n\tend",
"def get(aName,aKey)\n i = searchKey(aName,aKey)\n result = serv_data[i].values[0]\n if i != '' then\n updateLastGet(i)\n return \"VALUE #{result.values[0][0]} #{result.keys[0]} #{result.values[0][1]} #{result.values[0][2]} #{result.values[0][3]}\"\n else\n return \"VALUE\"\n end\n end",
"def hget(key, field); end",
"def hget(key, field); end",
"def get_contact(id)\n contacts = read_contacts\n contacts.select { |contact| contact[:id] == id }.first\nend",
"def fetch(*key); end",
"def get_row(row)\n row = $boggle_board[row]\nend",
"def lookup_and_parse col, expect_cq\n @hbase.schema.lookup_and_parse @name_sym, col, expect_cq\n end",
"def get(name); end",
"def getCell(x, y)\n return @grid.getCell(x,y)\n end",
"def result_for(id)\n Sequel::SchemaSharding::Finder.instance.lookup(self.implicit_table_name, id)\n end",
"def fetch(id)\n search(id: id)[:records].first\n end",
"def value\n fetch(0, 0)\n end",
"def [](k)\n\n load_onto_stack # table\n stack_push(k) # key\n Lib.lua_gettable(@pointer, -2) # fetch val for key at top and table at -2\n stack_pop\n end",
"def find_by(attribute, value)\n row = connection.get_first_row <<-SQL\n SELECT #{columns.join \",\"} FROM #{table}\n WHERE #{attribute} = #{BlocRecord::Utility.sql_strings(value)};\n SQL\n\n # converts a row into an object\n init_object_from_row(row)\n end"
] |
[
"0.68539226",
"0.68029714",
"0.66870934",
"0.661898",
"0.6324234",
"0.62525666",
"0.6139114",
"0.61344707",
"0.61344707",
"0.6111823",
"0.6079337",
"0.6046893",
"0.5973868",
"0.59589195",
"0.5905197",
"0.5905197",
"0.59026295",
"0.59010977",
"0.5898378",
"0.5893262",
"0.5892322",
"0.5866238",
"0.58540034",
"0.58511084",
"0.58208704",
"0.58208704",
"0.5806623",
"0.5788383",
"0.57514936",
"0.57423186",
"0.57260257",
"0.571347",
"0.57009363",
"0.56994236",
"0.56956595",
"0.5683796",
"0.5663908",
"0.56613725",
"0.5657383",
"0.5652045",
"0.5636613",
"0.5632891",
"0.56289995",
"0.56271595",
"0.5619896",
"0.5618357",
"0.56177014",
"0.56069285",
"0.5587684",
"0.5568753",
"0.5566914",
"0.55621433",
"0.55559653",
"0.5547641",
"0.55451095",
"0.5538798",
"0.5535197",
"0.5530204",
"0.5527898",
"0.5527834",
"0.5520366",
"0.55117023",
"0.55117023",
"0.5510519",
"0.5510519",
"0.5509422",
"0.54963475",
"0.5495479",
"0.54921013",
"0.54865193",
"0.5484806",
"0.5475563",
"0.54644114",
"0.5464341",
"0.54581565",
"0.54568285",
"0.54549384",
"0.5452342",
"0.545041",
"0.5449609",
"0.5448843",
"0.54435706",
"0.54428375",
"0.5438845",
"0.5435467",
"0.5432689",
"0.5431617",
"0.5429765",
"0.5429765",
"0.5423971",
"0.54208785",
"0.54200476",
"0.54136217",
"0.5411345",
"0.54010445",
"0.53862345",
"0.53860164",
"0.53857774",
"0.53806174",
"0.5375328"
] |
0.67367584
|
2
|
Fast way of fetching one cell
|
def get_cell(id, column_family_name, column_name)
if cell = connection.get(name, id, "#{column_family_name.to_s}:#{column_name.to_s}", {}).first
MassiveRecord::Wrapper::Cell.populate_from_tcell(cell)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def getCell(row,col)\n the_row = @rows[row]\n the_cell = the_row.cells[col]\n return the_cell\n end",
"def get_cell(cell)\n query_cell_info '/cell/get', cell\n end",
"def getCell(x, y)\n return @grid.getCell(x,y)\n end",
"def cellAt(row, col)\n\t\treturn @rows[row][col]\n\tend",
"def naked_single\n each_empty_cell do |cell|\n vals = legal_values(*cell.pos)\n if vals.length == 1\n cell.val = vals.first\n return cell\n end\n end\n return nil\n end",
"def get_cell(row, column)\n @fields[row][column]\n end",
"def cell(row, col, sheet = nil)\n sheet ||= @default_sheet\n read_cells(sheet)\n\n @cell[sheet].fetch(normalize(row, col).to_a, nil)\n end",
"def get_cell(x, y)\n grid[x][y]\n end",
"def read_cell(x, y)\n offset = (y * @height) + x\n\n @cells[offset] if x >= 0 && y >= 0 && x < @width && y < @height\n end",
"def first_cell\n Cell.new( sheet, expand( address ).flatten.first )\n end",
"def get_cell(x, y)\n get_cell_from_board(@board, x, y)\n end",
"def get_elem cell\n\t\treturn @elements[cell]\n\tend",
"def getCell(row, column)\n\n\t\treturn @grid.getElement(row, column)\n\tend",
"def get(row, column)\n cell(normalize_key(row), normalize_key(column))\n end",
"def get(row, column)\n cell(normalize_key(row), normalize_key(column))\n end",
"def get(row_key, col_key)\n get!(row_key, col_key)\n rescue KeyError\n nil\n end",
"def getCell(row, col)\n # Make sure the row/col combination is within the matrix.\n if row > @rows || col > @cols || row <= 0 || col <= 0\n return 0\n end\n return @info[row][col]\n end",
"def get(id, column_family_name, column_name)\n get_cell(id, column_family_name, column_name).try :value\n end",
"def get(row, col)\n validate_pos(row, col)\n @fm[row*@cols + col]\n end",
"def find_cell(coordinate)\n storage.select do |cell|\n cell.coord_x == coordinate[0] && cell.coord_y == coordinate[1]\n end.first\n end",
"def cell_at(x, y)\n return nil if (x < 0 || y < 0)\n @cells[y][x] if @cells[y]\n end",
"def read_cell_content(row, idx)\n cell = row.at(idx)\n if cell.class == ::Spreadsheet::Formula\n # Formulas oftentimes lose type information\n cell = cell.value.to_f rescue cell.value\n cell = cell.to_i if (cell.to_f % 1).zero? rescue cell\n end\n\n cell\n end",
"def getvalue(row, column)\n rows[row][column]\n end",
"def get(x,y)\n row = @rows[y]\n if row == nil\n nil\n else\n # puts \"GLayer.get got a row: #{row.inspect} and the value is #{row[x]}\"\n row[x]\n end\n end",
"def cell(row, column)\n row = row(row)\n cell_value( row.get_or_create_cell( column ) )\n end",
"def cell(row_index, column_index)\n row(row_index).cell(column_index)\n end",
"def single_value(row)\n row.values.at(0)\n end",
"def get_cell_value(row = 1, column = 1)\n unless row.is_a?(Integer) && column.is_a?(Integer)\n raise IncorrectCellPosition, 'Incorrect cell position'.freeze\n end\n\n if row > 3 || column > 3 || row < 1 || column < 1\n raise OutOfCellError, 'No cell available in this zone'.freeze\n end\n\n return self.send cell_column(row, column)\n end",
"def fetch_row\n if @row_buffer.empty?\n if @done\n return nil\n else\n fetch_more\n end\n end\n\n @row_buffer.shift\n end",
"def cell(row_num, col_num)\n return @puzzle[row_num][col_num]\n end",
"def next_cell(grid)\n grid.each_with_index do |row, x|\n row.each_with_index do |cell, y|\n return x, y if cell.length > 1\n end\n end\n end",
"def get(field)\n # Get the first/only row as a Hash.\n result = CONNECTION.execute(\"SELECT * FROM #{table_name} WHERE id = #{@id}\").first\n\n # Return only the value for the key of the field we're seeking.\n return result[field]\n end",
"def read_cell(row, idx)\n return read_cell_date_or_time(row, idx) if date_or_time?(row, idx)\n\n cell = read_cell_content(row, idx)\n case cell\n when Integer, Fixnum, Bignum\n value_type = :float\n value = cell.to_i\n when Float\n value_type = :float\n value = cell.to_f\n when String, TrueClass, FalseClass\n value_type = :string\n value = normalize_string(cell.to_s)\n when ::Spreadsheet::Link\n value_type = :link\n value = cell\n else\n value_type = cell.class.to_s.downcase.to_sym\n value = nil\n end # case\n\n [value_type, value]\n end",
"def get_row(row)\n board = $boggle_board\n return board[row]\nend",
"def read(y, x)\n cy, cx = Vedeu::Geometry::Position[y, x].as_indices\n\n row = fetch(cells, cy)\n cell = fetch(row, cx)\n\n cell\n end",
"def [] (key)\r\n assert_exists\r\n arr_cells = cells\r\n return arr_cells[key - 1]\r\n end",
"def find(k)\n @cells[k]\n end",
"def get_row_by_idx(idx)\n @row[idx]\n end",
"def get_row(board, row)\n return board[row]\nend",
"def get_next_cell(cell, &block)\n return nil if cell.nil?\n\n next_cell = yield(cell)\n return next_cell if is_valid_cell?(next_cell)\n nil\n end",
"def get_row(row)\n row = $boggle_board[row]\nend",
"def [](row_number)\n if fully_cached?\n cache[row_number]\n else\n to_a[row_number]\n end\n end",
"def get_row(board, row)\n board[row]\nend",
"def get_row(board, row)\n board[row]\nend",
"def get_row(row,board)\n return board[row] \nend",
"def get_first\r\n @head&.data\r\n end",
"def extract_single_value(row, field)\n values = extract_values(row, field)\n return nil unless values.count.positive?\n\n values.first\n end",
"def get2d_one(row, col)\n RAtlas::get2d_one(@storage, row, col)\n end",
"def get_row(board,row)\n\treturn board[row]\nend",
"def row_cell(table_row,cell_num)\r\n\t\treturn search_results_table_element[table_row][cell_num].text if search_results_table_element.count >= table_row.to_i\r\n\tend",
"def next_cell(row, col)\n col += 1\n if col > 8\n row += 1\n col = 0\n end\n\n if row > 8\n raise InvalidNextCellRequestException, \"End of puzzle reached\"\n elsif !fixed_value?(row, col)\n [row, col]\n else\n next_cell(row, col)\n end\n end",
"def [](cell_name)\n cell = Cell.select_or_create_cell(cell_name, self)\n \n end",
"def cell(col, row)\n return nil if out_of_bound?(row, 0, Grid::MaxRow - 1)\n return nil if out_of_bound?(col, 0, Grid::MaxCol - 1)\n return (Grid::MaxCol * row) + col\n end",
"def [](row_index, col_index)\n row = data[row_index]\n row && row[col_index]\n end",
"def cell_with_id(cell_id)\n cell(:id, cell_id).text\n end",
"def cell(row, col, sheet=nil)\n sheet = @default_sheet unless sheet\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n if celltype(row,col,sheet) == :date\n yyyy,mm,dd = @cell[sheet][[row,col]].split('-')\n return Date.new(yyyy.to_i,mm.to_i,dd.to_i)\n elsif celltype(row,col,sheet) == :datetime\n date_part,time_part = @cell[sheet][[row,col]].split(' ')\n yyyy,mm,dd = date_part.split('-')\n hh,mi,ss = time_part.split(':')\n return DateTime.civil(yyyy.to_i,mm.to_i,dd.to_i,hh.to_i,mi.to_i,ss.to_i)\n end\n @cell[sheet][[row,col]]\n end",
"def cell(cell)\n @board[cell]\n end",
"def [](attr_name)\n if attr_name.class == Fixnum\n cells.joins(:row).where(rows: {position: attr_name}).first\n else\n read_attribute(attr_name) { |n| missing_attribute(n, caller) }\n end\n end",
"def fetch_first_field(sql)\n fetch_first_row(sql)&.values&.first\n end",
"def get_element_at column, row\n raise OutOfRangeError if column >= @data.size || row >= @data.size\n @data[column] * @data[row]\n end",
"def cursor_value(row_idx: c_y, col_idx: c_x)\n map.value(row_idx, col_idx)\n end",
"def get_row(board, row)\n\treturn board[row]\nend",
"def get_row(row) # defines get_row\n @boggle_board.fetch(row) {|row| puts \"#{row}\"}.join(\"\") # fetches the elements of each row and joins it together as one string.\nend",
"def value_at(row, col)\n row = convert_indicies(row, self.rows)\n col = convert_indicies(col, self.cols)\n return @data.get(row.first, col.first)\n end",
"def get_data(row_num)\n row = @cache[row_num]\n if row.nil? \n @channel << [:get_rows, row_num, FETCH_SIZE]\n end\n row\n end",
"def get_row(game,row)\n return game[row]\nend",
"def get_row(game,row)\n return game[row]\nend",
"def get_row(board, row)\n\tboard[row]\nend",
"def get_row(row)\n $boggle_board[row]\nend",
"def cell(loc)\n @map[loc]\n end",
"def [](row, column)\n cell(row, column)\n end",
"def get_row(row)\n\t$boggle_board[row]\nend",
"def get_single_key(key)\n key = @size+key if key < 0\n r = @results[key]\n unless r.nil? && key < @size\n r\n else\n retrieve_for_index(key)\n @results[key]\n end\n end",
"def find_cell(key)\n for n in (0..@map.size - 1)\n for m in (0..@map[n].size - 1)\n if @map[n][m] == key\n return [n, m]\n end\n end\n end\n end",
"def get_item(index_num)\r\n @arr.fetch(index_num)\r\n end",
"def [](i, j)\n # @rows[i][j] # Maglev, fix ruby_bug \"#1518\", \"1.9.1.129\"\n elem = @rows[i]\n unless elem._equal?(nil)\n elem = elem[j]\n end\n elem\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 cellval(x,y)\n xy = \"#{x}_#{y}\"\n @cells = { }\n begin\n @cells[xy] = RobustExcelOle::Cell.new(@ole_worksheet.Cells.Item(x, y))\n @cells[xy].Value\n rescue\n raise RangeNotEvaluatable, \"cannot read cell (#{p1.inspect},#{p2.inspect})\"\n end\n end",
"def get_at_index(index)\r\n return nil unless @head\r\n return nil if index < 0\r\n cursor = @head\r\n index.times do\r\n return nil unless cursor.next\r\n cursor = cursor.next\r\n end\r\n return cursor.data\r\n end",
"def get_first\n return nil if @head.nil?\n return @head.data\n end",
"def get_first\n return nil if @head.nil?\n\n return @head.data\n end",
"def get_first\n return nil if @head.nil?\n\n return @head.data\n end",
"def get_first\n return nil if !@head\n return @head.data\n end",
"def get_row(n)\n\t\tprepare(@dim_i,@dim_j)\n\t\treturn @myTab[n]\n\tend",
"def get_first\n if @head == nil\n return nil\n else\n return @head.data\n end\n end",
"def get(element)\n i = element.hash % @table.size\n node = @table[i]\n while node\n return node.item if element == node.item\n node = node.next\n end\n return nil\n end",
"def get_row(row_num)\n @grid[row_num]\n end",
"def at(row = @row, col = @col)\n row, col = wrap(row, col)\n return nil unless in_bounds?(row, col)\n\n @cells[row][col]\n end",
"def fetch(name, offset=0)\n addr = pfa(name)\n @vm.fetch(addr + cells(offset))\n end",
"def fetch_byte ( addr )\n\tif addr < @base || addr > @limit\n\t return nil\n\tend\n\tindex = addr - @base\n\tdata = @im[index].unpack \"C\"\n\treturn data[0]\n end",
"def first_empty_index\n #_, index = @pz.lazy.each_with_index.select { |value, n| value.nil? }.first\n each_empty_cell.first.try :last\n end",
"def [](row, col)\n val = @vals[row * @col_count + col]\n val && val.length > 0 && cell_type(row, col) == GRID_TYPE_DATA ? val.to_f : val\n end",
"def get_first\r\n if @head \r\n return @head.data\r\n else \r\n return nil\r\n end\r\n end",
"def get_first\n return @head ? @head.data : nil\n end",
"def cell(x, y)\n if x < 1 || x > DEFAULT_WIDTH || y < 1 || y > DEFAULT_WIDTH\n puts \"x and y should be between 1 and #{DEFAULT_WIDTH}\"\n return nil\n end\n cells[[x, y]]\n end",
"def get_first\n return @head.data if @head\n return @head\n end",
"def get_first_row(*args)\n @db.get_first_row(*args)\n end",
"def [](row=0)\n return @sheet_data[row]\n end",
"def raw\n @cache ||= Hash[ rows.map { |row| [row, cells(row)] } ]\n end",
"def get_first\r\n return @head ? @head.data : nil\r\n end"
] |
[
"0.71015996",
"0.7073971",
"0.67323005",
"0.65704304",
"0.65683",
"0.65674895",
"0.65606177",
"0.6556301",
"0.6523695",
"0.6518354",
"0.6427422",
"0.637553",
"0.63638777",
"0.6358243",
"0.6358243",
"0.6349126",
"0.62587553",
"0.62312526",
"0.62265885",
"0.6224499",
"0.61753196",
"0.61632013",
"0.6137556",
"0.61017436",
"0.6061686",
"0.60354364",
"0.6008663",
"0.600797",
"0.60072416",
"0.6000307",
"0.5998059",
"0.5979146",
"0.59692687",
"0.5964225",
"0.5921063",
"0.58956015",
"0.589078",
"0.5888673",
"0.5883326",
"0.5876543",
"0.5857806",
"0.5855569",
"0.5849508",
"0.5849508",
"0.58485836",
"0.58459944",
"0.5840591",
"0.583312",
"0.582681",
"0.5817228",
"0.5816542",
"0.5794824",
"0.5787014",
"0.57805794",
"0.5777828",
"0.5768569",
"0.5766292",
"0.5758737",
"0.57573473",
"0.5755143",
"0.5750536",
"0.57450897",
"0.57357955",
"0.57211983",
"0.5721089",
"0.57041013",
"0.57041013",
"0.57022524",
"0.5701444",
"0.5674771",
"0.5672756",
"0.5663836",
"0.56496096",
"0.5647677",
"0.56463635",
"0.564186",
"0.56312025",
"0.5625481",
"0.56229854",
"0.5619851",
"0.5600996",
"0.5600996",
"0.5593414",
"0.55907124",
"0.55858815",
"0.5585364",
"0.5580177",
"0.55778867",
"0.55775595",
"0.5572559",
"0.5572503",
"0.5555761",
"0.55506784",
"0.5548752",
"0.55485183",
"0.5546114",
"0.5544169",
"0.5539118",
"0.5526936",
"0.5526039"
] |
0.6730931
|
3
|
Finds one or multiple ids Returns nil if id is not found
|
def find(*args)
return nil unless exists?
options = args.extract_options!.symbolize_keys
what_to_find = args.first
if column_families_to_find = options[:select]
column_families_to_find = column_families_to_find.collect { |c| c.to_s }
end
if what_to_find.is_a?(Array)
connection.getRowsWithColumns(name, what_to_find, column_families_to_find, {}).collect do |t_row_result|
Row.populate_from_trow_result(t_row_result, connection, name, column_families_to_find)
end
else
if t_row_result = connection.getRowWithColumns(name, what_to_find, column_families_to_find, {}).first
Row.populate_from_trow_result(t_row_result, connection, name, column_families_to_find)
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_entity_by_id(id_list_or_array)\n end",
"def find(*args)\n ids = args.__find_args__\n raise_invalid if ids.any?(&:nil?)\n for_ids(ids).execute_or_raise(ids, args.multi_arged?)\n end",
"def find(id, optional = {})\n find_all([id], optional).first\n end",
"def find(id)\n found = nil\n found = @candidates.find { |candidate| candidate.fetch(:id) == id }\n # found = @candidates.select { |candidate| candidate.fetch(:id) == id }\n # found && found = found[0]\nend",
"def find(id)\n\nreturn candidates.detect{|candidate| candidate[:id]==id }\n\nend",
"def find(id)\n @candidates.each do |candidate|\n return candidate if candidate[:id]==id\n end\n nil\nend",
"def find(id)\n @candidates.each do |candidate|\n if id == candidate[:id] \n return candidate\n end\nend\n\n nil\nend",
"def find(id)\n @candidates.each do |candidate|\n return candidate if id == candidate[:id]\n end\n nil\nend",
"def find(id)\n @candidates.each do |candidate|\n return candidate if candidate[:id] == id\n end\n return nil\nend",
"def find(id)\n # binding.pry\n raise '@candidates must be an Array' if @candidates.nil?\n candidate.each do |candidate|\n if candidate[:id] == id\n return candidate\n else\n nil\n end \n end \nend",
"def find(id)\n # takes single candidate as id :\n @candidates.each do | candidate |\n if candidate[:id] == id \n\n return candidate\n else \n nil\n end\n end\nend",
"def find(id)\n @candidates.each do |candidate|\n if id == candidate[:id]\n candidate\n end\n end\n nil\nend",
"def find(id)\n # Your code Here\n @candidates.each do |el|\n # logic to check if id match else null\n if el[:id] == id\n puts 'found match'\n return el\n end\n end\n return nil\nend",
"def find(id)\nraise \"candidates must be an Array\" if @candidates.nil?\n @candidates.each do |candidate|\n return candidate if candidate[:id] == id\n end\n nil\nend",
"def find(id)\n # Your code Here\n @candidates.each do |candidate|\n \tif candidate[:id] == id\n \t return candidate\n \tend\n end\n return nil\nend",
"def find(id)\n finder_or_run(:find, id)\n end",
"def find(id)\n found = nil\n @candidates.each do |candidate|\n if candidate[:id] == id\n found = candidate\n end\n end\n found\nend",
"def find(id)\n raise '@candidates must be an Array' if @candidates.nil?\n @candidates.detect {|candidate| candidate[:id] == id}\nend",
"def find_by_ref_or_id(*args)\r\n find_by_id(*args) || find_by_ref(*args)\r\n end",
"def find(id)\n @candidates.each do |candidate|\n if candidate[:id] == id\n return candidate\n else\n return nil\n end\n end\nend",
"def find_id(id)\n @candidates.find {|candidate| candidate if candidate[:id] == id}\nend",
"def find(id)\n # Your code Here\n @candidates.each do |candidate|\n if id == candidate[:id]\n return candidate\n end\n end\n\n nil\nend",
"def find(x)\n if @candidates.any? {|h| h[:id] == x}\n return @candidates.find {|h| h[:id] == x}\n else\n return \"ID does not exist\".red\n end\nend",
"def find(*args)\n return super if block_given?\n find_with_ids(*args)\n end",
"def find_ids(ids)\n ids.inject([]) { |x, id| x << all.find { |y| y.id == id }}\n end",
"def search_by_id(id)\n @data.each do |item|\n return item if item.id == id\n end\n\n nil\n end",
"def find(id)\n raise '@candidates must be an array' if @candidates.nil?\n @candidates.detect {|candidate| candidate[:id] == id}\n\nend",
"def find(id)\n # Your code Here\n # puts \"you are looking for id: #{id}\"\n @candidates.each do |candidate|\n if candidate[:id] == id\n return candidate\n end\n end\n return nil\nend",
"def find(id)\n find_result\n end",
"def id_finder\n @id_finder ||= extract_id ? :all_of : :where\n end",
"def find(id)\n @candidates.each do |item|\n if item[:id]==id\n @result = item\n end\n end\n @result\nend",
"def find(id); end",
"def find(id); end",
"def find(id)\n binding.pry\n candidate.each do |candidate|\n if @candidate[:id] == id\n return candidate\n else\n nil\n end \n end \nend",
"def find(id)\n puts id\n @candidates.each do |candidate|\n if candidate[:id] == id \n return candidate\n end\n end\n puts \"No candidate found with that ID\"\n return nil\nend",
"def find(id)\n @candidates.each do |person|\n if person[:id] === id\n return person\n end\n end\n return nil\nend",
"def find(id)\n first(\"Id = '#{id}'\")\n end",
"def find(id)\n @candidates.detect do |candidate|\n candidate[:id] === id\n end\nend",
"def find id\n @objs_list[id] if @objs_list\n end",
"def find(id)\n @candidates.detect {|candidates| candidate[:id] == id}\nend",
"def for_ids(ids)\n ids = mongoize_ids(ids)\n if ids.size > 1\n send(id_finder, { _id: { \"$in\" => ids }})\n else\n send(id_finder, { _id: ids.first })\n end\n end",
"def find(id)\n # Your code Here\n @candidates.each do |candidate|\n if candidate[:id] == id\n return candidate\n end\n end\n nil\nend",
"def find(id)\n @candidates.each do | candidate |\n if candidate[:id] == id\n return candidate \n end\n end\nend",
"def find(id)\n\t@candidates.detect { |candidate| candidate[:id] == id }\nend",
"def find_by_id(id)\n iterations.find { |iteration| iteration.id == id } || false\n end",
"def find_from_search(*ids)\n unless ids.blank?\n results = {}\n ids.flatten.dice(20).each do |set|\n query = (set.map { |id| \"(id:\\\"#{id}\\\")\" }).join(' || ')\n search_results = search_for(query, :qt => 'standard', :rows => set.length)\n search_results.models.each do |result|\n results[result.id] = result\n end\n end\n ids.flatten.map { |id| results[id] }.compact\n else\n []\n end\n end",
"def find_from_search(*ids)\n unless ids.blank?\n results = {}\n ids.flatten.dice(20).each do |set|\n query = (set.map { |id| \"(id:\\\"#{id}\\\")\" }).join(' || ')\n search_results = search_for(query, :qt => 'standard', :rows => set.length)\n search_results.models.each do |result|\n results[result.id] = result\n end\n end\n ids.flatten.map { |id| results[id] }\n else\n []\n end\n end",
"def find(id)\n raise '@candidates must be an array!' if @candidates.nil?\n candidate = @candidates.select { |candidate| candidate[:id] == id }\n\nend",
"def find_by_id(id)\n find_by(:id, id)\n end",
"def find(id)\n all.find { |obj| obj.id == id }\n end",
"def find(id)\n @candidates.find {|h| h[:id] == id}\nend",
"def find(id)\n@candidates.detect {|candidate| candidate[:id] == id}\nend",
"def find_by_id(id)\n results = many.find_with_attributes_ne(id)\n results.blank? && nil || with_details(results)\n end",
"def find_from!(collection, identifier, find_by = :id)\n if identifier.present?\n collection.detect { |instance| instance.send(find_by) == identifier.to_i } || (raise ActiveRecord::RecordNotFound)\n else\n raise ActiveRecord::RecordNotFound\n end\n end",
"def find(id)\n self.detect{|x| x.id == id.to_i}\n end",
"def find(id)\n end",
"def find(*args)\n select(*args)\n\n=begin\n\n options = args.last.is_a?(Hash) ? args.pop : {}\n case args.first\n when :all then find_every options\n when :first then find_initial options\n else find_from_ids args, options\n end\n\n=end\n\n end",
"def find(id)\n\traise '@candidates must be an Array' if @candidates.nil?\n\t@candidates.each do |x|\n\t\tif x[:id] == id\n\t\t\treturn x\n\t\tend\n\tend\n\tputs \"Candidate not found\"\n\tnil\nend",
"def find(id)\n @candidates.select { |candidate| candidate[:id] === id}\nend",
"def lookup( *ids )\n cache = attribute_cache( :id )\n matching = ids.map do |id|\n entity = cache.fetch( id ) do\n entities.find { |e| e.id == id }\n end\n\n entity || missing_entity_class.new\n end\n\n List.new matching\n end",
"def find_by_id(id)\n id = id.to_i\n\n @id_hash[id]\n end",
"def find_by_id(id)\n models.each do |model|\n el = model.find_by_id(id)\n return el if el\n end\n nil\n end",
"def find_by_id!(id)\n found = entities.detect { |elm| elm.id == id }\n raise Occi::Core::Errors::CollectionLookupError, \"Entity #{id.inspect} not found in the collection\" unless found\n found\n end",
"def find id\n return nil if node.ids.empty?\n node.send(:orm_class).find id\n end",
"def find_item_by_id(id)\n\n @items.each do |item|\n return item if item.item_id == id\n end\n return nil\n end",
"def find(id)\n @candidates.select{|candidate| candidate[:id] === id }\n #return @candidates\n\nend",
"def find(id)\n all_lists.select{ |list| list.id == id }.first\n end",
"def find(*ids)\n return super if block_given?\n\n ids = ids.flatten(1).map(&:to_s)\n scope = except(EXTRA_STORAGES).filter(ids: {values: ids})\n\n results = if ids.size > DEFAULT_BATCH_SIZE\n scope.scroll_wrappers\n else\n scope.limit(ids.size)\n end.to_a\n\n if ids.size != results.size\n missing_ids = ids - results.map(&:id).map(&:to_s)\n raise Chewy::DocumentNotFound, \"Could not find documents for ids: #{missing_ids.to_sentence}\"\n end\n results.one? ? results.first : results\n end",
"def list_find_by_id(id, options = {})\n list_find({\n :id => id\n }.merge(options))\n end",
"def find(id)\n raise NotImplementedError\n end",
"def find(id)\n map_id = proc { |object| object.respond_to?(:id) ? object.send(:id) : object }\n\n result = find_by_id_or_ids(map_id, id)\n\n fail RecordNotFound.new(\n \"Couldn't find #{name} with '#{id_property_name}'=#{id.inspect}\",\n name, id_property_name, id) if result.blank?\n result.tap { |r| find_callbacks!(r) }\n end",
"def find(id)\r\n find_one do |record|\r\n record.id == id\r\n end\r\n end",
"def find_by_scan(*args)\n expects_array = args.first.kind_of?(Array)\n ids = args.flatten.compact.map(&:to_s).uniq\n\n if ids.size == 1\n id = ids.first\n record = load_target.detect { |r| id == r.id.to_s }\n expects_array ? [ record ] : record\n else\n load_target.select { |r| ids.include?(r.id.to_s) }\n end\n end",
"def find_many(ids, *args)\n return [] if ids.blank?\n hashes = multi_get(ids.collect(&:to_s), *args)\n\n hashes.inject([]) do |res, (key, data)|\n res << instantiate(key, data) unless data.empty?\n end\n end",
"def find_by_id_or_username!\n if input_is_id?\n find_by_id!\n else\n find_by_username!\n end\n end",
"def for_ids(*ids)\n field = klass.fields[\"_id\"]\n ids.flatten!\n if ids.size > 1\n any_in(:_id => ids.map{ |id| field.serialize(id) })\n else\n where(:_id => field.serialize(ids.first))\n end\n end",
"def find(id)\n @candidates.detect{|number| number[:id] == id} \n #or option #2\n #def find(id) \n #@candidates.detect{|number| number[:id] == id}\nend",
"def multiple_id_lookup(ids)\n ids.map{|id| \" id = #{id} OR \"}.join.chomp(' OR ')\n end",
"def find_by_id(id)\n find(id)\n end",
"def find_by_id(id)\n find_by_attributes(:id => id).first\n end",
"def find(id)\n # Your code Here\n @candidates.each do |element|\n \tif element[:id] == id\n \t\tpp element\n \tend\n end\n pp nil\n\nend",
"def find_by_id(id)\n results = one.find_by_id_ne(id)\n results && !results['id'].blank? && new(results) || nil\n end",
"def find_by_id(id)\n filtered_set(entities, key: 'id', value: id)\n end",
"def test_galleryphotos_find_by_ids(ids, *args)\n assert_not_nil @rdigg.galleryphotos.find_by_ids(\"7987312,7987350,7987356\")\n end",
"def find_by_id_or_username\n if input_is_id?\n find_by_id\n else\n find_by_username\n end\n end",
"def find_by_id(input, value)\n hash = nil\n input.each do |input|\n if input[:id] == value\n hash = input\n end\n end\n hash\nend",
"def find(*args)\n find_all(*args).first\n end",
"def find(value)\n key = \\\n if value.to_s =~ /^[0-9\\.]*$/\n default_search_param + \"id\"\n else\n default_search_param\n end\n\n where(key => value).first\n end",
"def find (candidate_id)\n @candidates.detect{|candidate| candidate_id == candidate[:id]}\n puts \"No match foud\" if nil \n end",
"def find_all_by_id(id)\n find_all_by(:id, id)\n end",
"def find(id, ignore: [])\n hit = es_get(id, ignore: ignore)\n if hit['found']\n result = instantiate_result(hit)\n return result\n end\n false\n end",
"def find(id)\n\nend",
"def find(id)\n fetch([name, id]) do\n super\n end\n end",
"def get_id(*value)\n return nil if value.blank?\n return nil unless attribute_names.include?('id')\n\n value = value.first if value.count == 1\n\n return value.map{|v| get_id(v)} if value.is_a?(::Array)\n\n return value.id if value.class == self\n return value if value.is_a?(::Integer)\n return value.to_i if value.to_s =~ /\\A\\d+\\z/\n\n result = search_for(value).order(:id).pluck(:id).to_a\n\n return nil if result.blank?\n return result.first if result.count == 1\n\n result\n end",
"def find(id)\n parameters[:data_ids] = [id]\n all.first\n end",
"def find(id)\n each_descendant(false).detect {|op| op.id == id}\n end",
"def find(id)\n @records.find { |record| record.id == id }\n end",
"def find id, params = {}, &block\n rel = relation params, &block\n rel.where!(config.document_unique_id_param => id) \n rel.load\n rel\n end",
"def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end",
"def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end",
"def find_by_id(id)\n users.find { |user| user.id == id } || false\n end"
] |
[
"0.7570017",
"0.7398689",
"0.726684",
"0.71803963",
"0.7139692",
"0.7104075",
"0.71003926",
"0.70953596",
"0.7009323",
"0.6995737",
"0.69626355",
"0.6958065",
"0.69563603",
"0.69534457",
"0.6945278",
"0.6941221",
"0.6940916",
"0.6938451",
"0.69252723",
"0.692153",
"0.69206136",
"0.69108486",
"0.69044155",
"0.6891033",
"0.6872643",
"0.6868525",
"0.6853209",
"0.6844189",
"0.68352103",
"0.68271464",
"0.6821681",
"0.68034583",
"0.68034583",
"0.68019253",
"0.6790021",
"0.6778586",
"0.67631435",
"0.6747985",
"0.6741294",
"0.6732683",
"0.6723481",
"0.6705916",
"0.67049485",
"0.6693283",
"0.6692702",
"0.66864455",
"0.6679329",
"0.6677959",
"0.66729087",
"0.66519356",
"0.66478527",
"0.6642147",
"0.6640962",
"0.6631772",
"0.66056836",
"0.6605334",
"0.6590664",
"0.6573462",
"0.6539401",
"0.6537427",
"0.65300024",
"0.6524376",
"0.6519589",
"0.6510056",
"0.65062183",
"0.6499855",
"0.64863455",
"0.6462579",
"0.64601",
"0.64514303",
"0.64385635",
"0.64223623",
"0.6408517",
"0.6395935",
"0.639588",
"0.6377291",
"0.6376227",
"0.63679355",
"0.6357493",
"0.6344881",
"0.6344608",
"0.6343773",
"0.634076",
"0.6333902",
"0.6314594",
"0.630513",
"0.6295168",
"0.6282038",
"0.62773067",
"0.6264813",
"0.6260941",
"0.62593627",
"0.62588465",
"0.6250748",
"0.62314427",
"0.62166244",
"0.62037784",
"0.619621",
"0.61956304",
"0.61956304",
"0.6179779"
] |
0.0
|
-1
|
attr_accessor :players, :start_timer, :started, :finish_flag attr_reader :starting_sound, :music, :game_over_sound def initialize(players=1)
|
def game_over_text
Text.new("Game Over", color: 'orange', x: Window.width / 6, y: Window.height / 3, z: 1, size: 80) # need to find a way to make it centered and scaled with window size
Text.new("Press 'R' to restart", color: 'orange', x: (Window.width / 6) + 45, y: (Window.height / 3) + 85, z: 1, size: 40)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize\n self.player_hash = {}\n self.user_hash = {}\n self.playing_user_names=[]\n self.started = false\n self.disks_for_each_player=4#default\n self.shuffle_names = true\n end",
"def initialize(player)\n @player = player\n end",
"def initialize\n\n # On startup, assume music and audio are enabled, and nothing is playing\n @music = true\n @audio = true\n @track_queued = false\n @music_playing = false\n @active_track = ''\n\n end",
"def initialize\n super(640, 400, false)\n self.caption = 'Tennis Game'\n\n @player = Player.new(self)\n @player2 = Player2.new(self)\n @help = TextBox.new(self, \"Press O to activate 2P\", 193, 500)\n @bot = Bot.new(self)\n @ball = Ball.new(self)\n @wall = Wall.new(self)\n @score = Score.new(self)\n @twoplayer = false\n @game_over = false\n\n @music = Gosu::Song.new('media/rick.ogg')\n # @music.play(true)\n end",
"def initialize_players\n\n end",
"def initialize\n @game_settings = GameSettings.new\n super 920, 480\n self.caption = GAME_TITLE\n @settings_hovered = Options::START_SCREEN[0]\n @title_font, @subtitle_font = Gosu::Font.new(50), Gosu::Font.new(20)\n @background_image = Gosu::Image.new(\"media/background1.jpg\", :tileable => true)\n @blank_card = Gosu::Image.new(\"media/card.png\", :tileable => true)\n @button_option = Gosu::Image.new(\"media/button.png\", :tileable => true)\n @deck = Deck.new\n @playing_cards = Array.new\n @computer_signal = ComputerTimer.new\n @players_created, @mes, @false_mes, @true_mes, @trying_mes = false, false, false, false, false\n @hint = []\n #players\n @pressed, @p1, @p2 = nil, nil, nil\n @game_timer = Timers.new\n end",
"def initialize\n @players = []\n @p1 = Player.new('player')\n @players << @p1\n @p2 = ComputerPlayer.new('com')\n @players << @p2\n play\n end",
"def initialize(name)\n @name = name\n @plays = []\n end",
"def initialize(playerClass)\n @player = initialize_player playerClass\n end",
"def initialize(players)\n self.players = players\n end",
"def initialize (name, artist, duration)\n # Storing variables as instance variables in order to reuse. These variables are accessible to all methods in \n # object, and each object has it's own copy of them.\n @name = name \n @artist = artist\n @duration = duration\n @plays = 0 # Keep track of how many times that particular song has been played.\n end",
"def initialize\n\t\t@players = []\n\t\t@players << @p1 = Player.new(\"p1\")\n\t\t@players << @p2 = ComputerPlayer.new(\"p2\")\n\t\t\n\t\t#@p1 = Player.new\n\t\t#@p2 = ComputerPlayer.new\n\t\tplay\n\tend",
"def initialize\n @players = []\n @p1 = Player.new('p1')\n @players << @p1\n @p2 = ComputerPlayer.new('com')\n @players << @p2\n play\n end",
"def initialize\n greeting\n init_players\n end",
"def initialize\n @player1 = get_player_name('1')\n @player2 = get_player_name('2')\n @current_player = @player1\n end",
"def init_for_battle\n super\n self.song_count = 0\n initialize_anger\n end",
"def initialize \n\t@first_player = Player.new(\"joueur 1\")\n\t@second_player = Player.new(\"joueur 2\")\n\t self.create_board\n\t self.play_until_victory\n end",
"def initialize\n @currentPlayerIndex = -1;\n\n\n end",
"def initialize_player\n\n Player.new\n\nend",
"def initialize name\n @player = name\n @@player_count+=1\n end",
"def initialize(needed_players=2)\n @players = []\n @needed_players = needed_players\n end",
"def initialize (money, life, fights, respect)\n #The health bar of the player, when the health gets down to 0 the player loses.\n @life = life\n #The wealth that the player has amassed throughout the game.\n @money = money\n #Respect that the player has earned winning fights in the game\n @respect = respect\n #Number of fight events that the player has won.\n @fights = fights\n #List of states for the game.\n @states = []\n\tend",
"def initialize\n @total_kills = 0\n @players = []\n end",
"def initialize(labels)\n @score = [0,0,0,0]\n @started = [false,false,false,false]\n @labels = [] \n \n @players = []\n @playing =[]\n @labels = labels\n @winner = nil\n \n end",
"def initialize\n \t\t@player_name = gets_name\n \t\t@player_token = gets_token\n \tend",
"def initialize\n @num_players = 0\n @round_players=0\n @deck = Deck.new\n @dealer = Dealer.new\n @players = []\n @ui = UserInterface.new\n end",
"def initialize\n @current_player = 1\n @player_1 = Player.new\n @player_2 = Player.new\n @num_1 = rand(1..20)\n @num_2 = rand(1..20)\n end",
"def initialize(player_1=nil, player_2=nil)\n @player_1 = player_1\n @player_2 = player_2\n end",
"def initialize(p1, p2)\n @players = [p1, p2]\n @current_player = @players[0]\n \n end",
"def initialize\n @name_boy = default_male_name\n @name_girl = default_female_name\n $game_switches[Yuki::Sw::Gender] = @playing_girl = false\n $game_variables[Yuki::Var::Player_ID] = @id_boy = rand(0x3FFFFFFF)\n @id_girl = (@id_boy ^ 0x28F4AB4C)\n @start_time = Time.new.to_i\n @play_time = 0\n @badges = Array.new(6 * 8, false)\n @region = 0\n @game_version = PSDK_CONFIG.game_version\n @current_version = PSDK_Version rescue 0\n @time_counter = 0\n load_time\n end",
"def initialize\n @player1 = Player.new(\"Player 1\")\n @player2 = Player.new(\"Player 2\")\n @player1_turn = true; # true -> player1's turn, false -> player2's turn\n end",
"def initialize(name, artist, duration)\n @name = name\n @artist = name\n @duration = duration\n @plays = 0\n end",
"def initialize(name) #give them a name and songs array right off the bat. They will have many songs\n @name = name\n @songs = []\n end",
"def initialize\n @player1 = Player.new\n @player2 = Player.new\n @deck = Deck.new\n end",
"def initialize(title, artist, filename)\n @title = title #instance variable\n @artist = artist#instance variable\n @filename = filename#instance variable\n @play_count = 0#instance variable\n end",
"def initialize\n\n\t\t\t# The speed of the music\n\t\t\t@tempo = 77\n\n\t\t\t# The number of MidiFormat objects\n\t\t\t@num_midi_seqs = 0\n\n\t\t\t# An array of MidiFormat objects\n\t\t\t@midi_format_array = Array.new\n\t\tend",
"def initialize(player_num)\n @player_num = player_num\n @score = 0\n end",
"def initialize\n @@songs << self #intilized songs will be added to @@songs\n end",
"def initialize\n @brightness = 255\n @fadeout_duration = 0\n @fadein_duration = 0\n @tone = Tone.new(0, 0, 0, 0)\n @tone_target = Tone.new(0, 0, 0, 0)\n @tone_duration = 0\n @flash_color = Color.new(0, 0, 0, 0)\n @flash_duration = 0\n @shake_power = 0\n @shake_speed = 0\n @shake_duration = 0\n @shake_direction = 1\n @shake = 0\n @pictures = [nil]\n for i in 1..100\n @pictures.push(Game_Picture.new(i))\n end\n @weather_type = 0\n @weather_max = 0.0\n @weather_type_target = 0\n @weather_max_target = 0.0\n @weather_duration = 0\n end",
"def initialize(player_name) #initialize player_name so we can create a local variable.\n @player = Player.new(player_name)\n @rooms = [] #could also do @rooms = Array.new\n end",
"def initialize(name) #initialize the song class with a name\n @name = name\n end",
"def initialize(name) #sets name on initialization\n @name= name #sets property correctly\n @songs= []\n end",
"def initialize\n #Initialize list of players\n @player_list = []\n @highscore_list = []\n end",
"def initialize(player)\n @player = player\n @state = 'draw'\n @swaps = []\n end",
"def initialize(player1, player2)\n @player1 = player1\n @player2 = player2\n @p1_score = 0\n @p2_score = 0\n end",
"def initialize # utilise la classe player pour demander les infos aux joueurs et la classe baord pour lancer la tipar\n puts \" The Houmous Project présente Morbac\"\n @player_one = Player.new\n @player_one.informations\n @player_two = Player.new\n @player_two.informations\n @boboard = Board.new\n end",
"def initialize(player_name)\n @name = player_name\n @life_points = 10\n end",
"def initialize(name)\n @name = name\n @songs =[]\nend",
"def initialize\n @player1wins = 0\n @player2wins = 0\n @ties = 0\n end",
"def initialize\n\t@start_time = Time.now\n\t@end_time = Time.now\n\t@save_time = 0.0\n\t@top_card = 0\n\t@number_of_hint = 0\n\t@number_of_correct = 0\n\t@number_of_wrong= 0\n\t@deck = []\n\t@hand = []\n\t@username = \"\"\n\t@total_hint=0\n\t@is_end=false\nend",
"def initialize(player, delay)\n super delay\n @player = player\n end",
"def init_game\n @io.welcome_msg\n @num_decks = @io.get_num_decks \n @player_cnt = @io.get_player_cnt(@max_players)\n players_names = @io.get_players_names\n\n # Initialize player objects\n 0.upto(players_names.length - 1) do |x|\n @players[x] = Player.new(players_names[x], @bankroll)\n end\n\n # Create the dealer and add as a player\n @dealer = Dealer.new\n @dealer.hit_soft_17 = @hit_soft_17\n @players[@players.length] = @dealer\n end",
"def initialize\n\t\t@grid = Board.new\n\t\t@player_1 = Player.new\n\t\t@player_2 = Player.new\n\t\t@game_status = true #true means game is still playing\n\t\tassign_players\n\tend",
"def initialize!\n $sfxengine = SoundEngine.new\n\n GameMode.enter_name_input =\n Text.new(\n Settings.winX/2,\n Settings.winY/2,\n Settings.fontsize,\n Color.new(0, 255, 0, 0.8),\n Settings.fontfile,\n \"\")\n GameMode.enter_name_headline =\n Text.new(\n Settings.winX/2,\n Settings.winY*0.35,\n Settings.fontsize,\n Color.new(0, 255, 0, 0.8),\n Settings.fontfile,\n \"enter name\")\n\n GameMode.fader = Rect.new(0, 0, Settings.winX, Settings.winY)\n GameMode.fader.colors = ColorList.new(4) { |i| Color.new(0, 0, 0, 0.8) }\n\n @ingame_timer = Timer.new\n @external_timer = Timer.new\n @engine_running = true\n @score_object = Score.new\n\n $gfxengine.prepare # TODO put to end, remove things mouse depends on!\n @mouse = Mouse.new(100, 100, Settings.mousedef)\n @score_object.cur_level = 0\n start_level @score_object.cur_level\n @textbuffer = \"\"\n GameMode.set_mode(GameMode::NORMAL)\n end",
"def initialize(player_entities)\n @turn = 0\n @turn_count = 1\n @players = player_entities\n end",
"def initialize\n @shoe = @player_cnt = @dealer = nil\n @num_rounds = @num_shoes = 0\n @num_decks = 1\n @max_players = 4\n @min_bet = 1\n @max_bet = 100\n @bet_increment = 1\n @bankroll = 1000\n @hit_soft_17 = nil\n @even_money_offered = 1 # Hate when casinos don't offer this option\n @players = []\n @broke_players = []\n @io = BlackJackIO.new\n end",
"def initialize(name_player1, name_player2)\n @current_player = :player1\n @player1 = Player.new(name_player1, PLAYER_MARKS[:player1], 1)\n @player2 = Player.new(name_player2, PLAYER_MARKS[:player2], 2)\n\n @game_array = [[nil, nil, nil],\n [nil, nil, nil],\n [nil, nil, nil]]\n end",
"def initialize(name_player)\n @life_points = 10\n @name = name_player\n end",
"def initialize(player_name)\n @name = player_name.to_s\n @life_points = 10\n end",
"def initialize(name_of_human_player)\n @name = name_of_human_player\n @life_points = 100\n @weapon_level = 1\n end",
"def initialize\n @songs = []\n end",
"def initialize\n @songs = []\n end",
"def initialize player\n @player = player\n @question = Question.new()\n end",
"def initialize(player)\n @en_passant = false\n super(player)\n end",
"def initialize(name)\n @name = name\n @songs = []\n\n end",
"def initialize(options)\n super\n #Grab parameters\n @rubies_total = options[:rubies]\n @time_limit = options[:time]\n @player = options[:player]\n end",
"def initialize\n @songs = []\n end",
"def initialize(name)\n @name=name\n @songs = []\n end",
"def initialize(name)\n @name = name \n @songs = []\n end",
"def initialize(name)\n @name = name\n @songs = []\n \n end",
"def initialize\n @board = Board.new(GAME_SIZE)\n @prev_guesses = []\n @player = AiPlayer.new(@board)\n end",
"def initialize(guesses=3, range)\n\t\t@guesses = guesses\n\t\t@range = range\n\t\t@solved = false\n\t\t@player_record = {\"Wins\" => 0 , \"Losses\" => 0}\n\tend",
"def initialize\n\t\t@health_info = { previous_health: PLAYER_MAX_HEALTH, heal_amount: 0 }\n\t\t@@look_comfort = 0\n\t\t@look = []\n\tend",
"def initialize(name) # j'initialise les données qui doivent être ajoutées en même temps que la création du player\n @name = name # le nom du joueur\n @life_points = 10 # le niveau de vie de départ\n end",
"def initialize\n @board = Board.new\n @players_1_turn = true\n end",
"def initialize(player, round)\n @player = player\n @round = round\n @done = false\n @passed = false\n end",
"def initialize\n @frame = 1\n @first_throw = 0\n @second_throw = 0\n @bonus_roll = 1\n @pins_per_frame = []\n @total_score = 0\n @previous_turn_bonus = []\nend",
"def initialize\n\t\t@songs = Array.new\n\tend",
"def initialize(pkmn)\n super()\n @pokemon = pkmn\n @egg = pkmn.clone\n @egg.step_remaining = 1\n @counter = 0\n play_music\n end",
"def initialize \n @letter_count = 0 \n @game_is_over = false\n end",
"def initialize(player_name)\n\t\t@player = Player.new(player_name)\n\t\t@rooms = []\n\tend",
"def initialize(player_name)\n\t\t@player = Player.new(player_name)\n\t\t@rooms = []\n\tend",
"def initialize(name) #when song is created a name is mandatory\n @name = name #writes/sets a name to the song\n @@all << self #pushes all song instances into songs class array\n end",
"def initialize p_notes = 'music/?.wav'\n\n # Set some defaults\n @repeat = true\n @playing = false\n @tune = []\n @tune_index = -1\n @last_note = 0\n\n # And save the note source\n @notes_prefix, @notes_postfix = p_notes.split( '?' )\n\n end",
"def initialize(player_sign)\n\t\t@name = player_name\n @sign = player_sign\n end",
"def initialize(num, name) #we are settig up an internal variable, piece, in the class Player\n\t\t@piece=num #the piece variable is defined as the player number, either 1 or 2\n\tend",
"def initialize(player_name, number, shoe, points, rebounds, assists, steals, blocks, slam_dunks)\n # @instance_variable <= @ sign in front is an instance variable\n # instance variables, stay with the instance!\n @player_name = player_name\n @number = number\n @shoe_size = shoe # we don't have to match up the arg name with the instance variable name\n @points = points\n @rebounds = rebounds\n @assists = assists\n @steals = steals\n @blocks = blocks\n @slam_dunks = slam_dunks\n\n steal = steals # local variable, disappears!\n\n @@all << self # self in the initialize method is the instance being made\n end",
"def initialize(position: nil, player: nil)\n self.player = player\n self.position = position\n self.moved = false\n end",
"def initialize(num_players)\n @num_players = num_players\n @players = []\n @current_player_index = nil\n (0..num_players - 1).each { |i| @players[i] = Player.new }\n end",
"def initialize(name)\n @name = name\n @songs = []\n end",
"def initialize(name)\n @name = name\n @songs = []\n end",
"def initialize(name)\n @name = name\n @songs = []\n end",
"def initialize(name)\n @name = name\n @songs = []\n end",
"def initialize(name)\n @name = name\n @songs = []\n end",
"def initialize(name)\n @name = name\n @songs = []\n end",
"def initialize(name)\n @name = name\n @songs = []\n end",
"def initialize(name)\n @name = name\n @songs = []\n end",
"def initialize(name)\n @name = name\n @songs = []\n end",
"def initialize(name)\n @name = name\n @songs = []\n end",
"def initialize(name)\n @name = name\n @songs = []\n end",
"def initialize(name)\n @name = name\n @songs = []\n end"
] |
[
"0.73524517",
"0.73506916",
"0.7229037",
"0.7215733",
"0.7198782",
"0.7171421",
"0.7103103",
"0.709612",
"0.7083085",
"0.70784146",
"0.7077692",
"0.70731634",
"0.70674944",
"0.7024349",
"0.7016983",
"0.696958",
"0.6967857",
"0.69076544",
"0.6904993",
"0.68827",
"0.68266225",
"0.68182355",
"0.67970896",
"0.6796712",
"0.67457926",
"0.6733583",
"0.67263937",
"0.6707765",
"0.669834",
"0.6698067",
"0.6687594",
"0.6687029",
"0.6666375",
"0.66627926",
"0.6658517",
"0.6653498",
"0.6645493",
"0.6637857",
"0.6609887",
"0.6591265",
"0.6581991",
"0.657927",
"0.6577158",
"0.6575998",
"0.65748566",
"0.6557218",
"0.65382814",
"0.65219045",
"0.65021294",
"0.6500037",
"0.6486143",
"0.64844924",
"0.647898",
"0.6456813",
"0.64392596",
"0.6432479",
"0.6426745",
"0.6415036",
"0.63989216",
"0.6390939",
"0.6389683",
"0.6389683",
"0.63861746",
"0.6385669",
"0.637971",
"0.6377864",
"0.63646305",
"0.63623834",
"0.63569146",
"0.6351899",
"0.63434625",
"0.63352764",
"0.6333056",
"0.63263404",
"0.6325033",
"0.63147354",
"0.63073164",
"0.62926775",
"0.6290315",
"0.6289322",
"0.62852556",
"0.62852556",
"0.6284209",
"0.6279939",
"0.6276146",
"0.627108",
"0.6270923",
"0.6269974",
"0.6266561",
"0.62619686",
"0.62619686",
"0.62619686",
"0.62619686",
"0.62619686",
"0.62619686",
"0.62619686",
"0.62619686",
"0.62619686",
"0.62619686",
"0.62619686",
"0.62619686"
] |
0.0
|
-1
|
GET /icomes/1 GET /icomes/1.json
|
def show
@icome = Icome.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @icome }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @experiment_biomechanical = ExperimentBiomechanical.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment_biomechanical }\n end\n end",
"def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\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 @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 @somethings = Something.all\n render json: @somethings\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 @bio_signal = BioSignal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bio_signal }\n end\n end",
"def index\n @illnesses = Illness.all\n\n render json: @illnesses\n end",
"def index\n @illnesses = Illness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @illnesses }\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 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 @instituicoes = Instituicao.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instituicoes }\n end\n end",
"def show\n @cvi = Cvi.find(params[:id])\n @animals = @cvi.animals\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cvi }\n end\n end",
"def index\n weathers = Weather.all\n render json: weathers, status: 200\n end",
"def index\n respond_to do |format|\n format.html do\n @recent_objects = BiologicalRelationship.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(10)\n render '/shared/data/all/index'\n end\n format.json {\n @biological_relationships = BiologicalRelationship.with_project_id(sessions_current_project_id).order(:name)\n }\n end\n end",
"def index\n \tif params[:category] == \"METRO\"\n \trender :json => Interest.stops.to_json\n elsif params[:category] == \"Photos\"\n render :json => Interest.panoramio\n \telsif params[:category]\n \t\tcategory_id = Category.find_by_name(params[:category]).id\n \t\trender :json => Interest.find_all_by_category_id(category_id).to_json(:methods => :category_name)\n \telse\n \t\trender :json => Interest.all\n \tend\n\n end",
"def 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 @given_circumstances = GivenCircumstance.all\n render json: @given_circumstances\n end",
"def index\n @clients = Client.all\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\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 @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 show\n @bio = Bio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bio }\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 show\n @crime = Crime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crime }\n end\n end",
"def index\n @noise = Noise.new\n @noises = Noise.all\n params[:page] ||= 1\n\n respond_to do |format|\n format.html { @noises = Noise.paginate(per_page: 20, page: params[:page]) }\n format.json do \n list = @noises.map\n render json: Noise.all.select('id, sounds, icon') \n end\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 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 @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 @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio }\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 @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 @illustrations = Illustration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @illustrations }\n end\n end",
"def index\n @fhir_base_urls = FhirBaseUrl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fhir_base_urls }\n end\n end",
"def index\n @itineraryList = Itinerary.all\n render json: @itineraryList, status: 200\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 @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 render json: Picture.all\n end",
"def index\n @uchronists = Uchronist.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronists }\n end\n end",
"def index\n render json: Client.all\n end",
"def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n\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 info = Aws.get_recipes_from_db\n render :json => info\n end",
"def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\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 @platforms = Platform.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @platforms }\n end\n end",
"def index\n @imei_packages = ImeiPackage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imei_packages }\n end\n end",
"def index\n @chairs = Chair.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chairs }\n end\n end",
"def index\n @coasters = Coaster.all\n\n render json: @coasters\n end",
"def index\n @you_owe_mes = YouOweMe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @you_owe_mes }\n end\n end",
"def show\n @idiom = Idiom.find(params[:id])\n @essays = Essay.where(idiom_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idiom }\n end\n end",
"def show\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interesting }\n end\n end",
"def show\n render json: Company.find(params[\"id\"])\n end",
"def index\r\n @imobiliarias = Imobiliaria.all\r\n\r\n respond_to do |format|\r\n # format.html # index.html.erb\r\n format.json { render json: @imobiliarias }\r\n end\r\n end",
"def index\n @iphs = Iph.paginate(:page => params[:page], :per_page => 10).order('created_at desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @iphs }\n end\n end",
"def index\n @infrastructures = getmydata(\"Infrastructure\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @infrastructures }\n end\n end",
"def index\n @experiments = Experiment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @experiments }\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 @identities = Identity.all\n\n render json: @identities\n end",
"def index\n @career_specialties = CareerSpecialty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @career_specialties }\n end\n end",
"def index\n @interruptions = Interruption.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interruptions }\n end\n end",
"def each_company_onethings(company_id, interval)\n\t\tbegin\n\t url = URI.parse(Rails.application.secrets[:api_endpoints]['onething']['url_indvidual_company'])\n\t\t url_params = {\"comapny_id\" => company_id, \"interval\" => interval}\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 show\n @ci = Ci.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ci }\n end\n end",
"def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end",
"def index\n @eicons = Eicon.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eicons }\n end\n end",
"def index\n @microroles = Microrole.includes(:verb_coding_frame_microroles).readonly(false).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @microroles }\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 @ami = Ami.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ami }\n end\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 @koti = Koti.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @koti }\n end\n end",
"def index\n @icons = Icon.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @icons }\n end\n end",
"def index\n @ivas = Iva.all\n\n render json: @ivas\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 show\n @observation = Observation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observation }\n end\n end",
"def show\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thing }\n end\n end",
"def index\n @attris = Attri.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attris }\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 @socioeconomic_studies = SocioeconomicStudy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socioeconomic_studies }\n end\n end",
"def index_by_age\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\n end",
"def show\n @mi = Mi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mi }\n end\n end",
"def index\n @specialties = Specialty.all\n\n render json: @specialties\n end",
"def show\n @rainbow = Rainbow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rainbow }\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 @pictures = Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def show\n @iph = Iph.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @iph }\n end\n end",
"def index\n @photos = Photo.all\n\n render json: @photos\n end",
"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 show\n @stuff = Stuff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stuff }\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 @interests = Interest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interests }\n end\n end",
"def index\n canonical_url(\"/animals\")\n \n @animals = Animal.includes(:animal_color, :animal_sex, :species, :status, :organization, :spay_neuter).\n where('public' => 1).\n paginate(:page => params[:page], :per_page => 10).\n order(\"updated_at DESC\").shuffle!\n \n @animals.select! {|animal| animal.organization.has_info? }\n respond_with(@animals)\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end",
"def index\n @instances = Instance.all\n render json: @instances\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 @intermediaries = Intermediary.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @intermediaries }\n end\n end",
"def index\n @machines = Machine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @machines }\n end\n end",
"def index\n hardware = Hardware.all\n render json: hardware.to_json(:except => [:id])\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 index\n @economy_hands = EconomyHand.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @economy_hands }\n end\n end",
"def show\n @illness = Illness.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @illness }\n end\n end"
] |
[
"0.63075227",
"0.626157",
"0.62382036",
"0.6234618",
"0.6215815",
"0.6206675",
"0.61918247",
"0.6173541",
"0.6132568",
"0.6129017",
"0.6121705",
"0.6095726",
"0.6084141",
"0.60785836",
"0.60707396",
"0.6066736",
"0.6065762",
"0.60516524",
"0.6047337",
"0.60449815",
"0.60390955",
"0.60390955",
"0.6031504",
"0.60266423",
"0.60231525",
"0.60115767",
"0.60107446",
"0.6010577",
"0.59720916",
"0.5968566",
"0.59626323",
"0.59536934",
"0.59531605",
"0.595",
"0.5943893",
"0.5932286",
"0.59317046",
"0.59316796",
"0.5930634",
"0.5930419",
"0.59197176",
"0.59197044",
"0.5912129",
"0.59085286",
"0.5905086",
"0.5902911",
"0.59013635",
"0.58901864",
"0.5887516",
"0.5887417",
"0.5883933",
"0.58730304",
"0.5863458",
"0.58603454",
"0.5858721",
"0.58583987",
"0.5854159",
"0.5841058",
"0.58322173",
"0.58315533",
"0.5830816",
"0.5823608",
"0.5823574",
"0.58186716",
"0.58107466",
"0.5804928",
"0.58031076",
"0.57993966",
"0.57975274",
"0.5796734",
"0.57927126",
"0.57898915",
"0.5789824",
"0.5789081",
"0.57850677",
"0.57813346",
"0.5778842",
"0.577843",
"0.5777217",
"0.5773623",
"0.5772516",
"0.5770764",
"0.5769385",
"0.576931",
"0.57675534",
"0.5767353",
"0.5753076",
"0.5749719",
"0.57463866",
"0.57440186",
"0.5743781",
"0.5742301",
"0.57414037",
"0.57406044",
"0.57403135",
"0.5737473",
"0.5735843",
"0.57343537",
"0.5728581",
"0.57263184"
] |
0.7091643
|
0
|
GET /icomes/new GET /icomes/new.json
|
def new
@icome = Icome.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @icome }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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 @interesting = Interesting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interesting }\n end\n end",
"def new\n @stuff = Stuff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stuff }\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 @something = Something.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @something }\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 @get = Get.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @get }\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 @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monkey }\n end\n end",
"def new\n @mi = Mi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mi }\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 @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 @observation = Observation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @observation }\n end\n end",
"def new\n @observation = Observation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @observation }\n end\n end",
"def new\n @itype = Itype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @itype }\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 @dummy = Dummy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dummy }\n end\n end",
"def new\n @moose = Moose.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @moose }\n end\n end",
"def new\n @serving = Serving.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serving }\n end\n end",
"def new\n @basis = Base.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @basis }\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 @byoin = Byoin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @byoin }\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 @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 @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 new\n @m_etc = MEtc.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @m_etc }\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 @human = Human.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @human }\n end\n end",
"def new\n @illness = Illness.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @illness }\n end\n end",
"def new\n @cloud = Cloud.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @cloud }\n end\n end",
"def new\n @url = Url.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end",
"def new\n @soil = Soil.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @soil }\n end\n end",
"def new\n @human = Human.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @human }\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 @garbage = Garbage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @garbage }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @interest }\n end\n end",
"def new\n @interest = Interest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interest }\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 @baton = Baton.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @baton }\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 @gen = Gen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gen }\n end\n end",
"def new\n @hoge = Hoge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hoge }\n end\n end",
"def new\n @believer = Believer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @believer }\n end\n end",
"def new\n @intern = Intern.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @intern }\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 @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 respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alley }\n end\n end",
"def new\n @ninja = Ninja.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ninja }\n end\n end",
"def create\n @icome = Icome.new(params[:icome])\n\n respond_to do |format|\n if @icome.save\n format.html { redirect_to @icome, notice: 'Icome was successfully created.' }\n format.json { render json: @icome, status: :created, location: @icome }\n else\n format.html { render action: \"new\" }\n format.json { render json: @icome.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @uniqueid = Uniqueid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @uniqueid }\n end\n end",
"def new\n @wanted = Wanted.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wanted }\n end\n end",
"def new\n @interest = Interest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @interest }\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 @specie = Specie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @specie }\n end\n end",
"def new\n @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",
"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 @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 @gopy = Gopy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gopy }\n end\n end",
"def new\n @interested = Interested.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interested }\n end\n end",
"def new\n @weather = Weather.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weather }\n end\n end",
"def new\n @weather = Weather.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weather }\n end\n end",
"def new\n @attri = Attri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attri }\n end\n end",
"def new\n @orc = Orc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @orc }\n end\n end",
"def new\n @weather = Weather.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weather }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\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 @meteor = Meteor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meteor }\n end\n end",
"def new\n @inning = Inning.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inning }\n end\n end",
"def new\n @interest = Interest.new\n\n respond_to do |format|\n format.json { render json: @interest }\n end\n end",
"def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end",
"def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end",
"def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end",
"def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end",
"def new\n @database = Database.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @database }\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 @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 @entity = Entity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end",
"def new\n @historical = Historical.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historical }\n end\n end",
"def new\n @origami = Origami.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @origami }\n end\n end",
"def new\n @origami = Origami.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @origami }\n end\n end",
"def new\n @cut = Cut.new\n @animals = Animal.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cut }\n end\n end",
"def new\n @kind = Kind.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kind }\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 @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 @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @physic = Physic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @physic }\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 @girltype = Girltype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @girltype }\n end\n end",
"def new\n @good = Good.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @good }\n end\n end"
] |
[
"0.7360428",
"0.73581916",
"0.73581624",
"0.72970355",
"0.7215863",
"0.712866",
"0.7015207",
"0.7011244",
"0.70019805",
"0.6997052",
"0.6980332",
"0.6963859",
"0.69465125",
"0.69465125",
"0.6940887",
"0.6933443",
"0.69254947",
"0.6889972",
"0.6880738",
"0.68654084",
"0.6861187",
"0.68610466",
"0.6859101",
"0.6851041",
"0.6841696",
"0.68229467",
"0.68218875",
"0.6814405",
"0.68141913",
"0.68075085",
"0.6806222",
"0.6802895",
"0.68028086",
"0.6799584",
"0.6784377",
"0.67813826",
"0.67789334",
"0.67784435",
"0.6778104",
"0.67743963",
"0.6757179",
"0.6755515",
"0.67546207",
"0.67527634",
"0.6752474",
"0.67488575",
"0.6741678",
"0.67415905",
"0.6737051",
"0.6735296",
"0.6734629",
"0.6726936",
"0.672565",
"0.6722368",
"0.6713772",
"0.6713772",
"0.6713772",
"0.6713772",
"0.6713772",
"0.6713772",
"0.6713772",
"0.6713772",
"0.6713772",
"0.6713772",
"0.67137617",
"0.6709947",
"0.6700923",
"0.6695131",
"0.6695131",
"0.6691808",
"0.66885203",
"0.6686651",
"0.6685666",
"0.66843",
"0.6682766",
"0.6681434",
"0.66808355",
"0.6677836",
"0.6677836",
"0.6677836",
"0.6677836",
"0.6673501",
"0.6671207",
"0.66693795",
"0.6668965",
"0.6668035",
"0.6667971",
"0.6667971",
"0.66669047",
"0.6665448",
"0.6665366",
"0.6664557",
"0.66622937",
"0.66622937",
"0.66622937",
"0.66622937",
"0.6660529",
"0.6656043",
"0.6654436",
"0.6653542"
] |
0.7676254
|
0
|
POST /icomes POST /icomes.json
|
def create
@icome = Icome.new(params[:icome])
respond_to do |format|
if @icome.save
format.html { redirect_to @icome, notice: 'Icome was successfully created.' }
format.json { render json: @icome, status: :created, location: @icome }
else
format.html { render action: "new" }
format.json { render json: @icome.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend",
"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 create\n @iot = Iot.new(iot_params)\n\n respond_to do |format|\n if @iot.save\n format.html { redirect_to @iot, notice: 'Iot was successfully created.' }\n format.json { render :show, status: :created, location: @iot }\n else\n format.html { render :new }\n format.json { render json: @iot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bio_signal = BioSignal.new(params[:bio_signal])\n\n respond_to do |format|\n if @bio_signal.save\n format.html { redirect_to @bio_signal, notice: 'Bio signal was successfully created.' }\n format.json { render json: @bio_signal, status: :created, location: @bio_signal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bio_signal.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 @experiment_biomechanical = ExperimentBiomechanical.new(params[:experiment_biomechanical])\n\n respond_to do |format|\n if @experiment_biomechanical.save\n format.html { redirect_to @experiment_biomechanical, notice: 'Experiment biomechanical was successfully created.' }\n format.json { render json: @experiment_biomechanical, status: :created, location: @experiment_biomechanical }\n else\n format.html { render action: \"new\" }\n format.json { render json: @experiment_biomechanical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ice_observation = IceObservation.new(ice_observation_params)\n\n respond_to do |format|\n if @ice_observation.save\n format.html { redirect_to @ice_observation, notice: 'Ice observation was successfully created.' }\n format.json { render :show, status: :created, location: @ice_observation }\n else\n format.html { render :new }\n format.json { render json: @ice_observation.errors, status: :unprocessable_entity }\n end\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 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 @imakoko = Imakoko.new(imakoko_params)\n\n respond_to do |format|\n if @imakoko.save\n format.html { redirect_to @imakoko, notice: 'Imakoko was successfully created.' }\n format.json { render :show, status: :created, location: @imakoko }\n else\n format.html { render :new }\n format.json { render json: @imakoko.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @niche = current_user.niches.new(processed_params)\n if @niche.save\n render json: { status: 'ok' }\n else\n render json: { status: @niche.errors.to_a.join('base') }\n end\n end",
"def create\n @iscrizione = Iscrizione.new(iscrizione_params)\n\n respond_to do |format|\n if @iscrizione.save\n format.html { redirect_to @iscrizione, notice: \"Iscrizione was successfully created.\" }\n format.json { render :show, status: :created, location: @iscrizione }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @iscrizione.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @iine = Iine.new(iine_params)\n\n respond_to do |format|\n if @iine.save\n format.html { redirect_to @iine, notice: 'Iine was successfully created.' }\n format.json { render :show, status: :created, location: @iine }\n else\n format.html { render :new }\n format.json { render json: @iine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sitio = Sitio.new(params[:sitio])\n\n respond_to do |format|\n if @sitio.save\n format.html { redirect_to @sitio, notice: 'Sitio was successfully created.' }\n format.json { render json: @sitio, status: :created, location: @sitio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sitio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @illnesses = Illness.all\n\n render json: @illnesses\n end",
"def create\n @chemical = Chemical.new(chemical_params)\n if @chemical.save!\n render json: @chemical\n else\n render json: {errors: @chemical.errors.full_messages}\n end\n end",
"def create\n @instagrampic = Instagrampic.new(instagrampic_params)\n\n respond_to do |format|\n if @instagrampic.save\n format.html { redirect_to @instagrampic, notice: 'Instagrampic was successfully created.' }\n format.json { render :show, status: :created, location: @instagrampic }\n else\n format.html { render :new }\n format.json { render json: @instagrampic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @io = Io.new(io_params)\n\n respond_to do |format|\n\n @profile.ios << @io\n\n if @io.save\n format.html { redirect_to @io, notice: 'Io was successfully created.' }\n format.json { render :show, status: :created, location: @io }\n else\n format.html { render :new }\n format.json { render json: @io.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @observation = Observation.new(params[:observation])\n\n @coral = Coral.find(params[:coral_id])\n @observation = @coral.observations.create(observation_params)\n\n respond_to do |format|\n if @observation.save\n format.html { redirect_to coral_path(@coral), flash: {success: 'The observation was successfully created.' } }\n format.json { render json: @observation, status: :created, location: @observation }\n else\n format.html { redirect_to coral_path(@coral), flash: {danger: \"The observation was NOT created. Please make sure the fieldtrip ID is a number and unique.\" } }\n format.json { render json: @observation.errors, status: :unprocessable_entity }\n end\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 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 create\n @spaethi = Spaethi.new(params[:spaethi])\n\n respond_to do |format|\n if @spaethi.save\n format.html { redirect_to @spaethi, notice: 'Spaethi was successfully created.' }\n format.json { render json: @spaethi, status: :created, location: @spaethi }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spaethi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @socio_irpj = SocioIrpj.new(socio_irpj_params)\n\n respond_to do |format|\n if @socio_irpj.save\n format.html { redirect_to @socio_irpj, notice: 'Socio irpj was successfully created.' }\n format.json { render action: 'show', status: :created, location: @socio_irpj }\n else\n format.html { render action: 'new' }\n format.json { render json: @socio_irpj.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @itineraryList = Itinerary.all\n render json: @itineraryList, status: 200\n end",
"def create\n @interesting = Interesting.new(params[:interesting])\n\n respond_to do |format|\n if @interesting.save\n format.html { redirect_to @interesting, notice: 'Interesting was successfully created.' }\n format.json { render json: @interesting, status: :created, location: @interesting }\n else\n format.html { render action: \"new\" }\n format.json { render json: @interesting.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 @testimonio = Testimonio.new(testimonio_params)\n\n respond_to do |format|\n if @testimonio.save\n format.html { redirect_to @testimonio, notice: 'Testimonio was successfully created.' }\n format.json { render :show, status: :created, location: @testimonio }\n else\n format.html { render :new }\n format.json { render json: @testimonio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @instituicoes = Instituicao.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instituicoes }\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 @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 show\n @icome = Icome.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @icome }\n end\n end",
"def create\n @epicrisis = Epicrisis.new(epicrisis_params)\n\n respond_to do |format|\n if @epicrisis.save\n format.html { redirect_to @epicrisis, notice: 'Epicrisis was successfully created.' }\n format.json { render :show, status: :created, location: @epicrisis }\n else\n format.html { render :new }\n format.json { render json: @epicrisis.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @imobiliaria = Imobiliaria.new(imobiliaria_params)\r\n\r\n respond_to do |format|\r\n if @imobiliaria.save\r\n format.json { render json: @imobiliaria, status: :created }\r\n else \r\n format.json { render json: @imobiliaria.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def index\n @illnesses = Illness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @illnesses }\n end\n end",
"def ingest\n json = self.result.deep_dup.with_indifferent_access\n JsonUtilities.strip_uri_type!(json)\n JsonUtilities.clean_uris!(json)\n client = HTTPClient.new\n # fire & forget\n client.put_async(\"#{INGEST_BASE_URL}?api_key=#{ENV['RC_API_KEY']}&doi=#{URI.encode_www_form_component(doi)}\",\n MultiJson.dump(json),\n 'Content-Type' => 'application/json',\n 'Accept' => 'application/json')\n end",
"def create\n @incucai = Incucai.new(params[:incucai])\n\n respond_to do |format|\n if @incucai.save\n format.html { redirect_to @incucai, notice: 'Incucai was successfully created.' }\n format.json { render json: @incucai, status: :created, location: @incucai }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incucai.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @somethings = Something.all\n render json: @somethings\n end",
"def create\n @apologetic = Apologetic.new(apologetic_params)\n\n respond_to do |format|\n if @apologetic.save\n format.html { redirect_to @apologetic, notice: 'Apologetic was successfully created.' }\n format.json { render action: 'show', status: :created, location: @apologetic }\n else\n format.html { render action: 'new' }\n format.json { render json: @apologetic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n render json: Company.create(params[\"company\"])\n end",
"def create\n @mechanic = Mechanic.new(mechanic_params)\n\n respond_to do |format|\n if @mechanic.save\n session[:mechanic_id] = @mechanic.id\n format.html { redirect_to @mechanic, notice: 'Mechanic was successfully created.' }\n format.json { render :show, status: :created, location: @mechanic }\n else\n format.html { render :new }\n format.json { render json: @mechanic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @icerik = Icerik.new(icerik_params)\n\n respond_to do |format|\n if @icerik.save\n format.html { redirect_to @icerik, notice: 'Icerik was successfully created.' }\n format.json { render :show, status: :created, location: @icerik }\n else\n format.html { render :new }\n format.json { render json: @icerik.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @phonetic = Phonetic.new(phonetic_params)\n\n respond_to do |format|\n if @phonetic.save\n format.html { redirect_to @phonetic, notice: 'Phonetic was successfully created.' }\n format.json { render :show, status: :created, location: @phonetic }\n else\n format.html { render :new }\n format.json { render json: @phonetic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @given_circumstances = GivenCircumstance.all\n render json: @given_circumstances\n end",
"def create\n @spice = Spice.new(spice_params)\n\n if @spice.save\n render json: @spice, status: :created\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end",
"def create\n @shogi = Shogi.new(shogi_params)\n\n respond_to do |format|\n if @shogi.save\n format.html { redirect_to @shogi, notice: 'Shogi was successfully created.' }\n format.json { render :show, status: :created, location: @shogi }\n else\n format.html { render :new }\n format.json { render json: @shogi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @interest = Interest.new(params[:interest])\n \n respond_to do |format|\n if @interest.save\n format.json { render :json => @interest,\n :status => :created, :location => @interest }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\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 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 create\n product_name = competitor_params[:title]\n honestbee_datas = get_honestbee_data (product_name)\n predict_catalog = get_predict_catalog ( product_name )\n save_data_in_postgres (predict_catalog)\n render :json => honestbee_datas\n end",
"def create_doi\n response = RestClient.post DoiConfig.url_for_creating_doi, data, :content_type => 'text/plain'\n return response\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 @iglesia = Iglesia.new(iglesia_params)\n\n respond_to do |format|\n if @iglesia.save\n format.html { redirect_to iglesias_path, notice: \"La iglesia #{@iglesia.nombre} ha sido creada.\" }\n format.json { render action: 'show', status: :created, location: @iglesia }\n else\n format.html { render action: 'new' }\n format.json { render json: @iglesia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @itype = Itype.new(params[:itype])\n\n respond_to do |format|\n if @itype.save\n format.html { redirect_to @itype, notice: 'Itype was successfully created.' }\n format.json { render json: @itype, status: :created, location: @itype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @itype.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 @intelcompany = IntelCompany.new(intelcompany_params)\n\n if @intelcompany.save\n render json: @intelcompany, status: :created, location: @intelcompany\n else\n render json: @intelcompany.errors, status: :unprocessable_entity\n end\n\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 create\n @irisplant = Irisplant.new(irisplant_params)\n\n respond_to do |format|\n if @irisplant.save\n format.html { redirect_to @irisplant, notice: 'Irisplant was successfully created.' }\n format.json { render :show, status: :created, location: @irisplant }\n else\n format.html { render :new }\n format.json { render json: @irisplant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @iot_datum = IotDatum.new(iot_datum_params)\n\n respond_to do |format|\n if @iot_datum.save\n format.html { redirect_to @iot_datum, notice: 'Iot datum was successfully created.' }\n format.json { render :show, status: :created, location: @iot_datum }\n else\n format.html { render :new }\n format.json { render json: @iot_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.find(params[:user])\n @animal = Animal.find(params[:animal])\n @interest = Interest.new(user_id: @user.id, animal_id: @animal.id, date: Date.today)\n\n respond_to do |format|\n if @interest.save\n format.html { redirect_to :back, notice: 'You sent an interest to the animal' }\n format.json { head :no_content }\n else\n format.html { redirect_to animals_url, notice: @interest.errors.full_messages[0] }\n format.json { head :no_content }\n end\n end\n end",
"def new\n @bio_signal = BioSignal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bio_signal }\n end\n end",
"def create\n @bio = Bio.new(params[:bio])\n\n respond_to do |format|\n if @bio.save\n format.html { redirect_to @bio, notice: 'Bio was successfully created.' }\n format.json { render json: @bio, status: :created, location: @bio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # binding.pry\n @mechanic = Mechanic.new params.require(:mechanic).permit(:bio, :kind, :company, :address, :city, :state, :zip, :speciality, :price, :picture)\n @user = User.new params[:mechanic].require(:user_attributes).permit(:name, :email, :password, :password_confirmation)\n @user.role = 1\n @mechanic.approved = false\n\n respond_to do |format|\n if @user.save\n @mechanic.user_id = @user.id\n if @mechanic.save\n format.html { redirect_to @mechanic, notice: 'Mechanic was successfully created.' }\n format.json { render :show, status: :created, location: @mechanic }\n else\n format.html { render :new }\n format.json { render json: @mechanic.errors, status: :unprocessable_entity }\n end\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 interruption_type = -1\n if params[:interruption_type] == \"internal\"\n interruption_type = 1;\n elsif params[:interruption_type] == \"external\"\n interruption_type = 0;\n end\n \n @tomato = Tomato.find(params[:tomato_id])\n @interruption = @tomato.interruptions.create!(params[:interruption].merge(:interruption_type => interruption_type))\n @interruption.user_id = current_user.id\n \n respond_to do |format|\n if @interruption.save\n format.html { redirect_to @tomato, notice: 'Interruption was successfully created.' }\n format.json { render json: @tomato, status: :created, location: @tomato }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tomato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @physician = Physician.new(physician_params)\n\n if @physician.save\n render json: @physician, status: :created\n else\n render json: @physician.errors, status: :unprocessable_entity\n end\n end",
"def create\n @oiseau = Oiseau.new(oiseau_params)\n\n respond_to do |format|\n if @oiseau.save\n format.html { redirect_to @oiseau, notice: 'Oiseau was successfully created.' }\n format.json { render :show, status: :created, location: @oiseau }\n else\n format.html { render :new }\n format.json { render json: @oiseau.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @oi = Oi.new(oi_params)\n @ois = Oi.all\n test = true\n while(test)\n \n a = *(100000..1000000)\n @oi.id = a.sample\n test = false\n @ois.each do |doi|\n if(doi.id == @oi.id)\n test = true\n end\n end\n end\n respond_to do |format|\n if @oi.save\n format.html { redirect_to @oi, notice: 'Oi was successfully created.' }\n else \n render :new\n end\n end\n end",
"def medieval_composers\n response = RestClient.get 'https://api.openopus.org/composer/list/epoch/Medieval.json'\n json = JSON.parse response\n puts json\n\n if !json.nil?\n json[\"composers\"].map do |composer|\n Composer.create(name: \"#{composer[\"complete_name\"]}\", birth: \"#{composer[\"birth\"]}\", death: \"#{composer[\"death\"]}\", portrait: \"#{composer[\"portrait\"]}\", period_id: 1)\n end\n else\n puts \"Error seeding composers\"\n end\nend",
"def create\n @instituicao = Instituicao.new(params[:instituicao])\n\n respond_to do |format|\n if @instituicao.save\n format.html { redirect_to @instituicao, notice: 'Instituicao was successfully created.' }\n format.json { render json: @instituicao, status: :created, location: @instituicao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instituicao.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 index\n @noise = Noise.new\n @noises = Noise.all\n params[:page] ||= 1\n\n respond_to do |format|\n format.html { @noises = Noise.paginate(per_page: 20, page: params[:page]) }\n format.json do \n list = @noises.map\n render json: Noise.all.select('id, sounds, icon') \n end\n end\n end",
"def create\n @iscriviti = Iscriviti.new(iscriviti_params)\n\n respond_to do |format|\n if @iscriviti.save\n format.html { redirect_to @iscriviti, notice: \"Iscriviti was successfully created.\" }\n format.json { render :show, status: :created, location: @iscriviti }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @iscriviti.errors, status: :unprocessable_entity }\n end\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 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 @byoin = Byoin.new(params[:byoin])\n\n respond_to do |format|\n if @byoin.save\n format.html { redirect_to @byoin, notice: 'Byoin was successfully created.' }\n format.json { render json: @byoin, status: :created, location: @byoin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @byoin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end",
"def create\n @mechenic = Mechenic.new(mechenic_params)\n\n respond_to do |format|\n if @mechenic.save\n format.html { redirect_to @mechenic, notice: 'Mechenic was successfully created.' }\n format.json { render :show, status: :created, location: @mechenic }\n else\n format.html { render :new }\n format.json { render json: @mechenic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @attris = Attri.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attris }\n end\n end",
"def create\n @koti = Koti.new(params[:koti])\n\n respond_to do |format|\n if @koti.save\n format.html { redirect_to @koti, notice: 'Koti was successfully created.' }\n format.json { render json: @koti, status: :created, location: @koti }\n else\n format.html { render action: \"new\" }\n format.json { render json: @koti.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @resource = Resource.new(params[:resource])\n @terms = Term.all_iit_subjects\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render json: @resource, status: :created, location: @resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n animal = Animal.new(animal_params)\n if !animal.name.nil?\n animal.save\n render json: animal, status: 201, location: [:api, animal]\n else\n render json: { errors: animal.errors }, status: 422\n end\n end",
"def create\n @interest = Interest.new(params[:interest])\n\n respond_to do |format|\n if @interest.save\n format.html { redirect_to @interest, :notice => 'Interest was successfully created.' }\n format.json { render :json => @interest, :status => :created, :location => @interest }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @interest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @spaethi = Spaethi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spaethi }\n end\n end",
"def create\n @anything = Anything.new(anything_params)\n\n respond_to do |format|\n if @anything.save\n format.html { redirect_to @anything, notice: 'Anything was successfully created.' }\n format.json { render action: 'show', status: :created, location: @anything }\n else\n format.html { render action: 'new' }\n format.json { render json: @anything.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ami = Ami.new(params[:ami])\n\n respond_to do |format|\n if @ami.save\n format.html { redirect_to @ami, notice: 'Ami was successfully created.' }\n format.json { render json: @ami, status: :created, location: @ami }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ami.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @iphs = Iph.paginate(:page => params[:page], :per_page => 10).order('created_at desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @iphs }\n end\n end",
"def create\n @providerable, @name = find_polymorphic\n @provider = @providerable.provider_insurances.build(params[:provider_insurance])\n @provider.created_user = current_user.login_name\n @all_insurance_company = InsuranceCompany.all\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to polymorphic_path([@providerable, @provider]), notice: 'Provider insurance was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @estadios = Estadio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @estadios }\n end\n end",
"def index\n @annotation = Annotation.all\n respond_to do |format|\n iiif = []\n @annotation.each do |annotation|\n iiif << annotation.to_iiif\n end\n iiif.to_json\n format.html {render json: iiif}\n format.json {render json: iiif, content_type: \"application/json\"}\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 create\n @idiom = Idiom.new(params[:idiom])\n\n respond_to do |format|\n if @idiom.save\n format.html { redirect_to @idiom, notice: 'Idiom was successfully created.' }\n format.json { render json: @idiom, status: :created, location: @idiom }\n else\n format.html { render action: \"new\" }\n format.json { render json: @idiom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @soil = Soil.new(soil_params)\n\n respond_to do |format|\n if @soil.save\n format.html { redirect_to @soil, notice: 'Soil was successfully created.' }\n format.json { render json: @soil, status: :created, location: @soil }\n else\n format.html { render action: \"new\" }\n format.json { render json: @soil.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @therapist = Therapist.new(therapist_params.merge({code: create_code}))\n if @therapist.save\n render :json => {\n id: @therapist.id,\n email: @therapist.email,\n firstName: @therapist.first_name,\n lastName: @therapist.last_name,\n prefix: @therapist.prefix,\n profession: @therapist.profession,\n code: @therapist.code,\n token: get_token(@therapist)\n }\n else\n render json: @therapist.errors, status: :unprocessable_entity\n # render json: @therapist.errors, status: :unprocessable_entity\n end\n end",
"def create\n @ii_i = IiI.new(params[:ii_i])\n\n respond_to do |format|\n if @ii_i.save\n format.html { redirect_to(@ii_i, :notice => 'Ii i was successfully created.') }\n format.xml { render :xml => @ii_i, :status => :created, :location => @ii_i }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ii_i.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 @physic = Physic.new(params[:physic])\n\n respond_to do |format|\n if @physic.save\n format.html { redirect_to @physic, notice: 'Physic was successfully created.' }\n format.json { render json: @physic, status: :created, location: @physic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @physic.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 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 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 create_albums\n url = 'https://stg-resque.hakuapp.com/albums.json'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n albums = JSON.parse(response)\n\n albums.each do |album|\n Album.create!(album.except('id'))\n end\nend",
"def create\n @cvi = Cvi.new(params[:cvi])\n @people = Person.all\n\n respond_to do |format|\n if @cvi.save\n format.html { redirect_to @cvi, notice: 'Cvi was successfully created.' }\n format.json { render json: @cvi, status: :created, location: @cvi }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cvi.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.5795012",
"0.5752791",
"0.5645945",
"0.55474675",
"0.5447112",
"0.5443642",
"0.5397432",
"0.5395905",
"0.53814924",
"0.53669167",
"0.53457403",
"0.53420395",
"0.53363365",
"0.53102446",
"0.53069204",
"0.5304057",
"0.52766067",
"0.52694386",
"0.5268545",
"0.52385765",
"0.5237775",
"0.5237635",
"0.52249724",
"0.5223918",
"0.5218697",
"0.5218233",
"0.52027875",
"0.51942015",
"0.51868206",
"0.51863277",
"0.5162223",
"0.51613027",
"0.5161289",
"0.5159784",
"0.51594704",
"0.5158731",
"0.5158129",
"0.51580817",
"0.5149018",
"0.5147402",
"0.51445526",
"0.51437217",
"0.5138764",
"0.51225424",
"0.5112872",
"0.51106083",
"0.5109472",
"0.5109074",
"0.5089591",
"0.5089222",
"0.5076184",
"0.5072672",
"0.50681776",
"0.50681657",
"0.50673705",
"0.50670755",
"0.5062306",
"0.5060054",
"0.5057479",
"0.5056263",
"0.50526357",
"0.5047866",
"0.504007",
"0.5037159",
"0.503468",
"0.5031327",
"0.5025712",
"0.5023406",
"0.5022104",
"0.5020408",
"0.5019701",
"0.50195044",
"0.50070757",
"0.49994725",
"0.4991279",
"0.49889624",
"0.49872985",
"0.49860433",
"0.49840644",
"0.4983881",
"0.49831864",
"0.4978955",
"0.4973217",
"0.49725512",
"0.4971694",
"0.49712694",
"0.496985",
"0.49680597",
"0.496663",
"0.4965863",
"0.49639106",
"0.4962303",
"0.49613076",
"0.49516004",
"0.49507275",
"0.49477515",
"0.49472442",
"0.49457029",
"0.49449775",
"0.493597"
] |
0.65722305
|
0
|
PUT /icomes/1 PUT /icomes/1.json
|
def update
@icome = Icome.find(params[:id])
respond_to do |format|
if @icome.update_attributes(params[:icome])
format.html { redirect_to @icome, notice: 'Icome was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @icome.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def put(*args)\n request :put, *args\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"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 render json: Company.update(params[\"id\"], params[\"company\"])\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 put!\n request! :put\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 put(*args)\n request(:put, *args)\n end",
"def update options={}\n client.put(\"/#{id}\", options)\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 respond_to do |format|\n if @iot.update(iot_params)\n format.html { redirect_to @iot, notice: 'Iot was successfully updated.' }\n format.json { render :show, status: :ok, location: @iot }\n else\n format.html { render :edit }\n format.json { render json: @iot.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 put(path, data = {})\n request 'PUT', path, body: data.to_json\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(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(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\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 @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.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 test_put\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 contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end",
"def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end",
"def put endpoint, data\n do_request :put, endpoint, data\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 set_api_v1_initiative_update\n @api_v1_initiative_update = Api::V1::InitiativeUpdate.find(params[:id])\n end",
"def update\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n if @sitio.update_attributes(params[:sitio])\n format.html { redirect_to @sitio, notice: 'Sitio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sitio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @spice.update(spice_params)\n head :no_content\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end",
"def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end",
"def update_doi\n response = RestClient.post \"#{DoiConfig.url_for_updating_doi}#{doi}\", sanitize_data, :content_type => 'text/plain; charset=UTF-8', :content_length => sanitize_data.size, :accept => 'text/plain'\n return response\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 @io.update(io_params)\n format.html { redirect_to @io, notice: 'Io was successfully updated.' }\n format.json { render :show, status: :ok, location: @io }\n else\n format.html { render :edit }\n format.json { render json: @io.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args, &block)\n self.client.put *args\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 animal = Animal.find(params[:id])\n\n if validate_params(animal_params)\n animal.update(animal_params)\n render json: animal, status: 200, location: [:api, animal]\n else\n render json: { errors: animal.errors }, status: 422\n end\n end",
"def update\n @observation = Observation.find(params[:id])\n\n respond_to do |format|\n if @observation.update_attributes(params[:observation])\n format.html { redirect_to @observation, notice: '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(*args)\n put(*args)\n end",
"def update(*args)\n put(*args)\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 official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end",
"def update\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.attributes = params[:physical_rack]\n @physical_rack.audits << Audit.new(source: 'controller', action: 'update', admin_user: current_user)\n respond_to do |format|\n if @physical_rack.save\n format.html { redirect_to @physical_rack, notice: 'Physical rack was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @physical_rack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ice_observation.update(ice_observation_params)\n format.html { redirect_to @ice_observation, notice: 'Ice observation was successfully updated.' }\n format.json { render :show, status: :ok, location: @ice_observation }\n else\n format.html { render :edit }\n format.json { render json: @ice_observation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n request_body_Data= '{ \"widget\":\n {\n \"name\" : \"'+params[:name]+'\",\n \"description\" : \"'+params[:description]+'\"\n }}'\n response = RestClient::Request.new({\n method: :put,\n url: ENV['API_URL'] + '/widgets/' + params[:id],\n payload: request_body_Data,\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n @widget= Widget.new do |widget|\n widget.id=json[\"data\"][\"widget\"][\"id\"]\n widget.name=json[\"data\"][\"widget\"][\"name\"]\n widget.description=json[\"data\"][\"widget\"][\"description\"]\n widget.kind=json[\"data\"][\"widget\"][\"kind\"]\n widget.userid=json[\"data\"][\"widget\"][\"user\"][\"id\"]\n widget.username=json[\"data\"][\"widget\"][\"user\"][\"name\"]\n widget.owner=json[\"data\"][\"widget\"][\"owner\"]\n end\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n respond_to do |format|\n if @widget\n format.html { redirect_to @widget, notice: 'Widget was successfully updated.' }\n format.json { render :show, status: :ok, location: @widget }\n else\n format.html { render :edit }\n format.json { render json: @widget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @incident = Incident.find(params[:id])\n\n if @incident.update(incident_params)\n head :no_content\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end",
"def update\n @experiment_biomechanical = ExperimentBiomechanical.find(params[:id])\n\n respond_to do |format|\n if @experiment_biomechanical.update_attributes(params[:experiment_biomechanical])\n format.html { redirect_to @experiment_biomechanical, notice: 'Experiment biomechanical was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experiment_biomechanical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put payload, path = \"\"\n make_request(path, \"put\", payload)\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 @serving.update(serving_params)\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { render :show, status: :ok, location: @serving }\n else\n format.html { render :edit }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ontology.update(ontology_params)\n format.html { redirect_to @ontology, notice: 'Ontology was successfully updated.' }\n format.json { render :show, status: :ok, location: @ontology }\n else\n format.html { render :edit }\n format.json { render json: @ontology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @jio.update(jio_params)\n format.html { redirect_to @jio, notice: 'Jio was successfully updated.' }\n format.json { render :show, status: :ok, location: @jio }\n else\n format.html { render :edit }\n format.json { render json: @jio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\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(path, data=nil)\n request(:put, path, data)\n end",
"def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to things_path, notice: 'Your thing was successfully updated!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @idiom = Idiom.find(params[:id])\n\n respond_to do |format|\n if @idiom.update_attributes(params[:idiom])\n format.html { redirect_to @idiom, notice: 'Idiom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @idiom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, params={})\n RestClient.put request_base+path, params\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 render json: Alien.update(params[\"id\"], params[\"alien\"])\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_model.update(sivic_model_params)\r\n format.html { redirect_to @sivic_model, notice: 'Sivic model 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_model.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def put url, object = nil\n request url, HTTP::Put, object\n end",
"def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to @thing, notice: 'Thing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def update\n @pictures = Picture.all.order(created_at: :desc)\n @picture.update(picture_params)\n render json: @pictures\n # head :no_content\n end",
"def update\n @ami = Ami.find(params[:id])\n\n respond_to do |format|\n if @ami.update_attributes(params[:ami])\n format.html { redirect_to @ami, notice: 'Ami was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ami.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def update\n respond_to do |format|\n if @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 @bio_signal = BioSignal.find(params[:id])\n\n respond_to do |format|\n if @bio_signal.update_attributes(params[:bio_signal])\n format.html { redirect_to @bio_signal, notice: 'Bio signal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bio_signal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def raw_put(path, body, options = {})\n # Allow format override\n format = options.delete(:format) || @format\n # Clear cache\n expire_matching \"#{parent_path(path)}.*\"\n # Create PUT request\n put = Typhoeus::Request.new(\"#{protocol}#{@server}#{path}\", \n :verbose => DEBUG,\n :method => \"put\",\n :body => body,\n :headers => { :'Content-type' => options[:content_type] || content_type(format) }\n )\n # Send request\n do_request(put, format)\n end",
"def update\n @spaethi = Spaethi.find(params[:id])\n\n respond_to do |format|\n if @spaethi.update_attributes(params[:spaethi])\n format.html { redirect_to @spaethi, notice: 'Spaethi was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spaethi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end",
"def update\n @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 @iine.update(iine_params)\n format.html { redirect_to @iine, notice: 'Iine was successfully updated.' }\n format.json { render :show, status: :ok, location: @iine }\n else\n format.html { render :edit }\n format.json { render json: @iine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n @shot = Shot.find(params[:id])\n\n if @shot.update(shot_params)\n head :no_content\n else\n render json: @shot.errors, status: :unprocessable_entity\n end\n end",
"def update\n @stuff = Stuff.find(params[:id])\n\n respond_to do |format|\n if @stuff.update_attributes(params[:stuff])\n format.html { redirect_to @stuff, :notice => 'Stuff was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @stuff.errors, :status => :unprocessable_entity }\n end\n end\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 @identity = Identity.find(params[:id])\n\n if @identity.update(identity_params)\n head :no_content\n else\n render json: @identity.errors, status: :unprocessable_entity\n end\n end",
"def update!(sobject, attrs)\n id = attrs.has_key?(:Id) ? attrs.delete(:Id) : attrs.delete('Id')\n raise 'Id field missing.' unless id\n api_patch \"sobjects/#{sobject}/#{id}\", attrs\n true\n end",
"def ingest\n json = self.result.deep_dup.with_indifferent_access\n JsonUtilities.strip_uri_type!(json)\n JsonUtilities.clean_uris!(json)\n client = HTTPClient.new\n # fire & forget\n client.put_async(\"#{INGEST_BASE_URL}?api_key=#{ENV['RC_API_KEY']}&doi=#{URI.encode_www_form_component(doi)}\",\n MultiJson.dump(json),\n 'Content-Type' => 'application/json',\n 'Accept' => 'application/json')\n end",
"def update\n respond_to do |format|\n if @interesting_thing.update(interesting_thing_params)\n format.html { redirect_to student_interesting_things_path(@student), notice: 'Interesting thing was successfully updated.' }\n format.json { render :show, status: :ok, location: @interesting_thing }\n else\n format.html { render :edit }\n format.json { render json: @interesting_thing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\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 orchio_put(jdoc)\n response = client.send_request :put, inst_args(json: jdoc)\n if cache.enabled?\n simple_cache.save(\n Document.new(\n response.body.to_hash,\n Metadata.new(\n :collection => ocollection,\n :key => @id,\n :ref => response.header.etag\n )))\n end\n set_ref_value response\n orchio_status response, 201\n end",
"def update\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n if @specie.update_attributes(params[:specie])\n format.html { redirect_to @specie, notice: 'Specie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_api_v1_initiative\n @api_v1_initiative = Api::V1::Initiative.find(params[:id])\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\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 sneaker = find_sneaker\n # update! exceptions will be handled by the rescue_from ActiveRecord::RecordInvalid code\n sneaker.update(sneaker_params)\n render json: sneaker\n end",
"def update\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 update\n respond_to do |format|\n if @hospice.update(hospice_params)\n format.html { redirect_to @hospice, notice: 'Hospice was successfully updated.' }\n format.json { render :show, status: :ok, location: @hospice }\n else\n format.html { render :edit }\n format.json { render json: @hospice.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.622978",
"0.6066552",
"0.60259026",
"0.5992352",
"0.5986322",
"0.5944172",
"0.5943403",
"0.59099716",
"0.5884617",
"0.58782387",
"0.58176047",
"0.5701883",
"0.56877875",
"0.5642806",
"0.5615466",
"0.55889285",
"0.5588622",
"0.5584942",
"0.558493",
"0.55839026",
"0.55822134",
"0.5580799",
"0.5564832",
"0.5559849",
"0.5556044",
"0.55483365",
"0.5542566",
"0.55208385",
"0.55190945",
"0.55075914",
"0.54894125",
"0.5456207",
"0.54433405",
"0.54405105",
"0.5405393",
"0.54017335",
"0.5397793",
"0.5397793",
"0.5393167",
"0.53888464",
"0.5386324",
"0.5386222",
"0.53803945",
"0.5369836",
"0.53679365",
"0.53599757",
"0.5358346",
"0.5348177",
"0.53367716",
"0.53343886",
"0.5334101",
"0.5333419",
"0.53310573",
"0.53296477",
"0.53295696",
"0.53278035",
"0.5326762",
"0.5323698",
"0.531164",
"0.5310877",
"0.5307663",
"0.53058416",
"0.53058416",
"0.53058416",
"0.53005",
"0.52963924",
"0.529481",
"0.52915055",
"0.52894485",
"0.5286171",
"0.5285008",
"0.5282822",
"0.5279691",
"0.5274659",
"0.5271941",
"0.5267285",
"0.5266569",
"0.52663493",
"0.52661586",
"0.5264936",
"0.5263766",
"0.5252974",
"0.52455384",
"0.52455384",
"0.52455384",
"0.52455384",
"0.52455384",
"0.52455384",
"0.52455384",
"0.52455384",
"0.5240947",
"0.52392167",
"0.52389115",
"0.5236534",
"0.52349025",
"0.52349025",
"0.5232595",
"0.5229672",
"0.5229284",
"0.5225611"
] |
0.64691037
|
0
|
DELETE /icomes/1 DELETE /icomes/1.json
|
def destroy
@icome = Icome.find(params[:id])
@icome.destroy
respond_to do |format|
format.html { redirect_to icomes_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_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete(path)\n RestClient.delete request_base+path\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 delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def delete\n render json: Company.delete(params[\"id\"])\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 delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"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 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 animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @something = Something.find(params[:id])\n @something.destroy\n\n respond_to do |format|\n format.html { redirect_to somethings_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @stuff = Stuff.find(params[:id])\n @stuff.destroy\n\n respond_to do |format|\n format.html { redirect_to stuff_index_url }\n format.json { head :no_content }\n end\n end",
"def 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 delete(*rest) end",
"def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @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\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @iot.destroy\n respond_to do |format|\n format.html { redirect_to iots_url, notice: 'Iot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete\n request(:delete)\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def destroy\n @thing = Thing.find(params[:id])\n @thing.destroy\n\n respond_to do |format|\n format.html { redirect_to things_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thing = Thing.find(params[:id])\n @thing.destroy\n\n respond_to do |format|\n format.html { redirect_to things_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stuff = Stuff.find(params[:id])\n @stuff.destroy\n\n respond_to do |format|\n format.html { redirect_to stuffs_url }\n format.json { head :ok }\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 endpoint\n do_request :delete, endpoint\n end",
"def orchio_delete\n response = client.send_request :delete, inst_args\n orchio_status response, 204\n end",
"def delete\n start { |connection| connection.request http :Delete }\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\n render json: Like.delete(params[\"id\"])\n end",
"def destroy\n @bio_signal = BioSignal.find(params[:id])\n @bio_signal.destroy\n\n respond_to do |format|\n format.html { redirect_to bio_signals_url }\n format.json { head :no_content }\n end\n end",
"def delete(*args)\n request(:delete, *args)\n end",
"def destroy\n @test_stuff.destroy\n respond_to do |format|\n format.html { redirect_to test_stuffs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end",
"def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end",
"def delete!\n request! :delete\n end",
"def destroy\n record = Asset.find(params[:id])\n record.destroy\n\n respond_to do |format| \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 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 cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def destroy\n @basis = Base.find(params[:id])\n @basis.destroy\n\n respond_to do |format|\n format.html { redirect_to bases_url }\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 @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete(object)\n full_name = extract_full_name object\n post 'api/del', :id => full_name\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end",
"def destroy\n @intake.destroy\n respond_to do |format|\n format.html { redirect_to intakes_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 @iso.destroy\n respond_to do |format|\n format.html { redirect_to isos_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 @animal = Animal.find(params[:id])\n @animal.destroy\n\n respond_to do |format|\n format.html { redirect_to zoo_animals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @oi.destroy\n respond_to do |format|\n format.html { redirect_to ois_url, notice: 'Oi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def destroy\n @adocao_animal = AdocaoAnimal.find(params[:id])\n @adocao_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to adocao_animals_url }\n format.json { head :no_content }\n end\n end",
"def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\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 delete(options={})\n connection.delete(\"/\", @name)\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def destroy\n @animal.destroy\n\n respond_to do |format|\n format.html { redirect_to animals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @experiment_biomechanical = ExperimentBiomechanical.find(params[:id])\n @experiment_biomechanical.destroy\n\n respond_to do |format|\n format.html { redirect_to experiment_biomechanicals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @record = Asset.find(params[:id])\n @record.trash\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n Generator.where(id: params[:id] ).first.destroy\n respond_to do |format|\n format.html { redirect_to generators_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def delete\n api(\"Delete\")\n end",
"def delete(path)\n request 'DELETE', path\n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def delete\n Iterable.request(conf, base_path).delete\n end",
"def destroy\n @api_client = ApiClient.find(params[:id])\n @api_client.destroy\n\n respond_to do |format|\n format.html { redirect_to api_clients_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def destroy\n @animal.destroy\n respond_to do |format|\n format.html { redirect(person_animals_url, :delete, 'animal') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uriy.destroy\n respond_to do |format|\n format.html { redirect_to uriys_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @observ.destroy\n respond_to do |format|\n format.html { redirect_to observs_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 @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 delete(path)\n request(:delete, path)\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 @cow.destroy\n respond_to do |format|\n format.html { redirect_to kine_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jedi = Jedi.find(params[:id])\n @jedi.destroy\n\n respond_to do |format|\n format.html { redirect_to jedis_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end",
"def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\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 @lob.destroy\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 @cage.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end",
"def delete(*uris); end",
"def destroy\n @item.destroy\n respond_to do |format|\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 destroy\n @hoge = Hoge.find(params[:id])\n @hoge.destroy\n\n respond_to do |format|\n format.html { redirect_to hoges_url }\n format.json { head :ok }\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 @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 @thing.destroy\n respond_to do |format|\n format.html { redirect_to things_url, notice: 'The thing was deleted.' }\n format.json { head :no_content }\n end\n end",
"def delete\n\n end"
] |
[
"0.71528244",
"0.6851649",
"0.68198633",
"0.6779597",
"0.67709005",
"0.67559874",
"0.6736724",
"0.67078704",
"0.6707748",
"0.6697663",
"0.66600794",
"0.66600794",
"0.66600794",
"0.66600794",
"0.66583514",
"0.6635848",
"0.6631323",
"0.6629502",
"0.6588127",
"0.6585304",
"0.65508246",
"0.65432525",
"0.65426916",
"0.6535332",
"0.65328723",
"0.65216964",
"0.6490328",
"0.6484533",
"0.6475605",
"0.6475605",
"0.64588535",
"0.64559954",
"0.64462006",
"0.6445132",
"0.64418435",
"0.64411944",
"0.6439761",
"0.64388335",
"0.6427218",
"0.64074534",
"0.6407284",
"0.6405449",
"0.64054203",
"0.6405182",
"0.6398127",
"0.6398127",
"0.6397669",
"0.6394689",
"0.6388887",
"0.63842297",
"0.6383618",
"0.63797516",
"0.63786316",
"0.637307",
"0.63726395",
"0.6371555",
"0.63613075",
"0.63583755",
"0.63576764",
"0.63571787",
"0.63569516",
"0.63568753",
"0.63561743",
"0.63485086",
"0.63424057",
"0.633546",
"0.6334707",
"0.6334354",
"0.6330587",
"0.63298583",
"0.63289785",
"0.63257104",
"0.6324849",
"0.6324687",
"0.63245475",
"0.6323538",
"0.63183653",
"0.6317907",
"0.63177437",
"0.6313685",
"0.63129574",
"0.631184",
"0.63111293",
"0.63085085",
"0.630461",
"0.63040257",
"0.63031584",
"0.6303013",
"0.6297748",
"0.6295637",
"0.6294395",
"0.62924963",
"0.62912816",
"0.62912285",
"0.62892735",
"0.6284499",
"0.6281244",
"0.62803924",
"0.62777114",
"0.6276999"
] |
0.722648
|
0
|
TO MACIG STUFF oN INIT
|
def index
@conversations = Conversation.involving(current_user)
conversations_new_message = Array.new
unread = 0
@conversations.each do |conversation|
conversation.last_message = ActionView::Base.full_sanitizer.sanitize(conversation.messages.order('created_at').last.body[0..75])
conversation.last_message_date = conversation.messages.order('created_at').last.created_at
conversation.count_unread = conversation.messages.unread(conversation.id, current_user).size
size = conversation.messages.unread(conversation.id, current_user).size
if size > 0
conversations_new_message.push(conversation)
unread = unread + size
end
@subs=current_user.subscribtions
end
conversations_new_message.each do |conversation|
set_messages_receive(conversation, false)
end
if unread > 0
if unread == 1
flash[:info] = t('welcome.you_have') + unread.to_s + t('welcome.unread_message')
else
flash[:info] = t('welcome.you_have') + unread.to_s + t('welcome.unread_messages')
end
end
@invites = Invite.by_recipient_id(current_user.id).order('id');
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def padding=(_arg0); end",
"def transform; end",
"def initialize\n\t@mac11 = Array.new\n\t@mac12 = Array.new\n\t@mac13 = Array.new\n\t@mac14 = Array.new\n\n @istr = String.new\n\ti = 0\n while ( i < CM_CMC_MSG_SIZE )\n @istr = @istr + ' '\n i = i + 1\n end\n end",
"def initialize_content\n content = []\n num = 0\n (0..@size).each do\n num = 0 if (num != 0 && num % ((@size+1)/8) == 0)\n content << num.to_s(16)\n num+=1\n end\n content\n end",
"def initialize(${1:args})\n ${1:$\n(mapconcat\n '(lambda (x) (concat \"@\" x \" = \" x))\n (split-string text \", \")\n (concat \"\\n\" (make-string (current-column) 32)))\n}$0\nend",
"def before_convert()\n @script = ''\n @script << @preamble if @preamble\n end",
"def initialize(p0=\"\") end",
"def to_s(); self.unpad[0] end",
"def encoder=(_arg0); end",
"def transformations; end",
"def pack\n end",
"def pack(p0) end",
"def init_separator(hash) end",
"def arith(b,opt=\"M\") return \"@SP\\nAM=M-1\\nD=M\\nA=A-1\\n\"+opt+\"=M\"+b+\"D\\n\" end",
"def mpt_init=(_arg0); end",
"def to_parslet; end",
"def formation; end",
"def transforms; end",
"def transformation\n end",
"def inflate\n \" \" + self + \" \"\n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def normalize_header!\n @gsi.dsc = HeaderOption::DSC::TELETEXT_LEVEL_2\n @gsi.lc = @gsi.lc.to_i.to_s.rjust(2,'0')\n @gsi.tnb = @gsi.tnb.to_i.to_s.rjust(5,'0')\n @gsi.tns = @gsi.tns.to_i.to_s.rjust(5,'0')\n @gsi.tng = @gsi.tng.to_i.to_s.rjust(3,'0')\n @gsi.tcp = @gsi.tcp[0..1].to_i.to_s.ljust(2,'0') + \n @gsi.tcp[2..3].to_i.to_s.ljust(2,'0') +\n @gsi.tcp[4..5].to_i.to_s.ljust(2,'0') +\n @gsi.tcp[6..7].to_i.to_s.ljust(2,'0')\n @gsi.tcf = @gsi.tcf[0..1].to_i.to_s.ljust(2,'0') +\n @gsi.tcf[2..3].to_i.to_s.ljust(2,'0') +\n @gsi.tcf[4..5].to_i.to_s.ljust(2,'0') +\n @gsi.tcf[6..7].to_i.to_s.ljust(2,'0')\n @gsi.co = @gsi.co.upcase\n end",
"def mpt_init; end",
"def adjust_sp_binary()\n \"@SP\\nM=M-1\\n@SP\\nA=M\\nD=M\\n@SP\\nM=M-1\\nA=M\\n\"\n end",
"def encoding_line=(_arg0); end",
"def padding; end",
"def padding; end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def inflate(data); end",
"def finalize! \n # counts\n @gsi.tnb = @tti.length.to_s.rjust(5,'0')\n @gsi.tns = (@sgn*0x10000 + @sn).to_s.rjust(5,'0')\n @gsi.tng = (@sgn+1).to_s.rjust(3,'0')\n \n # initial subtitle\n if @tti.length > 0\n time = @tti.first.tci\n @gsi.tcf = \"%02d%02d%02d%02d\" % [time.getbyte(0),time.getbyte(1),time.getbyte(2),time.getbyte(3)]\n end\n end",
"def align=(_arg0); end",
"def setup\n @a = '0b100010011010101111001101'\n end",
"def transform\n end",
"def standard_padding; 0; end",
"def initial_generate\n \n end",
"def __convert(h); end",
"def rassoc(p0) end",
"def MTX02=(arg)",
"def initialize(z=\"\") end",
"def calc_cmc_mac(base_mac, i = 1)\n mac_array = base_mac.split(/:/)\n mac_array[-2] = \"F%d\" % [i / 100]\n mac_array[-1] = \"%02d\" % [i % 100]\n mac_array.join(\":\")\nend",
"def concat(p0) end",
"def concat(p0) end",
"def default_space_encoding=(_arg0); end",
"def bs; end",
"def assemble_to_string\n #put the strings at the end of the assembled code.\n # adding them will fix their position and make them assemble after\n @string_table.values.each do |data|\n add_block data\n end\n io = StringIO.new\n assemble(io)\n io.string\n end",
"def norm\n [outcode, incode].compact.join(\" \")\n end",
"def initialize(content); end",
"def initialize(content); end",
"def MTX01=(arg)",
"def berlioz; end",
"def encoder; end",
"def encoder; end",
"def init(*args)\r\n \tunless args.nil? || args.empty?\r\n \t\t@ASCII = '0'\r\n \t\t@ASCII = args[0][:ASCII] if !args[0][:ASCII].nil?\r\n \t\t@things = []\r\n \t\t@owner = args[0][:owner] if !args[0][:owner].nil?\r\n \tend\r\n end",
"def ITD06=(arg)",
"def encode\n @code = \"\"\n add_check_digit_and_ensure_even_digit_size\n 0.step(@encodable.size - 1, 2) do |i|\n first = SYMBOLOGY[@encodable[i]]\n second = SYMBOLOGY[@encodable[i+1]]\n @code += 0.upto(4).map { |j| first[j] + second[j] }.join\n end \n @code = SYMBOLOGY[:start] + @code + SYMBOLOGY[:stop]\n self\n end",
"def motto; end",
"def initialize(a_1, a_2, a_3, b_1, b_2, b_3, c_1, c_2, c_3)\n @a_1 = a_1\n @a_2 = a_2\n @a_3 = a_3\n @b_1 = b_1\n @b_2 = b_2\n @b_3 = b_3\n @c_1 = c_1\n @c_2 = c_2\n @c_3 = c_3\n\n #on insere les variables qui seront modifiables dans les compartiments.\n @o = \" 1 2 3 \"\n @a = \" | | \"\n @b = \" a \" + @a_1 +\" | \"+ @a_2 +\" | \" + @a_3\n @c = \" ___|___|___ \"\n @d = \" | | \"\n @e = \" b \" + @b_1 +\" | \"+ @b_2 +\" | \" + @b_3\n @f = \" ___|___|___ \"\n @g = \" | | \"\n @h = \" c \" + @c_1 +\" | \"+ @c_2 +\" | \" + @c_3\n @i = \" | | \"\n\n end",
"def create_run_code\n @index = self.short_description.index(\"ip\")\n @end_index = self.short_description.index(\"and bin_id\")\n @result = self.short_description[@index + 1, @end_index - @index]\n @string = @result.gsub(/[ipa:,]/,' ')\n @array = @string.split(/\\s*/)\n @prod_run_code =\"\"\n @array.each do |char|\n if(char==\":\")\n @prod_run_code.concat(\"\")\n elsif(char==\"\")\n @prod_run_code.concat(\"\")\n elsif(char==\",\")\n @prod_run_code.concat(\"\")\n else\n @prod_run_code.concat(char)\n end\n end\n self.run_code = @prod_run_code.strip()\nend",
"def construct(w)\n @word = \"~#{w}\" # Assimilate!\n @length = @word.length - 1 # Do not count the ~.\n @back = Array.new\n @back << 0 \n @back << 0\n s = 0\n (2..@length).each do |i|\n s = step(s,@word[i - 1])\n @back << s\n end\n end",
"def inflate\n end",
"def ITD04=(arg)",
"def preformatting\n\n end",
"def initialize() end",
"def encode_begin(state)\n @dictionary = state.buf.split(//).sort.uniq.shuffle.join\n end",
"def sb(t, s, c)\n\n end",
"def preprocess(input); end",
"def initialize(at_init)\n @at_init = at_init.to_s # quelquefois, on envoie un nombre (annulation)\n parse\n end",
"def to_s\n str = super\n case (str.size + 2) % 8\n when 0\n return str\n when 7\n # only on byte needed: use pad1 option\n self << Pad1.new\n str << [0].pack('C')\n else\n # use padn option\n len = 8 - 2 - (str.size % 8) - 2\n padn = Option.new(type: 'padn', value: \"\\x00\" * len)\n self << padn\n str << padn.to_s\n end\n str\n end",
"def make_tnt_input(seq_arr)\n seq_arr_length = seq_arr[0][:seq].length()\n retstr = \"xread\\n#{seq_arr_length} 49\\n\"\n seq_arr.each { |sa| retstr << \"#{sa[:genus]} #{sa[:seq]}\\n\" }\n retstr << \";\\n\"\nend",
"def herebody_s=(_arg0); end",
"def compilereturn\n\n end",
"def pan_body()\n self.zip((?a..?z).to_a).collect do |n, c|\n sprintf(\" %s%s %c%s\", \\\n (c==?z ? \"and \" : \"\"), \\\n n.to_en, c, \\\n (n>1) ? \"'s\" : \"\")\n end\n end",
"def AMT01=(arg)",
"def serial=(_arg0); end",
"def AMT02=(arg)",
"def pack tl, tm, th, ch, cl, n\nraw = [tl, tm, th, ch, cl, n].pack \"NnnCCa6\"\nret = new raw\nret.freeze\nret\nend",
"def dump\n zeroes = ZEROBYTE * 32\n raw = ZEROBYTE * ID3::ID3v1tagSize\n raw[0..2] = 'TAG'\n\n self.each{ |key,value|\n\n range = ID3::Symbol2framename['1.1'][key]\n\n if range.class == Range \n length = range.last - range.first + 1\n paddedstring = value + zeroes\n raw[range] = paddedstring[0..length-1]\n elsif range.class == Fixnum\n raw[range] = value.to_i.chr # supposedly assigning a binary integer value to the location in the string\n else\n # this can't happen the way we defined the hash..\n next\n end\n }\n\n return raw\n end",
"def sequence_separator=(_arg0); end",
"def sequence_separator=(_arg0); end",
"def marshallMsg\n msgstr = String.new(@istr) \n @@cmdSeqNo = @@cmdSeqNo + 1\n seqstr = to_s_i(@@cmdSeqNo)\n msgstr[0] = seqstr[0]\n msgstr[1] = seqstr[1]\n msgstr[2] = seqstr[2]\n msgstr[3] = seqstr[3]\n t = Time.now\n timestr = to_s_i(t.to_i)\n msgstr = msgstr + timestr \n msgstr[8] = @pktFormat\n msgstr[9] = 0\n msgstr[10] = @cmd\n msgstr[11] = 0\n ipstr = to_s_i(@myIp)\n msgstr = msgstr + ipstr \n msgstr = msgstr + @version\n msgstr[18] = @nodeType\n msgstr[19] = 0\n msgstr = msgstr + @cmStatus.to_s\n msgstr = msgstr + @mac11.to_s \n msgstr = msgstr + @mac12.to_s\n msgstr = msgstr + @mac13.to_s \n msgstr = msgstr + @mac14.to_s\n\n return msgstr\n end",
"def ITD02=(arg)",
"def initialize(p1,p2)\n ori_init\n push p1\n push p2\n self[0].id = 0\n self[0].mark_markup = $glob.x_markup\n self[1].id = 1\n self[1].mark_markup = $glob.o_markup \n @act_p = self[0]\n end",
"def initialize (phrase_to_encode=\"\")\n\t\t@starting_phrase = phrase_content(phrase_to_encode)\n\t\t@one_time_phrase = \"\"\n\t\t@encrypted_message = \"\"\n\tend",
"def init\n if super\n @offset = 0\n @sg = ITALY\n self\n end\n end",
"def makeInitStringWithInstanceVars\n str=\"\"\n (0..self.class.paramNames.length-1).each {|i|\n if (i>0)\n str+=\"; \"\n end\n pStr = \"@\" + self.class.paramNames[i]\n valStr = @paramVals[i].to_s\n if hasUnits(i) \n valStr = UnitUtils.convertNumString(valStr)\n end\n str += pStr + \"=\" + valStr\n }\n return str\n end",
"def ITD12=(arg)",
"def init_separator(hash)\n end",
"def initMatrix(a)\n\t\tfor i in 0..5\n\t\tcolumn = []\n\t\ta[i] = column\n\t\t\tfor j in 0..5\n\t\t\tcolumn[j] = \" \"\n\t\t\tend\n\t\tend\n\treturn a\t\n\tend",
"def to_prepare(&blk); end",
"def malts; end",
"def init_data\n end",
"def content=(_arg0); end"
] |
[
"0.56415665",
"0.55726504",
"0.54921144",
"0.547879",
"0.5465153",
"0.54463214",
"0.5415224",
"0.54039025",
"0.53972965",
"0.53878456",
"0.5378107",
"0.53609616",
"0.53578717",
"0.53529555",
"0.5344296",
"0.53322005",
"0.53272355",
"0.5301774",
"0.52455276",
"0.5243467",
"0.5241259",
"0.5241259",
"0.5241259",
"0.5241259",
"0.52352697",
"0.51954234",
"0.5182954",
"0.51796687",
"0.51368445",
"0.51368445",
"0.51362485",
"0.51362485",
"0.5135385",
"0.5135385",
"0.5135385",
"0.5135385",
"0.5135385",
"0.51309603",
"0.5122674",
"0.51138777",
"0.5113074",
"0.5102485",
"0.509654",
"0.50958365",
"0.5089832",
"0.50786585",
"0.5070803",
"0.5066175",
"0.5064923",
"0.50648266",
"0.50648266",
"0.50640786",
"0.5061906",
"0.5048973",
"0.50362086",
"0.5035707",
"0.5035707",
"0.5035258",
"0.50221163",
"0.5018626",
"0.5018626",
"0.5018305",
"0.50056064",
"0.5005199",
"0.5002361",
"0.49999547",
"0.49910665",
"0.49852726",
"0.49846867",
"0.49846599",
"0.4983819",
"0.4982243",
"0.49760064",
"0.49747193",
"0.49714854",
"0.49695292",
"0.49688017",
"0.49593073",
"0.49556476",
"0.4949482",
"0.49446467",
"0.49442545",
"0.49423575",
"0.49301004",
"0.49289998",
"0.4928101",
"0.49258837",
"0.49258837",
"0.4925861",
"0.4920396",
"0.4919284",
"0.4917028",
"0.4912696",
"0.49115855",
"0.4911557",
"0.49106035",
"0.49050248",
"0.49027023",
"0.49025202",
"0.49003634",
"0.48969483"
] |
0.0
|
-1
|
Returns true or false if the user is logged in.
|
def logged_in?
!!current_user
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end",
"def logged_in?\n user._logged_in?\n end",
"def logged_in?\n if session[:username]\n if session[:logged_in?]\n return true\n end\n else\n return false\n end\n end",
"def logged_in?\n if !session[:user_id].nil?\n return true\n else\n return false\n end\n end",
"def logged_in?\n (current_user ? login_access : false).is_a?(User)\n end",
"def logged_in?\n if current_user\n true\n else\n false\n end\n end",
"def logged_in?\n !!logged_user\n end",
"def logged_in?\n current_user.present?\n end",
"def logged_in?\n current_user != :false\n end",
"def logged_in?\n current_user != :false\n end",
"def logged_in?\n return false unless session[:user_id]\n\n User.find_by_id(session[:user_id]).present?\n end",
"def user_is_logged_in?\n !!session[:user_id]\n end",
"def loggedin?\n @session.nil? ? false : (return true)\n end",
"def logged_in?\n return true if self.current_user\n return false\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n\t\t\tcurrent_user.is_a? User\n\t\tend",
"def logged_in?\n @logged_in == true\n end",
"def logged_in?\n @logged_in == true\n end",
"def logged_in?\r\n current_user != :false\r\n end",
"def logged_in?()\n if session[:user_id]\n return true\n else \n return false\n end\n end",
"def logged_in?\n if current_user\n true\n else \n false\n end\n end",
"def logged_in?\n\t\tif not current_user.present? then redirect_to \"/unauthorized\" and return false\n\t\tend\n\t\treturn true\n\tend",
"def logged_in?\n return false unless @auth_header\n true\n end",
"def logged_in?\n current_user != :false \n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n\n if session[:current_user_id]\n return true\n end\n \n #Default return false\n false\n \n end",
"def logged_in?\n\t\tcurrent_user.present?\n\tend",
"def logged_in?\n current_user ? true : false;\n end",
"def is_logged_in_user?\n session[:user_authenticated]\n end",
"def logged_in?\n return session['current_user']\n end",
"def logged_in?\n !!logged_in_user \n end",
"def logged_in?\n\t\t !!current_user\n end",
"def is_logged_in?\n return true if current_user || current_admin\n end",
"def is_logged_in?\n\t\t!session[:user_id].nil?\n\tend",
"def logged_in?\r\n\t\t!current_user.nil?\r\n\tend",
"def logged_in?\n @logged_in ? true : false\n end",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n current_user.present? # True neu user login\n end",
"def logged_in?\n current_user\n end",
"def logged_in?\n current_user\n end",
"def logged_in?\n #boolean return\t\n \tcurrent_user != nil\n end",
"def logged_in?\n current_user != nil ? true : false\n end",
"def user_is_logged_in?\n !!session[:user_id]\n end",
"def is_logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n !!current_ma_user\n end",
"def logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n ## to query if the logged in, call the current_user with !! preceeded, this turns it to true or false\n # TRUE or FALSE\n !!current_user\n end",
"def logged_in?\n current_user_id.to_i > 0\n end",
"def logged_in?\n !current_user.nil?\n end",
"def logged_in?\n !current_user.nil?\n end",
"def logged_in?\n # !! turns this into a boolean, so we DON'T get nil\n !!session[:user_id]\n end",
"def logged_in?\n \t\t!current_user.nil?\n \tend",
"def logged_in?\n\t\t!current_user.nil?\n \tend",
"def logged_in?\n\t\t#if currentuser.nil returns true then logedin is false\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n !!session[:user_id]\n # !!@current_user\n end",
"def is_user_logged_in?\n\tlogged_in = false\n\t if logged_in\n then true\n else\n redirect_to root_path\n end\n end",
"def logged_in?\n current_user.is_a? User\n end",
"def logged_in?\n !!session[:logged_in]\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !current_user.blank?\n end",
"def logged_in?\n return session[:user_id].present?\n end",
"def user_logged_in?\n current_user.present?\n end"
] |
[
"0.8973362",
"0.8775968",
"0.8709158",
"0.8675256",
"0.8641435",
"0.8633322",
"0.86329544",
"0.8615168",
"0.86115885",
"0.86115885",
"0.86064714",
"0.8586828",
"0.858408",
"0.8578593",
"0.8565856",
"0.8565856",
"0.85308635",
"0.8526328",
"0.8526328",
"0.85232234",
"0.851801",
"0.8506504",
"0.85032964",
"0.8503188",
"0.8495474",
"0.847579",
"0.847579",
"0.847579",
"0.847579",
"0.8472619",
"0.8465027",
"0.84630007",
"0.8458446",
"0.84508294",
"0.8435577",
"0.84337825",
"0.8428179",
"0.8424114",
"0.8422321",
"0.8421938",
"0.8407338",
"0.84067625",
"0.84059817",
"0.84059817",
"0.84059817",
"0.84059817",
"0.84059817",
"0.84059817",
"0.84059817",
"0.84059817",
"0.84059817",
"0.84059817",
"0.84059817",
"0.84059817",
"0.84059817",
"0.84059817",
"0.84059817",
"0.84059817",
"0.84059817",
"0.84059817",
"0.84059817",
"0.84020096",
"0.8397121",
"0.8397121",
"0.83946115",
"0.83927",
"0.8391748",
"0.8390438",
"0.838675",
"0.83795357",
"0.83795357",
"0.83795357",
"0.83795357",
"0.8379096",
"0.8371072",
"0.83710283",
"0.83710283",
"0.836797",
"0.83674544",
"0.83611155",
"0.8353876",
"0.8352517",
"0.8351219",
"0.83482736",
"0.8347065",
"0.83427554",
"0.83427554",
"0.83427554",
"0.83427554",
"0.834271",
"0.8337922",
"0.8336324"
] |
0.84752476
|
36
|
Accesses the current user from the session. Future calls avoid the database because nil is not equal to false.
|
def current_user
@current_user ||= login_from_session unless @current_user == false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def user\n return nil if !session[:user]\n @user ||= fetch_user(session[:user])\n end",
"def user\n return nil if !session[:user]\n @user ||= fetch_user(session[:user])\n end",
"def user\n return nil if !session[:user]\n @user ||= fetch_user(session[:user])\n end",
"def current_user\n # if current_user is et use it otherwise ask the data store\n @current_user ||= User.find_by(id: session[:user_id])\n end",
"def current_user\n # If current_user is set, otherwise ask the data store.\n @current_user ||= User.find_by(id: session[:user_id])\n end",
"def current_user\n\t\t @current_user ||= (login_from_session) unless @current_user == false\n end",
"def current_user\n\t\t@current_user ||= (login_from_session) unless @current_user == false\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id] \n #this code will return nil rather than throwing an exception. \n #'||=' memoization technique is a minor performance optimization.\n #if @current_user exist, do not run the code after '||=' else do so, ensuring we will hit database once. \n end",
"def get_current_user\n unless session[:user_id]\n @current_user = nil\n return\n end\n @current_user = User.first(:conditions => {:id => session[:user_id] })\n end",
"def current_user\n return nil unless session[:user_id]\n User.get(session[:user_id])\nend",
"def current_user\n load_session\n @current_user\n end",
"def current_user\n if session[:user_id]\n @current_user = User.find(session[:user_id])\n @current_user\n else\n false\n end\n end",
"def current_user\n @current_user ||=User.find(session[:user_id]) if session[:user_id] # memoization\n end",
"def current_user\n return @current_user if @current_user.present?\n\n session_user_id = session[:user_id]\n @current_user = if session_user_id.present?\n User.find_by(id: session_user_id) || AdminUser.find_by(id: session_user_id)\n end\n end",
"def current_user\n @current_user ||= User.find_by(id: session[:user_id]) # guarda o resultado em @current_user pra nao ter que \n # consultar o banco de dados toda vez que quiser achar o usuario atual\n end",
"def current_user\n #@current_user ||= Rails.cache.fetch(\"users/#{session[:user_id]}\", :force => (params[:force_session_reload] != nil)) { User.find_by_id(session[:user_id]) }\n @current_user ||= User.find_by_id(session[:user_id])\n end",
"def fetch_user\n @current_user = User.find_by(:id => session[:user_id]) if session[:user_id]\n\n session[:user_id] = nil unless @current_user.present?\n end",
"def current_user\n return unless session[:user_id]\n @current_user = User.find_by_id(session[:user_id])\n end",
"def current_user\n #||= means that the operation on the right will be called only the first time, so after the variable has\n # a value it returns current_user without calling the operation on the right.\n #if session[:user_id] was created in the session controller CREATE action, we find the user by its id and\n # add it to the @current_user variable.\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n @_current_user ||= session[:user_id] && User.find(session[:user_id])\n end",
"def get_current_user\n unless session[:user_id].blank?\n @current_user = User.find(session[:user_id])\n else\n @current_user = nil\n end\n end",
"def current_user\n @user = User.find(@session.user_id)\n end",
"def current_user\r\n @_current_user ||= session[:user_id] && User.find(session[:user_id])\r\n end",
"def current_user # Check the current user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n #memoization\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n rescue ActiveRecord::RecordNotFound\n session.delete(:user_id)\n @current_user = nil\n end",
"def current_user\n # @current_user = @current_user || User.find(session[:user_id]) if session[:user_id] # the || and @current_user are usd to store the instance of the current user and avoid repeated calls to the db, except when @current user is falls. \n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end",
"def get_user_from_session\n authorize()\n @user = @current_user\n end",
"def current_user\n if session[:user_id]\n @current_user = User.find(session[:user_id])\n @current_user\n else\n false\n end\n end",
"def current_user\n # retrieve from database on every request instead of\n # storing it as global variable when current_user=\n # is called to prevent user information becoming stale.\n @current_user ||= (session[:user_name] && User.find_by(user_name: session[:user_name])) || real_user\n end",
"def fetch_user\n\n # Check if user_id in the session is the id of a real user in our db. If it is, we will get the user object in @current_user; if not, we will get nil\n if session[:user_id].present?\n @current_user = User.find_by id: session[:user_id]\n end\n\n # If we did get nil from the above query, delete the session because the user_id is stale (invalid)\n if @current_user.nil?\n session[:user_id] = nil # unless @current_user.present?\n end\n\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id] # ||= means if not, here means if there is no current user logged in, do the following\n end",
"def get_current_user\n if @current_user\n return @current_user\n else\n @current_user = User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @current_user = User.find(session[:user_id])\n else\n false\n end\n end",
"def current_user\n if session[:user_id]\n @current_user = Account.find(session[:user_id])\n @current_user\n else\n false\n end\n end",
"def current_user\n return @current_user_cached unless @current_user_cached.blank?\n\n @current_user_cached = \n if !session[:rbac_user_id].blank?\n User.find(session[:rbac_user_id])\n else\n nil\n end\n return @current_user_cached\n rescue\n # puts \"def current_user RESCUE #{session[:rbac_user_id]}\"\n remove_current_user\n redirect_to login_path\n end",
"def current_user_session\n \treturn @current_user_session if defined? @current_user_session\n \t@current_user_session = without_access_control { UserSession.find }\n end",
"def current_user\n\t\t# checks to see if session exists, if so, loads user\n\t\t# and saves into @user instance variable\n\t\t@current_user ||= User.find(session[:user_id]) if session[:user_id]\n\tend",
"def current_user\n if session[:user_id] && !User.where(id: session[:user_id]).empty?\n @current_user = User.find(session[:user_id])\n else\n log_out\n end\n end",
"def current_user\n return nil unless session[:user_id] \n @current_user ||= User.find(session[:user_id])\n end",
"def current_user #used in many methods to pull in the current user stored in sessions. \n \tUser.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n return @current_user if @current_user\n @current_user = UserFactory.resource.find(session[Casual.session_key])\n \n # If user is not active, unset session\n if UserFactory.user_not_active(@current_user)\n @current_user = nil \n session[Casual.session_key] = nil\n end\n \n @current_user\n end",
"def current_user\n if session[:user_id] # if there is a session id, the current user is the one whose session id is the same as the user id \n @current_user ||= User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n @_current_user ||= User.find(session[:user_id])\n end",
"def current_user\n\t\tif session[:user_id]\n\t\t @current_user = User.find(session[:user_id])\n\t\telse\n\t\t @current_user = nil\n\t\tend\n\t\t @current_user\n end",
"def current_user\n # retrieve from database on every request instead of \n # storing it as global variable when current_user= \n # is called to prevent user information becoming stale.\n @current_user ||= (session[:uid] && User.find_by_id(session[:uid])) || nil\n end",
"def current_user\n @_current_user ||= session[:current_user_id] &&\n User.find_by(id: session[:current_user_id])\n end",
"def current_user\n @_current_user ||= session[:current_user_id] &&\n User.find_by(id: session[:current_user_id])\n end",
"def current_user\n @user = User.find_by(id: session[:user_id])\n end",
"def current_user\n return unless session[:user_id]\n User.find(session[:user_id])\n end",
"def current_user\n if @current_user.nil?\n @current_user = User.find_by(id: session[:user_id])\n else\n @current_user\n end\n end",
"def current_user\n @user ||= User.find_by(id: session[:user_id])\n end",
"def current_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end",
"def current_user\n\t@current_user = User.find(session[:user_id]) if session[:user_id]\nend",
"def current_user\n if session[:user_id]\n user = User.find(session[:user_id])\n else\n nil\n end\n end",
"def current_user\n @_current ||= User.find_by(id: session[:user_id])\n end",
"def current_user\n @current_user = User.find_by_id(session[:user_id]) # Use find_by_id to get nil instead of an error if user doesn't exist\n end",
"def current_user\n @_current_user ||= session[:current_user_id] &&\n User.find(session[:current_user_id])\n end",
"def current_user\n if session[:user_id].present?\n @current_user = User.find_by(uid: session[:user_id])\n # session.clear if @current_user.nil?\n return @current_user\n end\n end",
"def current_user\n @current_user || = User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n # retrieve from database on every request instead of\n # storing it as global variable when current_user=\n # is called to prevent user information becoming stale.\n @current_user ||= (session[:uid] && User.find_by_id(session[:uid])) || nil\n end",
"def current_user\n # set instance variable to either nil (if session[:user_id] is nil)\n # or to the user with that id\n @current_user ||= session[:user_id] && User.find_by_id(session[:user_id])\n end",
"def current_user\n user = User.find_by(id: session[:user_id])\n end",
"def current_user\n # User.find would throw an error if we cannot find the user\n User.find_by({ id: session[:user_id] })\n end",
"def current_user\t\n\treturn unless session[:user_id]\n\t@current_user ||= User.find_by_id(session[:user_id])\n end",
"def current_user\n\tif session[:user_id].present?\n\t\tUser.find(session[:user_id])\t\n\tend\nend",
"def current_user\n return @current_user if defined?(@current_user)\n @current_user = current_user_session && current_user_session.user\n end",
"def current_user\n return @current_user if defined?(@current_user)\n @current_user = User.find_by_id(session[:user_id])\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n #return current user or set to this if there isnt a current user\n end",
"def current_user\n\t\tif !@current_user\n\t\t\t@current_user = User.find_by(id: session[:user_id])\n\t\tend\n\t\t@current_user\n\tend",
"def current_user\n @current_user ||= User.find_by(uid: session[:user_uid])\n end",
"def current_user\n @current_user ||= User.find_by(uid: session[:user_uid])\n end",
"def current_user\n if valid_session?\n User.find(session[:user_id])\n end\n end",
"def current_user( user = :get )\n if( user == :get )\n session[:user] ||= guest_account\n else\n session[:user] = user\n end\n end",
"def current_user\n if logged_in?\n session[:user] = nil\n return temporary_logged_in_user ? temporary_logged_in_user :\n set_temporary_logged_in_user(cached_user)\n else\n session[:user] ||= create_new_user # if there wasn't one\n session[:user] = create_new_user unless session[:user].respond_to?(:stale?)\n session[:user] = create_new_user if session[:user].stale?\n return session[:user]\n end\n end",
"def current_user\n begin\n unless @current_user.nil?\n return @current_user\n else\n if session[:user_id]\n return @current_user = User.find(session[:user_id])\n else\n return nil\n end\n end\n rescue\n return nil\n end\nend",
"def current_user\n# if there is a current user rtn that if not then rtn nil\n@current_user ||= User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n return @current_user if @current_user.present?\n\n #Check user exist?\n if session[:user_id].present?\n #Get session user\n @current_user = User.find(session[:user_id])\n else\n @current_user = User.generate\n session[:user_id] = @current_user.id\n @current_user\n end\n\n end",
"def current_user\n @current_user ||= user_session && user_session.user\n end",
"def current_user\n @_current_user ||= session[:current_user_id] &&\n User.find_by_id(session[:current_user_id])\n end",
"def current_user\n @_current_user ||= session[:current_user_id] &&\n User.find_by_id(session[:current_user_id])\n end",
"def current_user\n @_current_user ||= session[:current_user_id] &&\n User.find_by_id(session[:current_user_id])\n end",
"def current_user\n @current_user = User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n session[:user_id]\n User.find_by(id: session[:user_id])\n # @current_user ||= User.find_by(id: session[:user_id])\n end",
"def current_user\n if @current_user.nil?\n @current_user = User.find(session[:user_id]) if session[:user_id]\n end\n end",
"def current_user\n\t\tif session[:user_id].present?\n\t\t\tUser.find(session[:user_id])\n\t\tend\n\tend",
"def current_user\n @user = User.find(session[:user_id])\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n # ||= is used for memoization of @current_user variable\n end",
"def current_user\n @user ||= User.find_by(id: session[:user_id]) if session[:user_id]\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.first(:id => session[:user_id])\n end",
"def current_user\n\tsession[:user_id] ? User.find(session[:user_id]) : nil\nend",
"def current_user\n\tsession[:user_id] ? User.find(session[:user_id]) : nil\nend",
"def current_user\n User.get_user(session[:user_id]) if session[:user_id]\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find(session[:user_id]) \n else \n @current_user = nil\n end \n return @current_user\n end",
"def current_user\n return @current_user if defined?(@current_user)\n @current_user = current_user_session && current_user_session.record\n end",
"def current_user\n @current_user||= User.find(session[:user_id]) if session[:user_id]\n\n #here User.find(session[:user_id]) this will fetch the user based on the active session's user_id \n #as the above line will hit the database numerous time. We don't want that so to restrict it we created a local variable to store the user once find\n #|| this pipeline symbol is for checking \nend",
"def current_user\n if @current_user.nil?\n if remember_token = session[:remember_token]\n @current_user = User.find_by_remember_token(remember_token)\n # run_after_signin if @current_user\n end\n\n @current_user ||= false\n end\n \n @current_user || nil\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end",
"def current_user\n @_current_user ||= session[:current_user_id] &&\n User.find_by(id: session[:current_user_id])\n end"
] |
[
"0.7964859",
"0.7964859",
"0.7964859",
"0.79274297",
"0.79269207",
"0.79119223",
"0.7894338",
"0.7890374",
"0.7885992",
"0.78757757",
"0.78721076",
"0.7864955",
"0.7859212",
"0.78524804",
"0.7850172",
"0.7841541",
"0.7833592",
"0.7831202",
"0.78277004",
"0.7819963",
"0.7817971",
"0.78106034",
"0.78096193",
"0.7809377",
"0.78090984",
"0.78009",
"0.7796612",
"0.7795905",
"0.77929866",
"0.7786379",
"0.77811855",
"0.7780011",
"0.77653134",
"0.7763969",
"0.77555895",
"0.7754922",
"0.7754367",
"0.77532333",
"0.77522296",
"0.7750623",
"0.7748946",
"0.7748071",
"0.77477205",
"0.7747231",
"0.77460575",
"0.77442133",
"0.77442133",
"0.7740955",
"0.774022",
"0.7735296",
"0.7733944",
"0.7733657",
"0.7733657",
"0.77329516",
"0.7732528",
"0.7730848",
"0.7729879",
"0.77289873",
"0.77276015",
"0.7723046",
"0.77201355",
"0.77169937",
"0.7715868",
"0.7715315",
"0.7714879",
"0.7711263",
"0.77089286",
"0.7707752",
"0.77074504",
"0.7704406",
"0.7702361",
"0.7702361",
"0.7700389",
"0.77003646",
"0.76971835",
"0.7696878",
"0.7694931",
"0.76941216",
"0.76940125",
"0.7690281",
"0.7690281",
"0.7690281",
"0.76900476",
"0.7688463",
"0.7686509",
"0.7686057",
"0.76846826",
"0.7684022",
"0.76837695",
"0.7682832",
"0.76816607",
"0.76816607",
"0.76816154",
"0.7679922",
"0.7679664",
"0.7676308",
"0.7676122",
"0.76752687",
"0.76752687",
"0.76744264"
] |
0.7840912
|
16
|
Called from current_user. First attempt to login by the user id stored in the session.
|
def login_from_session
self.current_user = User.find_by_id(session[:user_id]) if session[:user_id]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def login_from_session\n self.current_user = User.find(session[:user_id]) if session[:user_id]\n end",
"def login_from_session\n self.current_user = User.find(session[:user_id]) if session[:user_id]\n end",
"def login_from_session\n self.current_user = User.find_by_id( session[ :user_id ] ) if session[ :user_id ]\n end",
"def login_from_session\n self.current_user = User.find_by_id(session[:user_id]) if session[:user_id]\n end",
"def login_from_session\n self.current_user = User.find(session[:user_id]) if session[:user_id]\n end",
"def login_from_session\nself.current_user = User.find_by_id(session[:user_id]) if session[:user_id]\nend",
"def login\n\t\tif @current_user != nil\n\t\t\tredirect_to user_path(@current_user.id)\n\t\tend\n\tend",
"def try_login\n if user = http_auth_login || validation_login || remember_me_login\n session[:uid] = user.id\n end\n end",
"def login_from_session\n self.current_ma_user = MA[:user].find_with_conditions(:id => session[MA[:single_resource]]) if session[MA[:single_resource]]\n end",
"def login!\n session[:user_id] = @user.id\n end",
"def login_user(user)\n session[:current_user_id] = user.id\n end",
"def login(user)\n session[:user_id] = user.try(:id)\n @current_user = user\n end",
"def login_from_session\n self.current_employee = Employee.find_by_id(session[:employee_id]) if session[:employee_id]\n end",
"def login( user )\n session[:user_id] = user ? user.id : nil\n end",
"def login_as(user)\n session[:user_id] = user.id\n end",
"def autologin_the_user\n #unless logged_in?\n # FrontendUserSession.create(params[:frontend_user_session])\n #end\n end",
"def login!(user)\n user.reset_session_token!\n # curr_session_token == user.session_token\n # sets user.curr_session_token and persists to UserSessionsOwnership table\n user.set_curr_session_token\n @current_user = user # set current_user upon login\n # session[:session_token] = user.session_token\n session[:session_token] = user.curr_session_token\n end",
"def session_login\n @current_user = User.find(session[:user_id])\n rescue ActiveRecord::RecordNotFound\n return false\n end",
"def login_user\n session[:user_id] = @user.id\n end",
"def login(user)\n session[:user_id] = user.id\n end",
"def login user\n session[:user_id] = user.id\n end",
"def set_current_user\n # we exploit the fact that find_by_id(nil) returns nil\n @current_user ||= User.find_by_id(session[:user_id])\n redirect_to '/login' and return unless @current_user\n end",
"def login!(session)\n\t\tsession[:user_id] = id\n\tend",
"def login_as(user)\n @request.session[:user] = user ? users(user).id : nil\n end",
"def login!(session)\n session[:user_id] = self.id\n end",
"def login_user\n\t @user_session = UserSession.new\t \n\tend",
"def login_as(user)\n session[:user_id] = users(user).id\n end",
"def log_in(user)\n reset_session\n set_user_id_in_session(user.id)\n # Guard against session replay attacks\n session[:session_token] = user.session_token\n end",
"def login_as(id)\n session['email'] = User.find(id).email\n build_user\n end",
"def login(user)\n \tsession[:user_id] = user.id\n end",
"def login_from_session\n self.current_<%= singular_name %> = <%= class_name %>.find_authenticated_model_with_id(session[:<%= singular_name %>]) if session[:<%= singular_name %>]\n end",
"def login(user)\n session[:user_id] = user.id\n end",
"def try_to_login\n User.login(self.name, self.password)\n end",
"def login\n session[:user_id] = nil\n end",
"def login_user(user = gen_user)\n session[:user_id] = user.id\n return user\n end",
"def check_login\n if (current_user.blank? or current_user.username.blank?) and !session[:user_id].blank? \n logger.error(\"logout occurred\")\n session[:user_id] = nil\n elsif session[:user_id].blank? and !current_user_model.blank? and !current_user.blank? \n session[:user_id] = current_user_model.id\n session[:user_id] = '1' if session[:user_id].blank?\n logger.error(\"login occurred\")\n log_request('login')\n end\n end",
"def login\n @user = User.find_or_create_from_auth_hash(auth_hash)\n @user_name = @user.display_name\n\n session[:current_user_id] = @user.id\n\n render :login, :layout => false\n end",
"def auto_login(user, should_remember = false)\n session[:user_id] = user.id.to_s\n @current_user = user\n remember_me! if should_remember\n end",
"def login_user!(user)\n user.reset_session_token!\n session[:session_token] = user.session_token\n end",
"def login_required\n unless session[:user_id].present?\n redirect_to login_user_index_path\n end\n end",
"def login user\n @request.session[:user_id] = user.id\n @controller.instance_variable_set('@current_user', user)\n end",
"def login!(user, options = {})\n session[:session_token] = user.persistence_token\n session[:active_at] = Time.now\n @current_user = user\n end",
"def login_as(user)\n @request.session[:user_id] = user.id\n end",
"def login\n user = User.find_by(psid: params[:id])\n session[:user_id] = user.id if user.present?\n redirect_to(session[:target_page] || root_path)\n end",
"def login\n session[:job_id] = nil\n\n # external auth has been done, skip markus authorization\n if Settings.remote_user_auth\n if @markus_auth_remote_user.nil?\n render 'shared/http_status', formats: [:html], locals: { code: '403', message: HttpStatusHelper::ERROR_CODE['message']['403'] }, status: 403, layout: false\n return\n else\n login_success, login_error = login_without_authentication(@markus_auth_remote_user)\n if login_success\n uri = session[:redirect_uri]\n session[:redirect_uri] = nil\n refresh_timeout\n # redirect to last visited page or to main page\n redirect_to( uri || { action: 'index' } )\n return\n else\n render :remote_user_auth_login_fail, locals: { login_error: login_error }\n return\n end\n end\n end\n\n # Check if it's the user's first visit this session\n # Need to accommodate redirects for locale\n if params.key?(:locale)\n if session[:first_visit].nil?\n @first_visit = true\n session[:first_visit] = 'false'\n else\n @first_visit = false\n end\n end\n\n @current_user = current_user\n # redirect to main page if user is already logged in.\n if logged_in? && !request.post?\n redirect_to action: 'index'\n return\n end\n return unless request.post?\n\n # strip username\n params[:user_login].strip!\n\n # Get information of the user that is trying to login if his or her\n # authentication is valid\n validation_result = validate_user(params[:user_login], params[:user_login], params[:user_password])\n unless validation_result[:error].nil?\n flash_now(:error, validation_result[:error])\n render :login, locals: { user_login: params[:user_login] }\n return\n end\n # validation worked\n found_user = validation_result[:user]\n if found_user.nil?\n return\n end\n\n # Has this student been hidden?\n if found_user.student? && found_user.hidden\n flash_now(:error, I18n.t('main.account_disabled'))\n redirect_to(action: 'login') && return\n end\n\n self.current_user = found_user\n\n if logged_in?\n uri = session[:redirect_uri]\n session[:redirect_uri] = nil\n refresh_timeout\n # redirect to last visited page or to main page\n redirect_to( uri || { action: 'index' } )\n else\n flash_now(:error, I18n.t('main.login_failed'))\n end\n end",
"def logged_in\n if current_user == nil\n redirect_to new_user_session_path\n end\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def login_attempt\n @user = User.where(email: params[:email]).first\n if @user && @user.password == params[:password]\n session[:user_id] = @user.id\n\n redirect_to root_path\n else\n flash[:notice] = \"Invalid Username or Password\"\n\n render \"login\"\n end\n end",
"def login_as(user)\n @request.session[:user_id] = user ? users(user).id : nil\n @request.session[:online_at] = Time.now.utc\n end",
"def login\n\t\tuser = User.find_by_userid(params[:session][:userid])\n\t\tif user && user.authenticate(params[:session][:password])\n\t\t\tsession[:remember_token] = user.id\n\t\t\tsession[:last_seen] = Time.now\n\t\t\tif user.authorizationlevel == 1\n\t\t\t\tredirect_to '/documents'\n\t\t\telsif user.authorizationlevel == 2\n\t\t\t\tredirect_to '/documents'\n\t\t\telsif user.authorizationlevel > 2\n\t\t\t\tredirect_to '/documents'\n\t\t\telse\n\t\t\t\tredirect_to '/'\n\t\t\tend\n\t\telse\n\t\t\tflash[:error] = 'Invalid Login'\n\t\t\tredirect_to '/sessions'\n\t\tend\n\tend",
"def log_in(user_id)\n session[:user_id] = user_id\n end",
"def login\n if request.get?\n session[:user_id] = nil\n else\n # Try to get the user with the supplied username and password\n logged_in_user = User.login(params[:user][:name], params[:login][:password])\n\n # Create the session and redirect\n unless logged_in_user.blank?\n session[:user_id] = logged_in_user.id\n jumpto = session[:jumpto] || root_path\n session[:jumpto] = nil\n redirect_to(jumpto)\n else\n flash.now[:login_error] = 'Invalid username or password.'\n end\n end\n end",
"def logged_in\n if current_user == nil\n redirect_to new_user_session_path\n end\n end",
"def login_as(user)\n if String === user\n id = users(user).id\n elsif User === user\n id = user.id\n end\n\n @request.session[:user_id] = id || nil\n end",
"def login!(session)\n session[:pd_user_id] = self.id\n end",
"def attempt_login\n if params[:username].present? && params[:password].present?\n found_user = User.where(:username => params[:username]).first #this will return the first record\n if found_user\n authorized_user= found_user.authenticate(params[:password])\n end\n end\n if authorized_user\n # reset_session if session[:last_seen] < 1.minutes.ago\n #session[:last_seen] = Time.now\n cookies[:user_id]=authorized_user.id\n #cookies[:user_id]={:expires=>1.minute.from_now}\n cookies[:user_name]=authorized_user.username\n cookies[:hotel_id_for_login_user]=authorized_user.hotel_id\n flash[:notice]=\"You are now logged in.\"\n redirect_to(:action=>'index')\n else\n # session[:last_seen] = Time.now\n flash[:notice]=\"Invalid username/password combination.\" \n redirect_to(:controller=>'homepage',:action=>'login') \nend\nend",
"def login!(session)\n session[:user_id] = id\n end",
"def login!(session)\n session[:user_id] = id\n end",
"def login\n make_login_call\n end",
"def login(user)\n request.session[:uid] = user.id\n end",
"def login\r\n if request.get?\r\n # Logout user\r\n self.logged_in_user = nil\r\n else\r\n # Authenticate user\r\n user = User.try_to_login(params[:login], params[:password])\r\n if user\r\n self.logged_in_user = user\r\n # user.update_attribute(:ip_last, request.remote_ip)\r\n journal(\"log_in\",user.id)\r\n # generate a key and set cookie if autologin\r\n if params[:autologin] && Setting.autologin?\r\n token = Token.create(:user => user, :action => 'autologin')\r\n cookies[:autologin] = { :value => token.value, :expires => 1.year.from_now }\r\n end\r\n puts \"aqui\"\r\n if user.show? \r\n puts \"1\"\r\n redirect_back_or_default :controller => 'my', :action => 'athletes'\r\n else \r\n puts \"2\" \r\n redirect_back_or_default :controller => 'my', :action => 'page'\r\n end\r\n else\r\n # if user.locked?\r\n # flash.now[:notice] = l(:status_locked)\r\n # else\r\n flash.now[:notice] = l(:notice_account_invalid_creditentials)\r\n # end\r\n journal(\"invalid-\"+params[:login]+\"-\"+params[:password],0)\r\n end\r\n end\r\n end",
"def user_log_in(user)\n session[:user_id] = user.id\n end",
"def log_in_as(user)\n session[:user_id] = user.id\n end",
"def authenticate\n unless session[:user_id]\n session['return_url'] = request.url\n logger.debug request.url\n # Recreate user abilities on each login\n @current_ability = nil\n redirect_to polymorphic_url(:new_user_session)\n end\n end",
"def setup_current_user\n @current_user = User.find(session[:user_id]) unless session[:user_id].nil?\n end",
"def login\n if request.get?\n session[:user_id] = nil\n @user = User.new\n else\n @user = User.new(params[:user])\n logged_in_user = @user.try_to_login\n if logged_in_user\n session[:user_id] = logged_in_user.id\n redirect_to(:controller => \"admin\")\n else\n flash[:notice] = \"Sorry, Invalid user/password combination!\"\n end \n end\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def login_user_by_id(user_id)\r\n session[:user_id] = user_id\r\n logger.debug(\"Setting session id to #{session[:user_id]}\")\r\n AuditLog.create(:user_id => user_id, :action => \"Logged in\")\r\n end",
"def check_login\n \t\t\tif self.session == nil\n \t\t\t\t login\n \t\t\tend\n \tend",
"def login!(session) \n session[:user_id] = id \n end",
"def current_user\n if (id = session[:user_id]) #goes through is id is true\n @current_user ||= User.find_by(id: id)\n elsif (id = cookies.signed[:user_id])\n user = User.find_by(id: id)\n #so a logged in user doesnt get logged in again\n if user && user.authenticated?(:remember, cookies[:remember_token])\n log_in user\n @current_user = user\n end\n end # finding this way to not throw error if nill but the if \n end",
"def login!(user)\n # Store both local ID and horizon_borrower_id\n # to try and prevent mismatches from cookies.\n session[:current_user_id] = user.id\n session[:current_user_horizon_id] = user.horizon_borrower_id\n\n # Blacklight requires this to migrate guest bookmarks over\n # to permanent bookmarks where needed. It's not documented\n # well exactly how this works with non-Devise auth, but appears\n # to be working.\n transfer_guest_user_actions_to_current_user\n end",
"def login\n self.class.trace_execution_scoped(['Custom/login/find_user']) do\n @u = (User.find_by_primary_email(params[:username].downcase) || User.find_by_nickname(params[:username].downcase.to_s)) if params[:username]\n end\n\n self.class.trace_execution_scoped(['Custom/login/if_block']) do\n if @u and @u.has_password? and @u.valid_password?(params[:password])\n @user = @u\n elsif @u and (params[:password] == \"anonymous\") and (@u.user_type == User::USER_TYPE[:anonymous])\n @user = @u\n else\n query = {:auth_failure => 1, :auth_strategy => \"that username/password\"}\n query[:redir] = params[:redir] if params[:redir]\n redirect_to add_query_params(request.referer || Settings::ShelbyAPI.web_root, query) and return\n end\n end\n\n # any user with valid email/password is a valid Shelby user\n # this sets up redirect\n self.class.trace_execution_scoped(['Custom/login/sign_in_current_user']) do\n sign_in_current_user(@user)\n end\n redirect_to clean_query_params(@opener_location) and return\n end",
"def login_by_session(sessid)\n return if @logged_in\n @logged_in = true\n @session = sessid\n end",
"def authenticate_user\n unless session[:user_id]\n #If there's no user_id in the current session the user is redirected to the login page.\n redirect_to(:controller => 'sessions', :action => 'login')\n return false\n else\n #If there is a current user_id in the session @current_user will receive the User business object corresponding to\n #that ID.\n @current_user = User.find session[:user_id]\n return true\n end\n end",
"def require_login\n redirect_to root_path unless session.include?(:user_id)\n end",
"def current_user\n if @user\n @user\n elsif session[:user_id]\n @user = User.find(session[:user_id])\n else\n redirect_to login_path and return\n end\n end",
"def logged_in_user\n if logged_in?\n redirect_to(user_path(@current_user)) if params[:id] != @current_user.id.to_s\n else\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end",
"def user_login(user)\n click_log_in\n fill_login_credentials(user)\n end",
"def login(user=:joerg)\r\n login_as(user)\r\n end",
"def ensure_logged_in\n login! if @user.nil?\n end",
"def login_from_config\n self.current_user = User.find(BETY_USER) if defined? BETY_USER\n end",
"def login\r\n\t\t@user = @current_user || User.new\r\n\t\t# If logged in, redirect to the pending orders page. This only happens if we didn't jump_to\r\n\t\t# something in require_authorisation: it's pretty confusing if you get the login screen again\r\n\t\t# _after_ you successfully logged in!\r\n\t\tif @user.permissions >= :client\r\n\t\t\tredirect_to(:controller => 'admin/orders', :action=> 'pending') and return false\r\n\t\tend\r\n\tend",
"def login!(user)\n @current_user = user\n session[:session_token] = user.session_token\n end",
"def authenticate\n unless User.find_by_id(session[:current_user_id]) ||\n (Auditor.find_by_id(session[:current_auditor_id]))\n redirect_to ({:controller => :login, :action => :session_timeout})\n end\n end",
"def login!(user) #sets congruency between session token of user and session\n @current_user = user\n session[:session_token] = user.session_token\n end",
"def login\n return unless request.post?\n ::ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update(:session_expires => 4.weeks.from_now) if params[:remember_me]\n self.current_user = User.authenticate(params[:login], params[:password])\n if current_user\n redirect_back_or_default(:controller => '/')\n flash[:notice] = \"Logged in successfully\"\n else\n flash[:notice] = \"Please try again\"\n end\n end"
] |
[
"0.84740376",
"0.84740376",
"0.8404325",
"0.8352608",
"0.8280006",
"0.7980598",
"0.78989327",
"0.7846605",
"0.7675138",
"0.7612057",
"0.7590172",
"0.7568378",
"0.75255775",
"0.74937797",
"0.74930966",
"0.74859357",
"0.74751997",
"0.7442288",
"0.73781353",
"0.733913",
"0.7324628",
"0.7314946",
"0.7275975",
"0.7267634",
"0.7267212",
"0.72666824",
"0.72631466",
"0.7250716",
"0.72477263",
"0.7236132",
"0.7213788",
"0.7205159",
"0.7185227",
"0.7184588",
"0.71842414",
"0.7168431",
"0.71592367",
"0.7158743",
"0.7157489",
"0.7152522",
"0.7149768",
"0.7145523",
"0.71318495",
"0.7112742",
"0.7105992",
"0.71029466",
"0.7089655",
"0.7072124",
"0.70678127",
"0.70578974",
"0.70504814",
"0.7045855",
"0.70427066",
"0.7034331",
"0.7026701",
"0.70227027",
"0.701907",
"0.701907",
"0.701267",
"0.7012121",
"0.70080394",
"0.7007169",
"0.6994241",
"0.6991538",
"0.69890237",
"0.69868124",
"0.69867504",
"0.69867504",
"0.69867504",
"0.69867504",
"0.69867504",
"0.69867504",
"0.69867504",
"0.69867504",
"0.69867504",
"0.69867504",
"0.69867504",
"0.69867504",
"0.69867504",
"0.69867504",
"0.69788975",
"0.6978359",
"0.6976912",
"0.6976693",
"0.6976466",
"0.69760877",
"0.6972025",
"0.6956153",
"0.69475883",
"0.694372",
"0.6938661",
"0.6929075",
"0.69279706",
"0.69272625",
"0.69192225",
"0.69184124",
"0.69179505",
"0.6915043",
"0.69147766",
"0.69147164"
] |
0.854995
|
0
|
POST /comments/watch?commentable_type=&commentable_id= DELETE /comments/watch?commentable_type=&commentable_id=
|
def watch
klass = params[:commentable_type].constantize
@commentable = klass.find(params[:commentable_id])
authorize! :read, @commentable
if request.post?
User.create_action(:watch_comment, target: @commentable, user: current_user, action_option: "watch")
else
User.create_action(:watch_comment, target: @commentable, user: current_user, action_option: "ignore")
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @commentable = @comment.commentable\n @comment.destroy\n respond_to do |format|\n format.js\n end\n end",
"def destroy\n if @commentable.comments.find(params[:id]).destroy\n render json: { success: true }\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 @idea = @comment.commentable\n @comment.destroy\n @comments = @idea.comments\n @comment = Comment.new(:commentable_id => @idea.id)\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.js { render \"index\" }\n end\n end",
"def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to polymorphic_path([@section, @commentable, :comments]), notice: 'Comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n observation = @comment.observation\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to observation_url(observation), notice: 'Comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n \t@comment.in_recycling = true\n \n if (can? :delete, @comment)\n \tif @comment.save\n \t\trespond_to do |format|\n \t\t format.html { redirect_to it_category_content_url(@comment.content.category.it, \n \t\t @comment.content.category, @comment.content) }\n \t\t format.json { head :ok }\n \t\tend\n \tend\n \tend\n end",
"def delete_comments\n end",
"def destroy_with_post_changes\n destroy_without_post_changes\n\n if params['object_type'] == \"issue\"\n user = User.find(params[:user_id])\n issue = Issue.find(params[:object_id])\n post_comment(issue, \"Watchers removed: #{user.name}\")\n end\n end",
"def destroy\n @comment = @commentable_collection.find(params[:id])\n authorize! :destroy, @comment\n if @comment.destroy\n respond_to do |format|\n format.html { redirect_to(@commentable, :notice => \"Your #{@comment.class.to_s.downcase} has been deleted\") }\n format.xml { head :ok }\n end\n else\n respond_to do |format|\n format.html { redirect_to(@commentable, :alert => \"Your #{@comment.class.to_s.downcase} could not be deleted.\") }\n end\n end\n end",
"def destroy\n @video_request_comment.destroy\n respond_to do |format|\n format.html { redirect_to video_request_comments_url, notice: 'Video request comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n comment = @commentable.comments.find(params[:id])\n\n # Prevent those who don't have access from deleting the Comment.\n head :forbidden and return false if !comment.profile_has_access?(current_profile)\n\n comment.destroy\n respond_to do |format|\n format.html { redirect_to @commentable }\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 @comment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\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\t\t@comment = Comment.find(params[:id])\n\t\t@comment.destroy\n\t\t\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to @commentable }\n\t\t\tformat.js\n\t\tend\n\tend",
"def destroy\n @watch.destroy\n respond_to do |format|\n format.html { redirect_to watches_url }\n format.json { head :no_content }\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 = Comment.find(params[:id])\n if comment.destroy\n render json: {destroyed: true}\n end\n end",
"def destroy\n @comment.destroy\n respond_to do |format|\n format.js\n end\n end",
"def destroy\n @request_for_comment.destroy\n respond_to do |format|\n format.html { redirect_to request_for_comments_url, notice: 'Request for comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n authorize!\n end",
"def destroy\n @request_for_comment.destroy\n respond_to do |format|\n format.html { redirect_to request_for_comments_url, notice: 'Request for comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n authorize!\n end",
"def destroy\n @request_for_comment.destroy\n respond_to do |format|\n format.html { redirect_to request_for_comments_url, notice: 'Request for comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n authorize!\n end",
"def destroy\n @comment = @computer.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(computer_comments_url) }\n format.xml { head :ok }\n format.js\n end\n end",
"def destroy\n\t\t@comment = Comment.find( params[:id] )\n\t\t\n\t\tif @comment.commentable.class.comments_extension.can_remove?( @comment.commentable, @comment, current_user_get )\t\t\n\t\t\t@removed_ids = [ @comment.id ]\n\t\t\t\n\t\t\tfor comment in @comment.descendants do\n\t\t\t\t@removed_ids << comment.id\n\t\t\tend\n\t\t\t\n\t\t\t@comment.destroy\n\t\t\t\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html { redirect_to comments_url }\n\t\t\t\tformat.xml { head :ok }\n\t\t\t\tformat.js\n\t\t\tend\n\t\telse\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html { redirect_to comments_url }\n\t\t\t\tformat.xml { head :err }\n\t\t\t\tformat.js\t{ render :update do |page| page.alert \"You can't remove this comment\" end }\n\t\t\tend\n\t\tend\n\tend",
"def delete\n # mark each version of the history as deleted, not just the most recent one\n @patient.histories\n .where(original_comment_id: @history.original_comment_id)\n .update_all({ deleted_by: current_user.email, delete_reason: params.permit(:delete_reason)[:delete_reason], updated_at: DateTime.now })\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n render json:@comment\n end",
"def destroy\r\n @comment = Comment.find(obfuscate_decrypt(params[:id], session))\r\n\t\t@commentable = @comment.commentable\r\n @comment.comment_options.each do |co|\r\n co.destroy\r\n end\r\n\t\t@comment.destroy\r\n\r\n\t\trespond_to do |format|\r\n @comment_option_lookups = CommentOptionLookup.order\r\n\t\t\tformat.html { redirect_to :back }\r\n\t\t\tformat.json { head :ok }\r\n\t\t\tformat.js\r\n\t\tend\r\n\tend",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n redirect_to request_path(@comment.request)\n end",
"def delete_comment(id)\n record \"/msg/delete_comment/#{id}\"\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.js { render :action => 'destroy.js.coffee', :content_type => 'text/javascript'}\n end\n end",
"def add(commentable_type, commentable_id, params = {})\n wrike.execute(:post, api_url(nested_path('comments', commentable_type, commentable_id)), params)\n end",
"def destroy\n if CommentStatusType.count > 1\n #reassign any comments of this type to the first remaining status type.\n firstCST = current_rulemaking.comment_status_types.where.not(id: @comment_status_type.id).order(:order_in_list).first\n reassign_comments(@comment_status_type,firstCST)\n\n current_CST_num = @comment_status_type.order_in_list\n save_change_log(current_user,{object_type: 'comment status type', action_type: 'delete', description: \"deleted comment status type ID ##{@comment_status_type.id} '#{@comment_status_type.status_text}'. Any corresponding comments were reassigned to ID #{firstCST.id}, '#{firstCST.status_text}'.\"})\n @comment_status_type.destroy\n handle_delete_of_order_in_list(current_rulemaking.comment_status_types,current_CST_num)\n respond_to do |format|\n format.html { redirect_to comment_status_types_url, notice: \"Comment status type was successfully deleted. Any comments assigned to this status were reassigned to '#{firstCST.status_text}'.\" }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to comment_status_types_url, error: 'Cannot delete the last comment status type.' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @comment = current_user.comments.find(params[:id])\n @post = @comment.commentable if @comment.present? && @post.blank? && @comment.commentable.is_a?(Post) \n @photo = @comment.commentable if @comment.present? && @photo.blank? && @comment.commentable.is_a?(Photo)\n\n @comment_id = @comment.id\n @commentable = @comment.commentable\n @parent = @comment.parent\n\n @comment.destroy!\n @commentable.update_interactions_count!(true) if @commentable.respond_to? :update_interactions_count!\n \n respond_to do |format|\n format.html do \n if @post.present?\n redirect_to post_path(@post), notice: 'Comment was successfully removed'\n elsif @photo.present?\n redirect_to user_photo_path(@photo.user, @photo), notice: 'Comment was successfully removed'\n end\n end\n format.js { render (@photo.present? ? 'destroy_for_photo.js' : 'destroy.js') }\n end\n end",
"def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to after_update_path, success: 'Comment was successfully destroyed.' }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy\n @talk_comment = TalkComment.find(params[:id])\n @talk_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to talk_comments_url }\n format.json { head :no_content }\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 @recent_change_comment.destroy\n respond_to do |format|\n format.html { redirect_to recent_change_comments_url, notice: 'Recent change comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = @commentable_collection.find(params[:id])\n if @comment.user == current_user\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to(posts_url, :notice => \"Your #{@comment.class.to_s.downcase} has been deleted\") }\n format.xml { head :ok }\n end\n else\n respond_to do |format|\n format.html { redirect_to(posts_url, :notice => \"You can't delete someone else's #{@comment.class.to_s.downcase}\") }\n end\n end\n end",
"def destroy\n produit = Produit.find(params[:produit_id])\n @comment = produit.comments.find(params[:id])\n @comment.destroy\n redirect_to(produit)\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 @game_watch = GameWatch.find(params[:id])\n @game_watch.destroy\n\n respond_to do |format|\n format.html { redirect_to game_watches_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 project_sprint_user_story_comments_path }\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_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 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 delete_comment!(permlink); delete_comment(permlink).broadcast!(true); end",
"def destroy\n destroy_hashtaggables(@comments.pluck('id'), 'PostComment')\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Wpis został usunięty.' }\n format.json { head :no_content }\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 @post = @comment.post\n authorize @comment\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to post_path(@post, anchor: 'comments'), notice: I18n.translate('model_destroyed', name:I18n.translate('comment_definite')) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment.destroy\n end",
"def destroy\n\t@post = Post.find(@comment.post_id)\n\n @comment.destroy\n\t@post.update_attribute(:nComments, @post.comments.count)\n respond_to do |format|\n format.html { redirect_to @comment.post, 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.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.destroy\n respond_to do |format|\n format.html { redirect_to comments_url, notice: t(\"actions.destroyed.male\", model: t(\"activerecord.models.#{controller_name.singularize.gsub(\" \", \"\")}\").downcase) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hot_comment.destroy\n respond_to do |format|\n format.html { redirect_to hot_comments_url, notice: 'Hot comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if !(current_user.is_admin?)\n flash[:error] = \"You don't have permission to do this action.\"\n redirect_to(curriculum_comment_type_url) and return\n end \n @curriculum_comment_type = CurriculumCommentType.find(params[:id])\n @curriculum_comment_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(curriculum_comment_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n comment_status = @comment.comment_status\n respond_to do |format|\n if !@comment.destroy\n format.json { render :json=>report_error(@comment)}\n format.html { redirect_to @comment, :alert => 'Failure deleting comment.' }\n else\n format.json { render :json=>{}}\n end\n end\n end",
"def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to '/moderatecomments/', notice: 'Comment was successfully destroyed.' }\n format.json { head :no_content }\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 = @complaint.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to complaint_comments_url(complaint) }\n format.json { head :ok }\n format.js\n end\n end",
"def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_path }\n format.js\n end\n end",
"def destroy\n @issue_watch.destroy\n respond_to do |format|\n format.html { redirect_to issue_watches_url, notice: 'Issue watch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = @experiment.comments.find(params[:id])\n @comment.destroy\n\tredirect_to experiment_path(@experiment)\n end",
"def destroy\n @comment=@post.comments.find(params[:id])\n \n @comment.destroy # if (current_user.id=@comment.user_id && comment.created_at < 5.minutes.ago) \n \n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment.destroy!\n head :no_content\n end",
"def delete_comment user\n edit_comment user, nil\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 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 = Comment.find(params[:id])\n @comment.destroy\n\n end",
"def destroy\n @user = UserSession.user_by_authentication_token(params[:authentication_token])\n @recipe = Recipe.find_by_id(params[:recipe_id])\n\n @comment = Comment.find_by_id(params[:id])\n\n respond_to do |format|\n if @comment.user == @user and @recipe\n @comment.destroy\n @comments = @recipe.fetch_comments\n format.json { render :json => { :comments => @comments, :message => \"success\" }}\n else\n format.json { render :json => { :message => \"failure\"}}\n end \n end\n end",
"def destroy\n \t@topic = Topic.find(params[:topic_id])\n \t@comment.topic = @topic\n \t@comment.update_attributes(dstatus: true)\n \t# @comment.toggle!(:delete)\n #@comment.destroy\n respond_to do |format|\n flash[:success] = \"Comment was successfuly deleted.\"\n format.html { redirect_to board_topic_path(@topic.board.id, @topic.id) }\n format.js\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 format.js\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 @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 update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to comment_params[:commentable_type].constantize.find(comment_params[:commentable_id]), 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 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 @catalogs_comment_type = Catalogs::CommentType.find(params[:id])\n @catalogs_comment_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(catalogs_comment_types_url) }\n format.xml { 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 post_comments_url, notice: \"Comment was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find_by(id: params[:id])\n @user = @comment.user\n\n return false unless authorized_user?(@user.id)\n\n if @comment.destroy\n render 'api/comments/destroy.json.jbuilder'\n else\n render json: @comment.errors.full_messages, status: 422\n end\n\n end",
"def destroy\n @watch_list = WatchList.find(params[:id])\n @watch_list.destroy\n\n respond_to do |format|\n format.html { redirect_to watch_lists_url }\n format.json { head :ok }\n end\n end"
] |
[
"0.65277755",
"0.6377914",
"0.63224655",
"0.63129306",
"0.61909795",
"0.6085293",
"0.60674876",
"0.5994362",
"0.589722",
"0.5810435",
"0.57966363",
"0.5791599",
"0.5781984",
"0.5760412",
"0.5753952",
"0.57530266",
"0.57439554",
"0.5743916",
"0.5708132",
"0.5698728",
"0.5698285",
"0.5698285",
"0.5698285",
"0.56976503",
"0.5692883",
"0.5675105",
"0.567102",
"0.56688786",
"0.5666649",
"0.56646514",
"0.56528974",
"0.5648378",
"0.5644721",
"0.5632407",
"0.56137305",
"0.56102514",
"0.56100017",
"0.56078947",
"0.56056553",
"0.5586229",
"0.55854225",
"0.55780166",
"0.5567556",
"0.55575055",
"0.55397487",
"0.55397487",
"0.55397487",
"0.55307937",
"0.55283225",
"0.55266994",
"0.55266994",
"0.5525131",
"0.5524195",
"0.5511306",
"0.55078804",
"0.54962575",
"0.5493637",
"0.5492253",
"0.54908967",
"0.5489417",
"0.54889834",
"0.54869646",
"0.54869646",
"0.547485",
"0.5473385",
"0.54689306",
"0.546532",
"0.54631084",
"0.5462772",
"0.5457803",
"0.54545814",
"0.5451057",
"0.5451057",
"0.5451057",
"0.5448848",
"0.54467785",
"0.5438378",
"0.5435693",
"0.54348636",
"0.54308254",
"0.5430149",
"0.54293674",
"0.54293674",
"0.54293674",
"0.54293674",
"0.54293674",
"0.54293674",
"0.54293674",
"0.54293674",
"0.54293674",
"0.54293674",
"0.54293674",
"0.54293674",
"0.54293674",
"0.54293674",
"0.54293674",
"0.54291236",
"0.54237884",
"0.5413045",
"0.5412349"
] |
0.76093477
|
0
|
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
|
Only allow a trusted parameter "white list" through.
|
def comment_params
params.require(:comment).permit(:commentable_type, :commentable_id, :parent_id, :body, :body_sml)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\n end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n end",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def parameters\n nil\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end"
] |
[
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.63804525",
"0.6373396",
"0.6360051",
"0.6355191",
"0.62856233",
"0.627813",
"0.62451434",
"0.6228103",
"0.6224965",
"0.6222941",
"0.6210244",
"0.62077755",
"0.61762565",
"0.61711127",
"0.6168448",
"0.6160164",
"0.61446255",
"0.6134175",
"0.6120522",
"0.6106709",
"0.60981655",
"0.6076113",
"0.60534036",
"0.60410434",
"0.6034582",
"0.6029977",
"0.6019861",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.60184896",
"0.60157263",
"0.6005857",
"0.6003803",
"0.60012573",
"0.59955895",
"0.5994598",
"0.5993604",
"0.5983824",
"0.5983166",
"0.5977431",
"0.597591",
"0.5968824",
"0.5965953",
"0.59647584",
"0.59647584",
"0.59566855",
"0.59506303",
"0.5950375",
"0.59485626",
"0.59440875",
"0.5930872",
"0.5930206",
"0.5925668",
"0.59235454",
"0.5917905",
"0.59164816",
"0.5913821",
"0.59128743",
"0.5906617",
"0.59053683",
"0.59052664",
"0.5901591",
"0.58987755",
"0.5897456",
"0.58970183",
"0.58942604"
] |
0.0
|
-1
|
Each subarray will have strings which are anagrams of each other Time Complexity: O(n) Space Complexity: O(n)
|
def grouped_anagrams(strings)
anagram_hash = Hash.new
strings.each do |word|
sorted_string = word.chars.sort.join
#Check if key exists with the sorted string already
#In case of yes, add the word to the array value of the key
if anagram_hash[sorted_string]
anagram_hash[sorted_string] += [word]
#If not, set it as a new key/value pair in the hash
else
anagram_hash[sorted_string] = [word]
end
end
return anagram_hash.valuesend
# This method will return the k most common elements
# in the case of a tie it will select the first occuring element.
# Time Complexity: O(n)
# Space Complexity: O(n)
def top_k_frequent_elements(list, k)
result = []
hash = Hash.new
list.each do |letter|
if hash[letter]
hash[letter] += 1
else
hash[letter] = 1
end
end
k.times do
max = nil
hash.each do |num, value|
if value && (max.nil? || value > max)
max = num
end
end
if max
hash[max] = nil
result << max
end
end
return result end
# This method will return the true if the table is still
# a valid sudoku table.
# Each element can either be a ".", or a digit 1-9
# The same digit cannot appear twice or more in the same
# row, column or 3x3 subgrid
# Time Complexity: ?
# Space Complexity: ?
def valid_sudoku(table)
raise NotImplementedError, "Method hasn't been implemented yet!"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def anagrams(string, array)\nend",
"def group_anagrams(arr)\n hash = Hash.new { |h, k| h[k] = [] }\n arr.each do |str|\n hash[str.chars.sort] << str\n end\n\n hash.values.map(&:sort)\nend",
"def anagrams(array)\n copy_array = array.dup\n result_array = []\n iteration_idx = 0\n until copy_array.empty?\n \n word = copy_array.pop\n next if word.nil?\n \n result_array << []\n result_array[iteration_idx] << word\n copy_array.each do |sub_word|\n next if sub_word.nil?\n if are_anagrams?(sub_word, word)\n result_array[iteration_idx] << sub_word\n idx = copy_array.index(sub_word)\n copy_array[idx] = nil\n end\n end\n \n iteration_idx += 1\n end\n \n result_array\nend",
"def anagrams(array_of_words)\n ana_hash = Hash.new { |hash, key| hash[key] = [] }\n array_of_words.each { |word| ana_hash[word.split(\"\").sort.join] << word }\n ana_hash.map { |key, list| list }.select { |list| list.size > 1 }\nend",
"def grouped_anagrams(strings)\n\n string_hash = {}\n\n strings.each do |string|\n \n temp = string.chars.sort.join\n if string_hash.has_key?(temp)\n string_hash[temp] << string\n else\n string_hash[temp] = Array.new()\n string_hash[temp] << string\n end\n \n end\n return string_hash.values\n\nend",
"def grouped_anagrams(strings)\n hash = {}\n acc = 0\n return_array = []\n strings.each do |str|\n if !(hash[str.split(//).sort!.join().hash])\n hash[str.split(//).sort!.join().hash] = acc\n return_array[acc] = [str]\n acc += 1\n else\n return_array[hash[str.split(//).sort!.join().hash]] << str\n end\n end\n return return_array\nend",
"def grouped_anagrams(strings)\n hash_ana = {}\n outerArray = []\n\n # The way I identify they are anagrams is using bytes to get the ASCII value of each char sum them,\n # Then we know all the characters have the same letter on it.\n strings.each do |string|\n if hash_ana[string.bytes.sum]\n hash_ana[string.bytes.sum].push(string)\n else\n hash_ana[string.bytes.sum] = [string]\n end\n end\n\n hash_ana.each do |key|\n outerArray << key[1]\n end\n\n return outerArray\nend",
"def combine_anagrams(words)\r\n big_array = Array.new\r\n hash = Hash.new(0)\r\n words.each do |w| \r\n array = Array.new\r\n array = w.downcase.split(//)\r\n if hash.has_key?(array.sort) \r\n hash[array.sort]=hash[array.sort].push(w)\r\n else\r\n hash[array.sort]=Array.[](w)\r\n end\r\n end\r\n hash.each { |key,value| big_array.push(value) }\r\n big_array\r\nend",
"def anagrams_for(word, array)\n p array.select {|w| canonical(word) == canonical(w)}\nend",
"def combine_anagrams(strings)\n lettercombinations = strings.map{|string| string.downcase.count_regex(/\\w/)}\n lettercombinationsunique = lettercombinations.uniq\n lettercombinationsindex = lettercombinations.map{|lettercombination| lettercombinationsunique.index(lettercombination)}\n newarray = lettercombinationsunique.map{[]}#pitfall, new will make the same copy of the array throughout\n strings.each_index{|i| newarray[lettercombinationsindex[i]].push(strings[i])}\n newarray\nend",
"def combine_anagrams(words)\n\n ouArr = Array.new\n\n words.each do |w|\n\n ouIt = Array.new [w]\n\n words.each do |w2|\n if w.downcase.chars.sort == w2.downcase.chars.sort && !ouIt.include?(w2)\n ouIt.push(w2)\n end\n end\n ouIt.sort!\n\n if !ouArr.include?(ouIt)\n ouArr.push(ouIt)\n end\n end\n ouArr\nend",
"def grouped_anagrams_version2(strings)\n # edge cases\n return [] if strings.empty?\n return [[strings[0]]] if strings.size == 1\n # new array has the same number of elements as the input array\n # each inner array has 25 elements, by the number of letter in the English alphabet\n anagrams_storage = {}\n strings.each do |word|\n letters = Array.new(26, 0)\n word.chars.each do |char|\n # get an Integer ordinal of a letter\n letters[char.ord - 97] += 1\n end\n\n # we freeze the array as a key because it's recommended not to have mutable data structures as keys\n letters = letters.freeze\n # check if there is a hash equal to this newly created one.\n # checks key-value pairs, not their order\n if !anagrams_storage[letters]\n anagrams_storage[letters] = Array.new\n anagrams_storage[letters] << word\n else\n anagrams_storage[letters] << word\n end\n end\n # as a result we have \n # { [1,0,0,0...all 26 elements] => [\"tan\", \"nat\", \"ant\"] }\n return anagrams_storage.values\nend",
"def grouped_anagrams(strings)\n hash = {}\n strings.each do | i |\n key = i.chars.sort.join\n if hash[key] != nil \n hash[key] << i\n else \n hash[key] = [i]\n end\n end\n return hash.values\n\nend",
"def grouped_anagrams(strings)\n return [] if strings.empty?\n\n anagram_hash = Hash.new()\n strings.each do |string|\n word_array = string.split(\"\").sort\n if anagram_hash.include?(word_array)\n anagram_hash[word_array] << string\n else\n anagram_hash[word_array] = [string]\n end\n end\n\n result = []\n anagram_hash.each do |key, value|\n result << value\n end\n return result\n\nend",
"def combine_anagrams(words)\n #h=Hash.new(0)\n output = Array.new\n words.map{|word| word.chars.sort.join }.uniq.each {|anagram|\n w = words.partition { |word| word.chars.sort.join==anagram}\n# puts \"w : \" + w.to_s\n output += [w[0]]\n# puts \"output : \" + output.to_s\n }\n return output\nend",
"def combine_anagrams(words)\n Array anagrams = []\n words.each {|x|\n flag = false\n anagrams.collect {|y|\n if x.downcase.chars.to_a.sort == y[0].downcase.chars.to_a.sort then\n y << x\n flag = true\n break\n end\n }\n unless flag; anagrams << [x] end \n }\n anagrams\nend",
"def anagrams_of(string)\n return [string[0]] if string.length == 1\n\n collection = []\n\n substring_anagrams = anagrams_of(string[1, string.length - 1])\n\n substring_anagrams.each do |substring_anagram|\n (0..substring_anagram.length).each do |index|\n copy = String.new(substring_anagram)\n collection << copy.insert(index, string[0])\n end\n end\n collection\nend",
"def grouped_anagrams(strings)\n string_hash = {}\n\n strings.each do |string|\n key = string.split(\"\").sort.join # probably an O(n log n) operation, I couldn't find an integer based hashing function i liked\n\n string_hash[key] ||= [] # trying this thing out\n string_hash[key] << string\n end\n \n return string_hash.values # also probably an O(n) operation\nend",
"def anagrams_for(word, array)\n #Pasar la palabra a minuscula para que sea igual\n word.downcase!\n #Arreglo vacio para meter los que sean anagramas\n arr = []\n #Separar la palabra en su forma canonica\n cano = word.chars.sort\n #iterar dentro de cada palabra del array\n array.each do |dicc|\n #crear una variable donde pase la palabra del array a su forma canonica\n word_cano = dicc.chars.sort\n #si la palabra es igual a la palabra del array\n #Ya las 2 en su forma canonica\n if cano == word_cano\n #mete la palabra a el array\n arr << dicc\n #De lo contrario deja el array igual\n else\n arr\n end\n end\n #Regresar el array lleno si habia palabras\n #o vacio si no las encontro\n arr\nend",
"def grouped_anagrams(strings)\n # create an anagrams hash of arrays\n anagrams = {}\n # for each string, split the characters and sort them\n # join the characers, and test the hash keys\n # if the key already exists add it to the array of that key\n # if not create one\n strings.each do |word| \n sorted_word = word.split(//).sort.join\n if anagrams[sorted_word]\n anagrams[sorted_word] << word\n else\n anagrams[sorted_word] = [word]\n end\n end\n \n # return the arrays\n anagrams.values\nend",
"def grouped_anagrams(strings)\n hash_map = {}\n \n strings.each do |str| #n\n chars = str.chars #k length of string\n sorted = chars.sort # k log(k)\n hash_map[sorted] ? hash_map[sorted].push(str) : hash_map[sorted] = [].push(str)\n end\n \n return hash_map.values\nend",
"def combine_anagrams(words)\r\n words.sort!{|a, b| a.length <=> b.length}\r\n letters = words.map{|w| w.downcase.split(//).sort}\r\n outp = Array.new \r\n prev_a = []\r\n for w in words\r\n if letters[words.index(w)] == prev_a\r\n outp[outp.length - 1].push(w)\r\n else\r\n outp.push([w])\r\n prev_a = letters[words.index(w)]\r\n end\r\n end\r\n return outp\r\nend",
"def combine_anagrams(words)\n result = Array.new\n words.each do |i|\n anagrams = Array.new\n sorted = i.downcase.chars.sort.join\n words.each do |j|\n if j.downcase.chars.sort.join == sorted\n anagrams << j\n end\n end\n result << anagrams\n end\n return result.uniq\nend",
"def anagrams(string, array)\n string_anagram = string.chars\n \n array.select! do |word|\n word.chars.all? do |letter|\n word.chars.count(letter) == string_anagram.count(letter)\n end\n end\n array\nend",
"def combine_anagrams(words)\n anagrams = Hash.new()\n words.each do |word|\n letters = word.downcase.gsub(/[^a-z]/, \"\").split(\"\").sort.join\n anagrams[letters] = Array.new unless anagrams.include?(letters)\n anagrams[letters] << word\n end\n anagrams.values\nend",
"def combine_anagrams(words)\n hash = {}\n words.each do |str|\n sorted = str.chars.sort { |a, b| a.casecmp(b) } .join\n down = sorted.downcase\n if (hash[down]== nil)\n hash[down] = Array.new\n end\n arr = hash[down]\n arr[arr.length] = str\n hash[down] = arr\n# puts \"[sorted] is \\\"\" + sorted + \",\\\" and hash[sorted] is \" + hash[sorted].inspect\n arr = nil\n end\n hash.values\nend",
"def combine_anagrams_method2(words)\n\ttemp1 = Array.new\n\ttemp1 = words.clone\t# making a deep copy of the input \n\tanagram = Array.new\t\n\ti = 0\n\twhile i < temp1.length\t\t\t\n\t\tcount = 0 # count the number of anagrams of a particular string say \"cars\"\n\t\tfor j in i+1..(temp1.length - 1)\n\t\t\tif temp1[i].downcase.chars.sort.join == temp1[j].downcase.chars.sort.join \n\t\t\t\tcount = count + 1\n\t\t\t\ttemp1[j],temp1[i+count] = temp1[i+count],temp1[j] # get all the anagrams to one place by swapping\n\t\t\tend\n\t\tend\n\t\tanagram.push([temp1[i..i+count]]) # pushing the array of anagrams into anagram array say [\"cars\", \"racs\", \"scar\"]\n\t\ti = i + count + 1\n\tend\n\t# printing each group\n\tfor i in 0..anagram.length-1\n\t\tprint \"anagram[\" + i.to_s + \"]: \" \n\t\tputs anagram[i]\n\tend\t\nend",
"def grouped_anagrams(strings)\n results = []\n return results if strings.empty?\n\n hash_map = {}\n set_no = 1 \n\n strings.each do |word|\n letters = word.split('').sort!\n\n if hash_map.empty?\n hash_map[set_no] = letters\n set_no += 1\n elsif !hash_map.has_value?(letters)\n hash_map[set_no] = letters\n set_no += 1\n end \n end \n\n results = []\n\n hash_map.keys.each do |sub_arr|\n sub_arr = []\n results << sub_arr\n end \n\n strings.each do |word|\n letters = word.split('').sort!\n\n if hash_map.has_value?(letters)\n sub_group = hash_map.key(letters)\n results[sub_group-1] << word\n end \n end \n\n results.each do |list|\n list.sort!\n end \nend",
"def grouped_anagrams(strings)\n return [] if strings.length == 0\n\n result = []\n hash = {}\n count = 0\n\n strings.each do |string|\n sorted_string = string.chars.sort.join\n\n if hash[sorted_string] \n result[hash[sorted_string]].push(string)\n else\n hash[sorted_string] = count\n result.push([string])\n count += 1\n end\n end\n\n return result\nend",
"def grouped_anagrams(strings) \n h = {}\n return [] if strings.nil? || strings.empty? || !strings.is_a?(Array)\n strings.each do |str| \n key = str.chars.sort.join\n if h.include?(key)\n h[key] << str\n else\n h[key] = [str]\n end \n end\n return h.values\nend",
"def grouped_anagrams(strings)\n\n new_hash = Hash.new()\n\n strings.each do |word|\n # calculate the hash key\n key_word = word.downcase.chars.sort.join\n\n if new_hash[key_word] == nil\n new_hash[key_word] = []\n end\n array_value = new_hash[key_word]\n\n length = array_value.length\n array_value[length] = word\n end\n\n return new_hash.values\nend",
"def grouped_anagrams(strings)\n if strings.length == 0\n return []\n end\n\n anagram_hash = {}\n\n strings.each do |string|\n sorted_letters = string.split(\"\").sort.join\n if anagram_hash[sorted_letters]\n anagram_hash[sorted_letters] << string\n else\n anagram_hash[sorted_letters] = [string]\n end\n end\n return anagram_hash.values\nend",
"def grouped_anagrams(strings)\n\n hash = {}\n\n # take each word in 'strings' array ...\n strings.each do |word|\n # ... and split it into letters, alphabetize those letters, and join them back together: this produces a standardized string for words that are anagrams of each other ('ate', 'eat' => 'aet')\n letters = word.split(//).sort().join()\n \n # if the standardized string isn't already in the hash, add it as the key and an empty array as the value\n if hash[letters].nil?\n hash[letters] = []\n end\n\n # push the word to the array for the associated standardized string\n hash[letters] << word\n\n end\n\n # return the values (array of words that are anagrams) for each standardized string\n return hash.values\n\nend",
"def funWithAnagrams(word_arr)\n # Write your code here\n visited = {}\n\n word_arr.each_with_index do |word,idx|\n if visited[word.split(\"\").sort.join(\"\")]\n word_arr[idx] = \"\"\n else\n visited[word.split(\"\").sort.join(\"\")] = 1\n end\n end\n\n word_arr.delete(\"\")\n word_arr.sort\nend",
"def grouped_anagrams(strings)\n hash = {}\n\n strings.each do |string|\n sorted_string_array = string.split(\"\").sort\n\n if hash[sorted_string_array]\n hash[sorted_string_array] << string\n else\n hash[sorted_string_array] = [string]\n end\n end\n\n answer = []\n\n hash.each do |key, value|\n answer.push(value)\n end\n\n return answer\nend",
"def grouped_anagrams(strings)\n return [] if strings.empty?\n hash = {}\n\n strings.each do |string|\n alphabetized = string.chars.sort.join\n\n if hash[alphabetized]\n hash[alphabetized] << string\n else\n hash[alphabetized] = [string]\n end\n end\n return hash.values\nend",
"def combine_anagrams(words)\r\n words.group_by{|w| w.downcase.chars.sort.to_s}.values\r\nend",
"def combine_anagrams(words)\n @results = []\n word_bins = words.group_by { |word| word.length }\n word_bins.values.map { |sublist| \n sublist = sublist.zip(sublist)\n sublist.map { |wordpairs| wordpairs[0] = wordpairs[0].downcase.chars.sort.join }\n # collect unique keys for this sublist:\n keys = sublist.collect { |list| list[0] }.uniq\n # print \"keys: \", keys, \"\\n\"\n keys.each do |key| \n anagrams = sublist.collect { |list| list[0] == key ? list[1] : nil }\n anagrams.compact!\n @results << anagrams\n # print \"anagrams= \", anagrams, \"\\n\"\n end\n # print sublist.length, \": \", sublist, \"\\n\\n\" \n }\n # print \"final results: \", @results, \"\\n\"\n @results\nend",
"def grouped_anagrams(strings)\n return [] if strings.empty?\n\n #create empty hash\n hash = {}\n strings.each do |word|\n alphabet = word.chars.sort.join\n if !hash[alphabet]\n hash[alphabet]\n else\n hash[alphabet] = [word]\n end\n end\nend",
"def combine_anagrams(words)\n output = []\n if words.length == 0\n return output\n end\n words.each do |item|\n s_string = item.downcase.chars.sort.join.to_s\n temp_arry = []\n words.each do |scan|\n if s_string == scan.downcase.chars.sort.join.to_s\n temp_arry << scan\n end\n end\n if output.include?(temp_arry)\n #do nothing\n else\n output << temp_arry\n end\n end\n return output\nend",
"def grouped_anagrams(strings)\n res = []\n return res if strings.empty?\n hash = {}\n strings.each do |word|\n key = word.split(\"\").sort.join\n if hash[key]\n hash[key] << word\n else\n hash[key] == [word]\n end\n end\n hash.each do |k, v|\n res << v \n end\n return res\nend",
"def combine_anagrams(words)\n output_array = Array.new(0) #create a new output array\n words.each do |firstword| \n\ttemp_array = [] #create a temp array \n words.each do |nextword|\n\t\tif (nextword.downcase.split(//).sort == firstword.downcase.split(//).sort) #compare if two words are anagrams\n\t\t\ttemp_array.push(nextword) #if so, push nextword to array\n\t\tend\n end\n output_array.push(temp_array) #push word to output array, then move up\n end\n \n return output_array.uniq #output array\nend",
"def all_anagrams(string)\n return [string] if string.length <= 1\n\n options = all_anagrams(string[1..-1])\n\n result = []\n\n options.each do |sub|\n string.length.times do |i|\n result << sub[0...i] + string[0] + sub[i..-1]\n end\n end\n\n result\nend",
"def grouped_anagrams(strings)\n hash = Hash.new\n strings.each do |element|\n key = element.chars.sort.join()\n groupedAnagrams = hash[key]\n if groupedAnagrams == nil\n hash[key] = []\n groupedAnagrams = hash[key]\n end\n groupedAnagrams << element\n end\n return hash.values\nend",
"def combine_anagrams(words)\n words_uniq = words.map{ |w| w.downcase.split(//).sort.join }.uniq\n words_uniq.map{ |wu| words.select{ |w| w.downcase.split(//).sort.join == wu }}\nend",
"def combine_anagrams(words)\n anagrams = []\n available_words = words\n words.each do |e|\n group = []\n temp_words = []\n anagram_invariant = e.downcase.chars.sort.join\n available_words.each do |i|\n test = i.downcase.chars.sort.join\n if test == anagram_invariant\n group.push(i)\n else\n temp_words.push(i)\n end\n end\n if(!group.empty?)\n anagrams.push(group)\n end\n available_words = temp_words\n end\n return anagrams\nend",
"def combine_anagrams(wordArray)\n \n \n sortedCharsHash = Hash.new\n groupedArray = Array.new\n n = 0\n \n wordArray.each do |word|\n \n #if freq hash not in freq hash array, put in there and add to grouped array\n #if freq hash in freq hash array, iterate through items until match and put in there\n \n sortedChars = word.downcase.split(//).sort.join\n if sortedCharsHash[sortedChars]\n groupedArray[sortedCharsHash[sortedChars].to_i] << word\n else\n sortedCharsHash[sortedChars] = n\n n = n +1\n groupedArray << [word]\n end\n end\n \n return groupedArray\n \n \nend",
"def combine_anagrams(words)\r\n\tanagrams = words.group_by { |word| word.chars.sort }.values\t\r\nend",
"def combine_anagrams(words)\r\n\tswords = Array.new\r\n\tnoDups = Array.new\r\n\tgroupWords = Array.new\r\n\tanagrams = Array.new\r\n\twords.each {|word| swords << word.downcase.chars.sort.join}\r\n\tswords.each{|word| noDups << word unless !noDups.index(word).nil? }\r\n\tnoDups.each do|tword|\r\n\t\t\t\t\t\r\n\t\t\t\t\tgroupWords = Array.new\r\n\t\t\t\t\twords.each {|word| groupWords << word unless word.downcase.chars.sort.join != tword}\r\n\t\t\t\t\tanagrams << groupWords\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\treturn anagrams\r\nend",
"def combine_anagrams(words)\n result = []\n words.each do |word|\n anagrams = words.find_all{|item| item.downcase.chars.sort.join == word.downcase.chars.sort.join }\n result.push(anagrams)\n end\n result.uniq\nend",
"def combine_anagrams(words)\n#\n\n hash = {}\n words.each{ |word| \n key = word.downcase.split(//).sort\n hash[key] = (hash[key] || []) + [word]\n }\n ans = []\n hash.map{ |k, v|\n ans += v\n }\n ans\nend",
"def combine_anagrams(words)\n anagrams = []\n\n words.each { \n \t|word| \n \t\n\tsorted_word = word.downcase.chars.sort.join\n\n \t# controleer of het gesorteerde woord in 1 van de arrays in anagrams voor komt. \n \t# voeg hem toe aan de array met het overeenkomende anagram\n \t# anders voeg hem als nieuwe array toe aan anagrams\n \ttoegevoegd = false\n\n \t# for i in anagrams.length do |anagram_list|\n \tanagrams.map {\n \t\t|anagram_list|\n\n \t\tif sorted_word == anagram_list[0].downcase.chars.sort.join\n \t\t\tanagram_list << word\n\t\t\ttoegevoegd = true\t\n \t\tend\n \t}\n\n \tif toegevoegd == false\n \t\tanagrams << [word]\n \tend\n\n }\n\n anagrams\nend",
"def combine_anagrams(words)\r\n # <YOUR CODE HERE>\r\n # create a hash to store the anagrams and return arrays of the hash\r\n h = Hash.new \r\n words.each {|x|\r\n key = x.downcase.split(//).sort.join\r\n if h.has_key? key then\r\n a = h[key]\r\n h[key] = a.push(x)\r\n else\r\n h[key]= [x]\r\n end\r\n }\r\n return_array = Array.new\r\n # TODO Figure out how to build an array of arrays\r\n h.each_key {|x| return_array.push (h[x])}\r\n return return_array\r\nend",
"def combine_anagrams(words)\r\n\th = Hash.new\r\n\twords.each do |a_word|\r\n\t\tkey = a_word.downcase.chars.sort.join\r\n\t\tputs key\r\n\t\tputs \"-------\"\r\n\t\tif h[key] == nil\r\n\t\t\th[key] = Array.new\r\n\t\tend\r\n\t\th[key].push(a_word)\r\n\tend\r\n\t\r\n\tr_a=Array.new\r\n\t\r\n\th.each do |key, list|\r\n\tr_a.push(list)\r\n\tend\r\n\treturn r_a\r\nend",
"def anagram_hash(input)\n list = {} # empty hash\n input.each do |word| # iterates over each word in the array\n add_word = word.chars.sort.join # sorts the anagrams\n list[add_word] ||= []\n list[add_word] << word\n end\n # list of all anagrams and words\n list.values\nend",
"def anagrams_for(word, array)\n array.find_all {|element| are_anagrams?(word, element)}\nend",
"def combine_anagrams(words)\n result = Hash.new\n words.each do |word|\n sw = word.downcase.split(//).sort\n if !result.has_key?(sw)\n result[sw] = Array.new\n end\n result[sw] << word\n end\n result.values\nend",
"def grouped_anagrams(strings)\n return [] if strings.length == 0\n \n hash = {}\n strings.each do |word|\n sorted_word = word.split(\"\").sort\n if hash[sorted_word]\n hash[sorted_word] << word\n end\n end\n final_anagrams = []\n hash.each do |k, v|\n anagrams << v\n end\n return final_anagrams\nend",
"def grouped_anagrams(strings)\n # edge cases\n return [] if strings.empty?\n return [[strings[0]]] if strings.size == 1\n # a hash is going to have hashes with letters as a key, and array of words\n # containing those letters as values\n anagrams_storage = {}\n strings.each do |word|\n # create a hash with letters as keys and a number of times it appears in that word as values\n letters = {}\n word.chars.each do |char|\n if letters[char]\n letters[char] += 1\n else\n letters[char] = 1\n end\n end\n # we freeze the hash as a key because it's recommended not to have mutable data structures as keys\n letters = letters.freeze\n # check if there is a hash equal to this newly created one.\n # checks key-value pairs, not their order\n if !anagrams_storage[letters]\n anagrams_storage[letters] = Array.new\n anagrams_storage[letters] << word\n else\n anagrams_storage[letters] << word\n end\n end\n # as a result we have \n # { {\"t\"=>1,\"a\"=>1,\"n\"=>1} => [\"tan\", \"nat\", \"ant\"], \"b\"=>1,\"a\"=>1,\"t\"=>1} => [\"bat\"] }\n return anagrams_storage.values\nend",
"def anagrams(str1, str2)\n \nend",
"def combine_anagrams(words)\r\n buckets = Hash.new([])\r\n words.each do | item |\r\n key = item.downcase.chars.sort.join\r\n\r\n if buckets.has_key?(key)\r\n buckets[key] << item\r\n else\r\n buckets[key] = [item]\r\n end\r\n end\r\n\r\n output = Array.new;\r\n buckets.each do | key, value |\r\n output << value\r\n end\r\n return output\r\nend",
"def find_anagrams(target_word, array_of_words)\n array_of_anagrams = []\n\n array_of_words.each do |member|\n if member.split(//).sort == target_word.split(//).sort\n array_of_anagrams.push(member)\n else\n next\n end\n end\n array_of_anagrams\nend",
"def first_anagram?(word1, word2)\n anagrams = []\n arr = word1.chars \n\n arr.permutation.each do |subArr|\n anagrams << subArr.join(\"\")\n end \n p anagram?(anagrams, word2) \nend",
"def group_anagrams(strs)\n hash = {}\n \n strs.each do |s|\n sorted = s.split('').sort().join()\n if !hash[sorted]\n hash[sorted] = [s]\n else\n hash[sorted].push(s)\n end\n end\n\n hash.values\nend",
"def combine_anagrams(words)\n\n\twords.group_by{|word| word.downcase.chars.sort}.values\n\t\nend",
"def combine_anagrams(words)\n\th = Hash.new{|hash, key| hash[key] = Array.new;}\n\twords.each do |word| h[word.downcase.split(//).sort.join] << word end\n\th.values \nend",
"def grouped_anagrams(strings)\n return [] if strings.empty?\n anagram_hash = {}\n \n strings.each do |word|\n letters = word.split(\"\").sort.join(\"\")\n if anagram_hash[letters].nil?\n anagram_hash[letters] = [word]\n else\n anagram_hash[letters] << word\n end\n end\n return anagram_hash.values\nend",
"def combine_anagrams(words)\n words.group_by {|w| w.downcase.chars.sort {|a,b| a <=> b}.to_s}.values\nend",
"def my_anagram(type_array) \n #Create Hash container\n storage_hash = {} \n #Take given array argument and opperate on each element.\n #Anagrams are words that can be spelled using the same letters. Order inmaterial. \n\n #Split text into Array / Sort String.split(\"\") Array using Array.sort. / String.join \n #Iterate over array input\n\n type_array.each do |word|\n word_sorted = word.split(\"\").sort.join\n #Check to see if word sorted is already in container (storage_array)\n if storage_hash.has_key?(word_sorted)\n storage_hash[word_sorted].push(word)\n else\n #add the new unique storage key\n storage_hash[word_sorted] = [word]\n end\n end\n #Iterate threw your storage and print results\n storage_hash.each do |key, value|\n puts \"---#{key}----\"\n p value\n end\nend",
"def group_anagrams(strs)\n result = Hash.new{|h,k| h[k] = []}\n strs.each do |str|\n hash = Hash.new(0)\n str.each_char do |char|\n hash[char] +=1\n end\n result[hash] << str\n end\n return result.values\nend",
"def grouped_anagrams(strings)\n sorted_words = {}\n anagrams = []\n\n strings.each do |word|\n word_sorted = word.chars.sort.join\n if !sorted_words.keys.include?(word_sorted)\n # In the hashmap, the sorted word will point to the index in the outer array that the anagram should be placed.\n index = sorted_words.length\n sorted_words[word_sorted] = index\n anagrams[index] = [word]\n else\n # Add anagram to correct group.\n anagrams[sorted_words[word_sorted]].push(word)\n end\n end\n\n return anagrams\nend",
"def match(array) #takes in an array of possible anagrams\n anagrams = []\n \n # iterate over array of words\n array.each do |word|\n # compare each word of array to OG word \n # determine if word is anagram\n if word.chars.sort == @word.chars.sort\n anagrams << word\n end\n end\n anagrams #return all matches/ empty array if no matches exist\n end",
"def combine_anagrams(words)\n\twords.collect do |w|\n\t\twords.find_all { |w2| w.split(//).sort.eql? w2.split(//).sort }.sort.uniq\n\tend.uniq\nend",
"def grouped_anagrams(strings)\n return [] if strings.empty?\n numbered_letters = {}\n ('a'..'z').each_with_index { |l, i| numbered_letters[l] = i}\n\n possible_anagrams = {}\n\n strings.each do |string|\n value = 0\n string.each_char do |char|\n value += numbered_letters[char]\n end\n if possible_anagrams[value]\n possible_anagrams[value] << string \n else\n possible_anagrams[value] = [string]\n end\n end\n\n return possible_anagrams.values\nend",
"def combine_anagrams(words)\n final = []\n first_word = ''\n b = ''\n words.each_with_index do |word_a, i|\n first_word = word_a.downcase.split('').sort\n final << [word_a]\n words.each_with_index do |word_b, j|\n if word_a == word_b\n else\n if first_word == word_b.downcase.split('').sort\n final[i] << word_b\n words.delete(word_b)\n else\n end\n end\n end\n end\n return final\nend",
"def combine_anagrams(words)\n\tresult = []\n\twords.each do |word|\n\t\ttemp_word = sort_letters(word)\n\t\tis_found = false\n\t\tresult.each do |grouped_array|\n\t\t\tif !false and sort_letters(grouped_array.last) == temp_word\n\t\t\t\tgrouped_array << word\n\t\t\t\tis_found = true\n\t\t\tend\n\t\tend\n\t\tresult << [word] if !is_found\n\tend\n\tresult\nend",
"def combine_anagrams(words) \r\n anagrams = words.inject(Hash.new()) do |r, word|\r\n key = word.downcase.chars.sort.join\r\n r[key] ||=[]\r\n r[key] << word\r\n r\r\n end\r\n anagrams.values\r\nend",
"def combine_anagrams(words)\r\n hash = Hash.new\r\n words.each{|w|\r\n key = w.downcase.chars.sort * \"\"\r\n if hash.has_key?(key)\n hash[key] += [w]\n else\n hash[key] = [w]\n end}\r\n return hash.values\r\nend",
"def combine_anagrams(words)\n\thashes = Hash.new(0)\n\twords.each do |x|\n\t\talpha_word = x.downcase.chars.sort.join\n\n\t\tif hashes[alpha_word] == 0\n\t\t\thashes[alpha_word] = [x]\n\t\telse\n\t\t\thashes[alpha_word] = hashes[alpha_word] << x\n\t\tend\n\tend\n\toutArray = Array.new\n\thashes.each do |key, value|\n\t\toutArray << value\n\tend\n\t\n\treturn outArray\nend",
"def grouped_anagrams(strings)\n return [] if strings == []\n anagrams = {}\n\n strings.each_with_index do |string, i|\n sorted_string = string.split(\"\").sort.join(\"\").downcase\n if anagrams[sorted_string]\n anagrams[sorted_string] << string\n else\n anagrams[sorted_string] = [string]\n end\n end\n\n return anagrams.values\nend",
"def combine_anagrams(words)\r\n hash = Hash.new([])\r\n anagrams = []\r\n words.each do |word|\r\n keyword = word.downcase.chars.sort.join\r\n hash[keyword] += [word]\r\n end\r\n hash.each_value do |words|\r\n anagrams += [words]\r\n end\r\n return anagrams\r\nend",
"def combine_anagrams(words)\n outp = Hash.new;\n words.each{|w| idx = w.downcase.chars.to_a.sort.join; if outp[idx] == nil then outp[idx] = Array.new; end; outp[idx].push(w); };\n return outp.values ;\nend",
"def combine_anagrams(words) \n # for each word, sort the word to create the \n # signature for the anagrams\n anagram_groups = {}\n words.each do |w|\n key = w.downcase.chars.sort.join\n if anagram_groups[key].nil?\n anagram_groups[key] = [w]\n else\n anagram_groups[key].push(w)\n end\n end\n \n return anagram_groups.values\n\nend",
"def combine_anagrams(words)\r\n\r\n h=Hash.new([])\r\n words.map {|w| key=w.downcase.split('').sort.join; h[key]+=[w]}\r\n h.values\r\n \r\nend",
"def grouped_anagrams(strings)\n strings = {}\n\n strings.each do |string|\n # https://stackoverflow.com/questions/9464065/how-to-sort-a-strings-characters-alphabetically\n alphabetized_string = string.chars.sort.join\n if strings[alphabetized_string]\n strings[alphabetized_string] << [string]\n else\n strings[alphabetized_string] = [string]\n end\n end\n\n return strings.values\nend",
"def combine_anagrams(words)\n return [] if words.nil?\n return [] if words.length == 0\n\n h = Hash[]\n words.each {|x|\n s = x.strip.downcase.chars.sort.join\n if !h.has_key?(s)\n h[s] = [x]\n else\n h[s].push(x)\n end\n }\n h.values\nend",
"def combine_anagrams(words)\n hash = {}\n anagrams = []\n\n words.each { |w| \n sorted = w.downcase.each_char.sort.join \n\n if (hash.has_key?(sorted))\n hash[sorted].push w\n else\n hash[sorted] = Array.new.push(w)\n end\n }\n\n hash.each_value { |v|\n anagrams.push v\n }\n\n return anagrams\nend",
"def grouped_anagrams(strings)\n word_hash = {}\n\n strings.each do |word|\n char_hash = {}\n\n word.each_char do |char|\n if char_hash[char] \n char_hash[char] += 1\n else\n char_hash[char] = 1\n end\n end\n\n if word_hash[char_hash]\n word_hash[char_hash] << word\n else\n word_hash[char_hash] = [word]\n end\n end\n\n return word_hash.values\nend",
"def combine_anagrams(words)\n anagram_group = Hash.new([])\n words.each {|word| anagram_group[word.downcase.split(//).sort.join] += [word]}\n return anagram_group.values\nend",
"def combine_anagrams(words)\n hash = Hash.new\n words.each {|w|\n if(hash[w.downcase.split(\"\").sort().join] == nil)\n hash[w.downcase.split(\"\").sort().join] = [] \n end\n hash[w.downcase.split(\"\").sort().join] << w\n }\n rList = []\n hash.each_value{|v|\n rList << v\n }\n return rList\n\nend",
"def combine_anagrams(words)\r\n\t\r\n\tresult = []\r\n\twords1 = [];\r\n\twords.each {|w| words1 << w.to_s.downcase.chars.sort.join}\r\n\twords2 = words1.uniq\r\n\t\r\n\tfor i in 0 ... words2.size\r\n\t\tr = []\r\n\t\tw2 = words2[i]\r\n\t\tfor j in 0 ... words.size\r\n\t\t\tw = words[j]\r\n\t\t\tif w2.casecmp(w.to_s.downcase.chars.sort.join) == 0\r\n\t\t\t\tr << w\r\n\t\t\tend\r\n\t\tend\r\n\t\tresult << r\r\n\tend\r\n\t\r\n\treturn result\r\n\t\r\nend",
"def anagrams(array, string)\n dictionary = dictionary_hash(array)\n anagrams = []\n letters = string.chars.sort.join\n if dictionary.has_key?(letters)\n anagrams = dictionary[letters]\n end\n if anagrams.empty?\n \"No anagrams were found for #{string}\"\n else\n anagrams.each do |word|\n puts word\n end\n end\nend",
"def combine_anagrams(words)\n words_hash = Hash.new{ |hash, key| hash[key] = [] }\n words.each { |word| word_key = word.downcase.chars.sort.join; words_hash[word_key] = words_hash[word_key] << word; }\n words_list = Array.new()\n words_hash.keys.each { |key| words_list << words_hash[key] }\n return words_list\nend",
"def grouped_anagrams(strings)\n return [] if strings.empty?\n\n hash_groups = []\n anagrams_grouped = []\n\n strings.each do |string|\n string_hash = {}\n\n # count freq of characters in string through hash\n string.each_char do |char|\n if string_hash[char]\n string_hash[char] += 1\n else\n string_hash[char] = 1\n end\n end\n\n # if no hash_groups exist, add new string hash to hash group and add string to anagrams list\n if hash_groups.empty?\n hash_groups << string_hash\n anagrams_grouped << [string]\n \n # otherwise, test string hash against all previous hashes, if match, add to existing anagram group, if unique, add hash group, create new anagram group\n else\n unique = true\n hash_groups.each_with_index do |hash, index|\n if hash == string_hash\n unique = false\n anagrams_grouped[index] << string\n end\n end\n\n if unique\n hash_groups << string_hash\n anagrams_grouped << [string]\n end\n end\n end\n\n return anagrams_grouped\nend",
"def anagrams(word, words)\n words.select { |w| w.chars.sort == word.chars.sort }\nend",
"def combine_anagrams(words)\r\n cage = Hash.new()\r\n words.each do |word|\r\n sorted_word = word.split('').sort.join\r\n if cage.has_key?(sorted_word)\r\n cage.store(sorted_word, cage.fetch(sorted_word).push(word))\r\n else\r\n cage.store(sorted_word, Array.new(1,word))\r\n end\r\n end\r\n return cage.values\r\nend",
"def combine_anagrams(words)\n groups = Hash.new\n words.each do |word|\n (groups[word.downcase.chars.sort.join] ||= []) << word\n end\n groups.flatten.values_at(* groups.flatten.each_index.select {|i| i.odd?})\nend",
"def find_anagrams(base, words_list)\n words_list.select { |word| word.split('').sort == base.split('').sort }\nend",
"def find_anagrams(base, words_list)\n words_list.select { |word| word.split('').sort == base.split('').sort }\nend",
"def anagram(words)\r\n result = words.group_by { |word| word.chars.sort.join }\r\n result.each {|k, v| p v unless v.size == 1}\r\nend",
"def grouped_anagrams(strings)\n result = []\n return result if strings.empty?\n\n anagrams = {}\n strings.each do |string|\n sorted_string = string.split(\"\").sort.join(\"\")\n anagrams[sorted_string] ? anagrams[sorted_string] << string : anagrams[sorted_string] = [string]\n end\n\n return anagrams.values\nend"
] |
[
"0.82607365",
"0.8116609",
"0.8013546",
"0.7961589",
"0.7948613",
"0.79357815",
"0.7876695",
"0.78764564",
"0.7827808",
"0.7822503",
"0.7812935",
"0.77536184",
"0.7747899",
"0.77344936",
"0.77337384",
"0.7730931",
"0.7728759",
"0.77082986",
"0.7702456",
"0.7702253",
"0.7678747",
"0.7677663",
"0.7664364",
"0.76599747",
"0.7650901",
"0.764819",
"0.7644898",
"0.76422673",
"0.7632997",
"0.7628615",
"0.76283467",
"0.7611558",
"0.7607994",
"0.76071346",
"0.7591504",
"0.7590915",
"0.75870675",
"0.75869375",
"0.7579849",
"0.7578112",
"0.7567489",
"0.756383",
"0.7559605",
"0.75402474",
"0.7539037",
"0.75346833",
"0.75137633",
"0.7511108",
"0.7506551",
"0.7500837",
"0.74935627",
"0.74709636",
"0.74644256",
"0.7462714",
"0.7461263",
"0.7458225",
"0.7451315",
"0.7445875",
"0.74358624",
"0.74346733",
"0.7434094",
"0.74237734",
"0.7419626",
"0.74193984",
"0.741479",
"0.7408045",
"0.7406312",
"0.7405092",
"0.74017924",
"0.7393888",
"0.73924184",
"0.73915374",
"0.7382572",
"0.73790413",
"0.7377664",
"0.73770225",
"0.73725",
"0.736236",
"0.73612964",
"0.7349987",
"0.7345804",
"0.73444515",
"0.7343821",
"0.734315",
"0.73401177",
"0.7340108",
"0.73336434",
"0.7333076",
"0.73222965",
"0.7321838",
"0.73189676",
"0.73116297",
"0.7310793",
"0.73067915",
"0.7300243",
"0.7289855",
"0.7284521",
"0.7283518",
"0.7283518",
"0.72823745",
"0.72724354"
] |
0.0
|
-1
|
This method will return the k most common elements in the case of a tie it will select the first occuring element. Time Complexity: O(n) Space Complexity: O(n)
|
def top_k_frequent_elements(list, k)
result = []
hash = Hash.new
list.each do |letter|
if hash[letter]
hash[letter] += 1
else
hash[letter] = 1
end
end
k.times do
max = nil
hash.each do |num, value|
if value && (max.nil? || value > max)
max = num
end
end
if max
hash[max] = nil
result << max
end
end
return result end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def top_k_frequent_elements(list, k)\n results = []\n\n return list if list.length == k\n return results if list.length == 0 \n\n list = list.sort.uniq\n\n i = 0\n k.times do \n results << list[i]\n i += 1\n end \n return results\nend",
"def top_k_frequent_elements(list, k)\n result_arr = []\n return result_arr if list.length == 0\n\n frequency_hash = {}\n\n list.each do |element|\n if frequency_hash[element]\n frequency_hash[element] += 1\n else\n frequency_hash[element] = 1\n end\n end\n\n k.times do\n top_element = nil\n top_frequency = 0 \n\n frequency_hash.each do |element, frequency|\n top_frequency = frequency && top_element = element if frequency > top_frequency\n end\n\n result_arr << top_element\n frequency_hash[top_element] = 0\n end\n\n return result_arr\nend",
"def top_k_frequent_elements(list, k)\n return list if list.empty? || list.length == k\n count = {}\n \n list.each do |num|\n count[num] ? count[num] += 1 : count[num] = 1\n end\n \n sorted = count.sort_by { |k, v| -v }\n \n most_frequent = Array.new(k)\n k.times { |i| most_frequent[i] = sorted[i][0] } \n \n return most_frequent\nend",
"def top_k_frequent_elements(list, k)\n h = {}\n solution = []\n return solution if list.nil? || list.empty? || !list.is_a?(Array)\n list.each do |element|\n if h.include?(element)\n h[element] += 1\n else\n h[element] = 1\n end\n end\n k.times do\n top = nil\n h.each do |element,value| \n if value && (top.nil? || value > top)\n top = element\n end\n end \n if top \n h[top] = nil\n solution << top\n end\n end \n return solution\nend",
"def top_k_frequent_elements(list, k)\n element_occurrence = {}\n list.each do |element|\n if element_occurrence[element]\n element_occurrence[element] += 1\n else\n element_occurrence[element] = 1\n end\n end\n \n sorted_pairs = element_occurrence.sort_by {|key, value| -value }\n output = []\n k.times do |index|\n return output if sorted_pairs[index].nil?\n output << sorted_pairs[index].first\n end\n return output\nend",
"def top_k_frequent_elements(list, k)\n return [] if list.empty?\n return list if list.length == 1\n\n element_count = Hash.new()\n\n list.each do |element|\n if element_count[element]\n element_count[element] += 1\n else\n element_count[element] = 1\n end\n end\n\n result = []\n\n k.times do |i|\n count = 0\n frequent_element = nil\n element_count.each do |element, frequency|\n if frequency > count\n count = frequency\n frequent_element = element\n end\n end\n result << frequent_element\n element_count[frequent_element] = 0 if frequent_element\n end\n\n return result\n\nend",
"def top_k_frequent_elements(list, k)\n return [] if list.empty?\n\n hash = {}\n\n list.each do |element|\n if hash[element]\n hash[element] += 1\n else\n hash[element] = 1\n end\n end\n\n answer = []\n answer_length = 0\n\n highest_freq = hash.values.max\n\n while answer_length < k\n hash.each do |element, count|\n if count == highest_freq\n answer << element\n answer_length += 1\n end\n\n break if answer_length == k\n end\n\n highest_freq -= 1\n end\n\n return answer\nend",
"def top_k_frequent_elements(list, k)\n # list = [1,1,1,2,2,3]\n # k = 2\n return [] if list == []\n\n counter = {}\n\n list.each do |value|\n if counter[value]\n counter[value] += 1\n else\n counter[value] = 1\n end\n end\n\n puts counter\n\n ordered = counter.sort_by{ |key, value| value } \n\n k_most = []\n\n k.times do |i|\n k_most << ordered[-i]\n end\n\n return k_most\nend",
"def top_k_frequent_elements(list, k)\n return [] if list.empty?\n frequency = {}\n list.each do |i|\n frequency[i] ? (frequency[i] += 1) : (frequency[i] = 1)\n end\n\n nums = []\n unique = list.uniq\n max = frequency.values.max\n\n until max == 0 || nums.length == k\n unique.each do |i|\n break if nums.length == k\n if frequency[i] == max\n nums << i\n end\n end\n max -= 1\n end\n\n return nums\nend",
"def top_k_frequent_elements(list, k)\n return list if list.empty? || list.size == 2\n\n elements = []\n hash = {}\n\n list.each do |elem|\n if hash[elem]\n hash[elem] += 1\n else\n hash[elem] = 1\n end\n end\n\n k.times do\n max_key = hash.key(hash.values.max)\n elements << max_key\n hash.delete(max_key)\n end\n return elements\nend",
"def top_k_frequent_elements(list, k)\n return [] if list.empty?\n\n count_hash = Hash.new(0)\n result = []\n\n list.each do |element|\n count_hash[element] += 1\n end\n\n max_array = count_hash.sort_by { |k, v| -v }\n\n (0...k).each do |i|\n result << max_array[i][0]\n end\n\n return result\nend",
"def top_k_frequent_elements(list, k)\n return [] if list.empty?\n\n frequency_count = Hash.new(0)\n list.each do |num|\n frequency_count[num] += 1\n end\n\n top_k = frequency_count.to_a.sort_by { |e| e[1] }\n\n if k == 1\n top_k.first(k).map { |e| e[0] }\n else\n top_k.last(k).map { |e| e[0] }\n end\nend",
"def top_k_frequent_elements(list, k)\n\n return [] if list.empty?\n \n # create a hash that has each element as key and number of occurrences as value: [1, 1, 1, 2, 2, 3] => {1=>3, 2=>2, 3=>1}\n hash = {}\n list.each do |element|\n if hash[element].nil?\n hash[element] = 1\n else \n hash[element] += 1\n end\n end\n \n # get the keys associated with k max values. There is almost certainly a better way to do this \n max_arrays = hash.max_by(k) {|key, value| value} # this returns k hash pairs as arrays: {1=>3, 2=>2, 3=>1}, k = 2 => [[1, 3], [2, 2]]\n\n # return the first element from each array\n max_keys = []\n max_arrays.each do |array|\n if k == 1\n # \"will work for an array when k is 1 and several elements appear 1 time\" situation: return the first key with value of 1 in the element counts hash\n max_keys << hash.min[0]\n else\n max_keys << array[0]\n end\n end\n\n return max_keys\n\nend",
"def top_k_frequent_elements(list, k)\n if list.length == 0 \n return []\n end \n nums = {}\n list.each do |num|\n if !nums[num]\n nums[num] = 1\n else\n nums[num] += 1\n end\n end \n\n sorted = nums.sort_by {|k, v| -v}\n top_k = []\n k.times do |k|\n top_k << sorted[k][0]\n end \n return top_k\nend",
"def top_k_frequent_elements(list, k)\n return [] if list.empty?\n \n element_count = {}\n \n list.each do |element|\n if element_count[element].nil?\n element_count[element] = 1\n else\n element_count[element] += 1\n end\n end\n \n sorted_elements = element_count.sort_by(&:first)\n \n i = 0\n max_nums = []\n k.times do\n max_nums << sorted_elements[i][0]\n i += 1\n end\n \n return max_nums\nend",
"def top_k_frequent_elements(list, k)\n return [] if list == []\n\n frequency = {}\n list.each do |element|\n if frequency[element]\n frequency[element] += 1\n else\n frequency[element] = 1\n end\n end\n\n k_frequent_elements = []\n\n k.times do |i|\n max_freq = 0\n max_freq_element = nil\n frequency.each do |element, freq|\n if freq > max_freq\n max_freq = freq\n max_freq_element = element\n end\n end\n k_frequent_elements << max_freq_element\n frequency[max_freq_element] = 0 if max_freq_element\n end\n\n return k_frequent_elements\nend",
"def top_k_frequent_elements(list, k)\n res = []\n return res if list.empty?\n hash = {}\n list.each do |num|\n if hash[num]\n hash[num] += 1\n else\n hash[num] = 1\n end\n end\n \n k.times do \n max = nil\n hash.each do |num, v|\n if v && (max.nil? || v > max)\n max = num \n end\n end\n if max\n hash[max] = nil\n res << max\n end\n end\n \n return res\nend",
"def top_k_frequent_elements(list, k)\n return [] if list == []\n hash = Hash.new(0)\n counter = 0;\n list.each do |value|\n hash[value] = [] if hash[value].nil?\n hash[value]+=1\n end\n \n if k > hash.size()\n raise ArgumentError, \"Not Enough Values to Display\"\n end\n \n solution = hash.max(k){ |a, b| b<=>a} \n p solution\n numbers = []\n solution.each do |array|\n numbers << array[0]\n end\n return numbers\nend",
"def top_k_frequent_elements(list, k)\n return [] if k == 0\n\n frequency = {}\n list.each do |element|\n frequency[element] ? frequency[element] += 1 : frequency[element] = 1\n end\n\n return frequency.keys[0...k]\nend",
"def top_k_frequent_elements_version2(list, k)\n # edge cases\n return list if list.empty? || list.size == 1\n\n occurances_counter = {}\n list.each do |digit|\n if occurances_counter[digit]\n occurances_counter[digit] += 1\n else\n occurances_counter[digit] = 1\n end\n end\n # occurances_counter looks like this for input [1,1,2,2,2]: {1=>2, 2=>3}\n # create an array out of this hash, sort it by values and return keys of k elements\n sorted_occurances = occurances_counter.to_a.sort_by{ |pair| pair[1]}\n number_pairs = sorted_occurances.slice(sorted_occurances.length - k, k)\n result = number_pairs.map do |pair|\n pair[0]\n end\n return result\nend",
"def top_k_frequent_elements(list, k)\n # load a hash table which has elements & their frequency \n element_frequency = {}\n array = []\n return array if list.length == 0\n\n list.each do |val|\n if !(element_frequency[val])\n element_frequency[val] = 1\n else\n element_frequency[val] += 1\n end\n end\n\n values = element_frequency.values.sort!\n inverted_hash = element_frequency.invert\n \n k.times do |i|\n array << inverted_hash[values[i]]\n end\n\n return array \nend",
"def top_k_frequent_elements(list, k)\n counter_hash = {}\n list.each do |value|\n if counter_hash[value].nil?\n counter_hash[value] = 1\n else\n counter_hash[value] += 1\n end\n end \n \n values_sort = counter_hash.sort_by {|key, value| -value}\n k_values = values_sort.slice(0..(k-1))\n final_values = []\n k_values.each do |value|\n final_values << value[0]\n end\n \n return final_values\nend",
"def top_k_frequent_elements(list, k)\n k_freq = []\n return k_freq if list.empty?\n \n hash_map = Hash.new\n\n list.each do |element| \n hash_map[element] ? hash_map[element] += 1 : hash_map[element] = 1\n end\n \n vals = hash_map.values \n max_vals = vals.max(k) \n \n max_vals.each do |val| \n key = hash_map.key(val)\n k_freq << key\n hash_map.delete(key)\n end\n return k_freq\nend",
"def top_k_frequent_elements(list, k)\n hash = {}\n \n list.each do |value|\n if hash[value]\n hash[value] += 1\n else\n hash[value] = 1\n end\n end\n \n top_elements = Array.new(k)\n return top_elements = hash.sort_by{ |key, value| value } \nend",
"def top_k_frequent_elements(list, k)\n return [] if list.empty? || k == 0\n\n item_with_freq = []\n item_freq = {}\n\n # make hash with freq of each element\n list.each do |item|\n if item_freq[item]\n item_freq[item] += 1\n else\n item_freq[item] = 1\n end\n end\n\n # turn hash into array and sort by freq\n item_with_freq = item_freq.to_a\n item_with_freq.sort_by { |item| item[1] }\n\n # iterate through sorted array k times and pull out top items\n top_items = []\n k.times do |i|\n top_items << item_with_freq[i][0]\n end\n\n return top_items\nend",
"def top_k_frequent_elements(list, k)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def top_k_frequent_elements(list, k)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def top_k_frequent_elements(list, k)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def top_k_frequent_elements(list, k)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def top_k_frequent_elements(list, k)\n # edge cases\n return list if list.empty? || list.size == 1\n\n occurances_counter = {}\n list.each do |digit|\n if occurances_counter[digit]\n occurances_counter[digit] += 1\n else\n occurances_counter[digit] = 1\n end\n end\n # occurances_counter looks like this for input [1,1,2,2,2]: {1=>2, 2=>3}\n\n # create an array with the input number of elements + 1\n # at indexes equal to occurance number I will store an array of occured digits\n # +1 to have the last index available, e.g. [1,1,1] => [nil, nil, nil, (here at index 3 will be digit 1)]\n sorted_occurances = Array.new(list.size + 1)\n occurances_counter.each do |digit, counter|\n if !sorted_occurances[counter]\n sorted_occurances[counter] = Array.new\n sorted_occurances[counter] << digit\n else\n sorted_occurances[counter] << digit\n end\n end\n # sorted_occurances array for input c will be like: [nil, nil, [1,3], [2], nil, nil]\n # reverse to keep the needed order of inner arrays elements, then flatten and get rid of nil elements\n sorted_occurances = sorted_occurances.reverse.flatten.select { |element| !element.nil? }\n # the result is: [2,3,1] where 1 is least frequent, 2 is most frequent in the input array\n # the last step is to slice the k number of elements\n result = sorted_occurances.slice(0, k)\n return result\nend",
"def top_k_frequent_elements(list, k)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def top_k_frequent_elements(list, k)\n \n return [] if list.empty?\n ranked_hash = {}\n ranked = []\n\n list.each do |element|\n if ranked_hash.has_key?(element)\n ranked_hash[element] += 1\n else\n ranked_hash[element] = 1\n end\n end\n\n sorted = ranked_hash.sort_by { | k, v | -v }\n\n k.times do \n max = sorted.shift\n ranked << max[0]\n k -= 1\n end\n\n return ranked \n\nend",
"def top_k_frequent_elements(list, k)\n return [] if list.empty? \n # list tracking quantities\n total_ele = list.length # O(n) operation\n return list if total_ele == 1\n top_k = Array.new(total_ele + 1){[]} # plus one for better tracking\n count_hash = {}\n\n # get frequencies of each element, O(n)\n list.each do |e|\n count_hash[e] ||= 1\n count_hash[e] += 1\n end\n\n # use a non-nested O(n) operation to sort\n # frequencies in top_k\n count_hash.each do |k,v|\n top_k[v] << k\n end\n\n return_arr = []\n \n # sort array in order now\n until total_ele == 0\n if(!top_k[total_ele].empty?)\n return_arr += top_k[total_ele]\n end\n\n total_ele -= 1\n end\n\n return return_arr[0...k]\nend",
"def top_k_frequent_elements(list, k)\n # build hashmap\n num_hash = {}\n list.each do |num|\n if num_hash[num]\n num_hash[num] += 1\n else\n num_hash[num] = 1\n end\n end\n\n # convert hashmap to array\n array_num_hash = num_hash.to_a\n\n # sort by occurences\n sorted_array_num_hash = array_num_hash.sort_by {|num| -num[1]}\n\n # sorted elements only\n sorted_numbers = sorted_array_num_hash.map{|num| num[0]}\n\n # slice sorted array by k elements\n return sorted_numbers.slice(0, k)\nend",
"def top_k_frequent_elements(list, k)\n return list if list.empty?\n\n num_frequency = {}\n\n list.each do |num|\n num_frequency[num] ? num_frequency[num] += 1 : num_frequency[num] = 1\n end\n\n top_frequent_nums = []\n\n k.times do\n max_frequency = 0\n max_frequent_num = nil\n\n num_frequency.each do |key, value|\n if value > max_frequency\n max_frequency = value\n max_frequent_num = key\n end\n end\n\n top_frequent_nums << max_frequent_num\n num_frequency[max_frequent_num] = 0\n end\n\n return top_frequent_nums\nend",
"def top_k_frequent_elements(list, k)\n return [] if list.empty?\n\n counts_hash = {}\n\n list.each do |number|\n if !counts_hash[number]\n counts_hash[number] = 1 \n else\n counts_hash[number] = counts_hash[number] + 1\n end\n end\n\n length_to_num_hash = {}\n\n counts_hash.keys.each do |number|\n if !length_to_num_hash[counts_hash[number]]\n length_to_num_hash[counts_hash[number]] = []\n end\n length_to_num_hash[counts_hash[number]] << number\n end\n\n result_length = k\n result = []\n most_freq_num = length_to_num_hash.keys.max\n\n while result_length > 0 && most_freq_num != nil && most_freq_num >= 0\n if length_to_num_hash[most_freq_num]\n length_to_num_hash[most_freq_num].each do |num|\n result << num\n result_length -= 1\n break if result_length <= 0\n end\n end\n most_freq_num -= 1\n end\n\n return result\nend",
"def top_k_frequent_elements(list, k)\n # create a counter hash for the numbers\n counter = {}\n # go through the list of numbers\n # test the hash keys, if it is not there, add it with a number 1 value\n # otherwise increment the value by 1\n list.each do |num|\n if !counter[num]\n counter[num] = 1\n else\n counter[num] += 1\n end\n end\n\n # list.each do |element|\n # counts[element] ||= 0\n # counts[element] += 1\n # end\n\n # find the K max counts\n highest_counts = counter.values.max(k)\n # return the values of those keys\n most_frequent = []\n highest_counts.each do |n|\n most_frequent << counter.key(n)\n counter.delete(counter.key(n))\n end\n return most_frequent\nend",
"def top_k_frequent_elements(list, k)\n return nil if !list\n # intialze an empty hash\n ## iterate throught the list\n #chechk if the key is in the hash,\n # if key is in the hash ++ value\n # otherwise add key and value as 1 since it's first occurance\n # now the key(uniqe) and value(how many time the int_value) happend is in the hash,\n # my_hash.sort_by { |_, value| value }.each { |key, value| puts key } (iterate throught the hash, (hash.each {|key, value|}) )\n # before pushing the key into the initalized array, check to see if the length is less than k\n # if\n hash = Hash.new\n list.each do |int_value|\n if hash.key?(int_value)\n hash[key] = +1\n else\n hash[key] = 1\n end\n end\n kth_frequent_elements = []\n counter = 0 \n pervisou_value = 0\n hash.sort_by { |k, v| -v }.each do |key, value|\n if counter < k\n kth_frequent_elements << key\n if pervisou_value != value\n pervisou_value = value\n counter += 1\n end\n # end\n # if kth_frequent_elements.length < k\n # kth_frequent_elements << key\n else\n break\n end\n end\n return kth_frequent_elements\nend",
"def top_k_frequent_b(nums, k)\n nums\n .inject(Hash.new(0)) { |h, n| h[n] += 1; h }\n .sort_by { |_, v| -v }\n .first(k)\n .map(&:first)\nend",
"def k_largest_elements(array, k)\nend",
"def k_largest_elements(array, k)\n heap = BinaryMinHeap.new { |a,b| b <=> a }\n result = []\n array.each do |el|\n heap.push(el)\n if heap.count > array.length - k\n result << heap.extract\n end\n end\n\n result\nend",
"def most_common_value(a)\n a.group_by do |e|\n e\n end.values.max_by(&:size).first\nend",
"def k_most_visited input, k\n \n hotels_to_visits = Hash.new\n \n input.each do |user|\n user.each do |hotel_id|\n hotels_to_visits[hotel_id] = (hotels_to_visits[hotel_id] || 0) + 1\n end\n end\n \n sorted_hotels_and_visits = hotels_to_visits.to_a.sort { |a,b| a[1] < b[1] }\n \n return sorted_hotels_and_visits[0..k]\n \nend",
"def k_largest_elements2(array, k) \n result = BinaryMinHeap.new\n k.times do\n result.push(array.pop)\n end\n until array.empty?\n result.push(array.pop)\n result.extract\n end\n result.store\nend",
"def find_k_biggest_number(array, k)\n numbers = []\n\n array.each do |element|\n numbers << element if numbers.size < k\n if element > numbers.min\n numbers.delete(numbers.min)\n numbers.push(element)\n end\n end\n\n numbers\nend",
"def find_key(cipher)\n (0..2).map do |offset|\n # Create a sublist starting at the given offset, taking every 3rd element\n elems = cipher.values_at(*(offset..cipher.length).step(3))\n # Find the most common item\n item = elems.group_by { |x| x }.values.max_by { |vs| vs.size }.first\n # We assume it's an int representing the ord of the space character\n item ^ \" \".ord\n end\nend",
"def k_select(a, start, fin, k)\n # fin is last index in array range\n # partition, if ind swapped is == k, then kth element\n if start == fin\n return a[start]\n end\n \n a, idx = random_partition(a, start)\n part_kth_largest = fin - idx + 1\n if part_kth_largest == k\n return a[idx]\n elsif k > part_kth_largest\n return k_select(a, start, idx - 1, k - part_kth_largest)\n else\n return k_select(a, idx + 1, fin, k)\n end\nend",
"def most_common_number(array)\n #var\n numbers_and_count = Hash.new 0\n \n array.each do |num|\n \tnumbers_and_count[num] += 1\n end\n #var\n most = numbers_and_count.sort_by { |key, value| value }.reverse\n \n top = Hash[*most.first]\n top.select { |k,v| p k }\n\nend",
"def find_most_frequent_integer(arr)\n #1. Create hash variable with default 0 value.\n hashld = Hash.new 0\n \n #2. Loop through each array element, count them, and insert the final key/value combo into the hashld hash.\n arr.each do |ele|\n \t hashld[ele] += 1\n end\n \n #3. Hold max count in variable.\n maxd = hashld.values.max\n \n #4. Create new hash containing keys with more than 1 count.\n fnlhsh = (hashld.select {|key,value| value == maxd})\n \n #5. Return array if size == 1, else return nil. \n if fnlhsh.size == 1\n final_val = fnlhsh.keys.join.to_i\n else \n final_val = nil\n end\n \n return final_val\nend",
"def find_most_frequent_integer(arr)\n new_array=[]\n final_array=[]\n if arr.uniq.length==0\n return nil\n else\n array_to_use=arr.uniq\n array_to_use.each do |x| \n new_array << [arr.count(x), x]\n final_array=new_array.sort\n end\n end\n count_array=[]\n final_array.each do |x|\n count_array << x.reverse\n end\n just_count_array=[]\n count_array.each do |x|\n just_count_array << x.pop\n end\n z=just_count_array[-1]\n res=just_count_array[0..-2].include?(z)\n if res==false\n return final_array[-1][1]\n end\nend",
"def find_most_frequent_integer(arr)\n collect = Hash.new 0\n \n arr.each do |int|\n collect[int] += 1\n end\n \n if collect.select {|k,v| v == collect.values.max}.count > 1\n nil\n else\n collect.key(collect.values.max)\n end\nend",
"def top_3\n freq_hash = each_with_object(Hash.new(0)) { |v, h| h[v] += 1 }\n freq_hash.sort_by { |k, v| -v }.first(3).map(&:first)\n end",
"def find_most_frequent_integer(arr)\n most = []\n freq = Hash.new(0)\n arr.each do |i|\n freq[i] += 1\n end\n freq.each do |k,v|\n if v == freq.values.max\n most.push(k)\n end\n end\n if most.count > 1\n nil\n else return most[0]\n end\nend",
"def find_kth_largest(nums, k)\n min, max = nums[0], nums[0]\n nums.each {|x| \n min = [min, x].min\n max = [max, x].max\n }\n while min <= max \n mid = (min + max) / 2\n count = 0;\n nums.each{|x| count += 1 if x >= mid}\n if count >= k\n min = mid + 1\n else\n max = mid - 1\n end\n end\n return max\nend",
"def find_most_frequent_integer(arr)\n count_hash = arr.each_with_object (Hash.new(0)) { |element, counts| counts[element] += 1 }\n count_hash.each { |key, value| return key if value == count_hash.values.max }\nend",
"def kth_largest(arr, k, left = 0, right = arr.length - 1)\n if k > 0 && k <= right - left + 1\n pivot = partition(arr, left, right)\n if right - pivot == k - 1\n return arr[pivot]\n end\n\n if right - pivot > k - 1\n return kth_largest(arr, k, pivot + 1, right)\n end\n# [1,2,3,4,5]\n# if pivot is arr[2]\n# then k is k - (right - pivot + 1)\n kth_largest(arr, k - right + pivot - 1, left, pivot - 1)\n end\nend",
"def returnK(list, k)\n count = list.count\n target = count - k\n list.each_with_index do |link, j|\n if j == target\n return link\n end\n end\nend",
"def frequent_itemsets\n k = 2\n l = [nil, large_one_itemsets]\n\n # Transform itemsets into a mapping of tid to {Itemset}\n tid_itemsets = database.map do |tid, items|\n [tid, items.map do |item|\n l[k - 1].find { |itemset| itemset.items[0] == item }\n end.compact.to_set]\n end\n\n until l[k - 1].empty?\n cks = gen(l[k - 1])\n kth_tid_itemsets = Hamster::Hash[{}]\n\n tid_itemsets.each do |tid, set_of_itemsets|\n # Find candidate itemsets in ck contained in the transaction\n cts = set_of_itemsets.flat_map do |ck_1|\n ck_1.extensions.select do |ck|\n ck.generators.subset?(set_of_itemsets)\n end\n end.to_set\n\n # Register the support for each transaction candidate\n cts.each { |ct| ct.support += 1 }\n\n # Update the transaction candidate list for the next k value\n kth_tid_itemsets = kth_tid_itemsets.merge(tid => cts) unless cts.empty?\n end\n\n l[k] = cks.select { |candidate| candidate.support >= min_support }\n tid_itemsets = kth_tid_itemsets.map do |tid, cts|\n [tid, cts.select { |c| l[k].include?(c) }.to_set]\n end\n\n k += 1\n end\n\n l.flatten.compact.map(&:to_h)\n end",
"def find_kth_largest(nums, k)\n nums.shuffle!\n helper(nums, 0, nums.length-1, k)\nend",
"def numberOfPairs(a,k)\n count = 0\n find_arr(a,k).each do |pair|\n if uniq(pair,k)\n count += 1\n end\n end\n return count\nend",
"def kth_largest(arr, k)\n curr = 0\n h = Heap.new\n\n k.times do \n h.insert(arr[curr])\n curr += 1\n end\n\n while curr < arr.length \n if arr[curr] > h.peek\n h.remove\n h.insert(arr[curr])\n end\n\n curr += 1\n end\n\n h.remove\nend",
"def k_largest(a,k)\n\treturn if a == nil || a.size == 0\t\n\tmin_heap = MinHeap.new() # Initialize a min heap.\n\tcount = 0\n\tresult = [] # REsult array to store output.\n\tfor i in 0..a.size-1 do\n\t\t# Insert element in min heap and increment count.\n\t\tmin_heap.insert(a[i])\n\t\tcount = count + 1\n\t\t# If count is greater than k, then pop element from heap and decrement count.\n\t\t# Note: to implement heap, we have taken first element in heap as nil.\n\t\tif count == k+1\n\t\t\tmin_heap.pop\n\t\t\tcount = count -1\n\t\tend\n\tend\n\t# When whole array is traversed, pop every element from heap and insert in result array.\n\twhile !min_heap.empty? do\n\t\tpoppped_item = min_heap.pop\n\t\tresult << poppped_item\n\tend\n\treturn result.reverse # Return by reversing result array as elements are in ascending order.\nend",
"def majority_element_3(nums)\n majority = nums.size / 3\n result = []\n counts = nums.inject({}) { |acc, n| \n acc[n] ||= 0\n acc[n] += 1\n if acc[n] > majority && !result.include?(n)\n result << n\n end\n \n acc\n }\n \n return result\nend",
"def find_most_frequent_integer(arr)\n highest_value = Hash.new(0)\n store_integer = Array.new\n arr.each do |x|\n highest_value[x] += 1\n end\n highest_value.each do |key,value|\n if value == highest_value.values.max \n store_integer.push(key) #need to put the highest value somewhere, so an array it will have to be! This was the hardest step for me. I could figure out how to return the key from the above step, but that wasn't helpful since one couldn't directly compare the keys (but putting them in an array worked.)\n end\n end \n if store_integer.length == 0 or store_integer.length >= 2 #This will return nil if there is no most frequent integer (like in the case of an empty hash), or if there are several of the most frequent integer amount\n return nil\n else\n return store_integer[0] \n end \n \nend",
"def grouped_anagrams(strings)\n anagram_hash = Hash.new\n\n strings.each do |word|\n sorted_string = word.chars.sort.join\n\n #Check if key exists with the sorted string already\n #In case of yes, add the word to the array value of the key \n if anagram_hash[sorted_string]\n anagram_hash[sorted_string] += [word] \n\n #If not, set it as a new key/value pair in the hash\n else \n anagram_hash[sorted_string] = [word]\n end \n end \n return anagram_hash.valuesend\n\n# This method will return the k most common elements\n# in the case of a tie it will select the first occuring element.\n# Time Complexity: O(n)\n# Space Complexity: O(n)\ndef top_k_frequent_elements(list, k)\n result = []\n\n hash = Hash.new\n \n list.each do |letter|\n if hash[letter]\n hash[letter] += 1\n else \n hash[letter] = 1\n end \n end \n\n k.times do \n max = nil\n hash.each do |num, value|\n\n if value && (max.nil? || value > max)\n max = num \n end \n end \n\n if max \n hash[max] = nil \n result << max \n end \n end \n return result end\n\n\n# This method will return the true if the table is still\n# a valid sudoku table.\n# Each element can either be a \".\", or a digit 1-9\n# The same digit cannot appear twice or more in the same \n# row, column or 3x3 subgrid\n# Time Complexity: ?\n# Space Complexity: ?\ndef valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def most_common_number(arr)\n max = 0\n arr.each do |el|\n max = el if arr.count(el) > max\n end\n max\nend",
"def k_closest(points, k)\n arr = points.map { |point| [euclidean_distance(point, [0, 0]), point] }.sort\n\n res = []\n k.times { res << arr.delete_at(0)[1] }\n res\nend",
"def findKth(nums1,nums2,k)\nend",
"def find_kth_largest(nums, k)\n nums.sort[-k]\nend",
"def use_KNN(training, prediction, k_number = 5)\r\n y = []\r\n distances = []\r\n training.each do |vector|\r\n y.push(vector.pop)\r\n distances.push(calculate_distance(prediction, vector))\r\n end\r\n k_first = []\r\n\r\n k_number.times do\r\n index = distances.index(distances.min)\r\n k_first.push(y[index])\r\n\r\n distances.delete_at(index || distances.length)\r\n y.delete_at(index || distances.length)\r\n end\r\n\r\n result = k_first.max_by { |i| k_first.count(i) }\r\n return result\r\nend",
"def majority_element(nums)\n counter_hash = Hash.new(0)\n\n nums.each do |num|\n counter_hash[num] += 1\n end\n\n counter_hash.find { |k,v| v == counter_hash.values.max }.first\nend",
"def find_most_frequent_integer(arr)\n #use a Hash to keep track of the number of duplicates\n new_hash = Hash.new(0)\n #iterate through each element in the array\n arr.each do |element|\n #add all elements to the new_hash and add one to the key's value if there's a duplicate\n new_hash[element] += 1\n end\n #make sure that the Array passed in contained something\n if new_hash.empty?\n return nil\n end\n #create empty array to add the key(s) with the \"highest value\" value(s)\n comparison_array = []\n #iterate through each key and value in new_hash\n new_hash.each do |x, y|\n #compare each value to the \"max\" value of the hash\n if y == new_hash.values.max\n #add any keys that match the \"highest value\" value in the \n #hash to the new array\n comparison_array.push(x)\n end\n end\n #check if more than one key was added to the new array\n if comparison_array.count > 1\n #if the array contains more than one element then there was more than one\n #repeated integer\n return nil\n else\n #if the array contains only one element then that element is the most\n #frequent integer\n return comparison_array[0]\n end\nend",
"def mode(arr)\n\th = {}\n\tarr.each do |x| \n\t\th [x] = arr.count(x)\n\tend\n\tarr = h.values.sort\n highest_count = arr.last\n h.select {|k,v| v == highest_count}.keys\nend",
"def most_common(arr) #sort array first\n arr.sort!\n most_common = 0\n most_common_count = 0\n type_count = 0\n prev = 0\n\n arr.each do |type|\n if prev == type\n type_count += 1\n else\n prev = type\n type_count = 1\n end\n\n if type_count > most_common_count\n most_common = type\n most_common_count = type_count\n end\n end\n\n most_common\nend",
"def find_most_frequent_integer(arr)\n counts = Hash.new(0)\n\n arr.each do |int|\n counts[int] += 1\n end\n\n freq = counts.values\n # returns array of frequencies [2,1]\n\n if freq.uniq! == false && freq.uniq.length > 1\n freq.max\n counts.key(freq.max)\n else\n nil\n end\n\n \nend",
"def find_most_frequent_integer(arr)\n empty = {}\n max = {}\n num = nil\n \n i = 0 \n while i < arr.length\n if empty.has_key?(arr[i]) == true\n empty[arr[i]] += 1\n else\n empty[arr[i]] = 1\n end\n i+=1\n end\n \n empty.each do |key,value|\n if value == empty.values.max\n max[key] = value\n num = key\n end\n end\n \n max.length > 1 ? nil : num\n \nend",
"def calculate_optimal_k\n k=0\n @k_optimal = Array.new(@size)\n (3..@size).each{|n|\n k+=1 while(cost(n,k)<cost(n,k+1))\n @k_optimal[n]=k\n }\n end",
"def mode(array)\n instance = Hash.new(0)\n array.each do |item|\n instance[item] += 1\n end\n most_frequent = instance.values.max\n p instance.collect { |k, v| k if v == most_frequent }.compact\nend",
"def smallest_k(ranges, k)\nend",
"def kth_largest(arr, k)\n return nil if k > arr.length\n heaped, remaining = arr[0..k-1], arr[k..-1]\n heap = Heap.new(heaped)\n remaining.each do |n|\n if n > heap.top \n heap.pop!\n heap.push(n)\n end\n end\n heap.top\nend",
"def solution(k, a)\n count = 0\n current = 0\n a.each { |length| \n current += length\n if current >= k\n current = 0\n count += 1\n end\n }\n count\nend",
"def faster_frequent_words(text, k)\n # FasterFrequentWords(Text , k)\n # FrequentPatterns ← an empty set\n # FrequencyArray ← ComputingFrequencies(Text, k)\n # maxCount ← maximal value in FrequencyArray\n # for i ←0 to 4**k − 1\n # if FrequencyArray(i) = maxCount\n # Pattern ← NumberToPattern(i, k)\n # add Pattern to the set FrequentPatterns\n # return FrequentPatterns\n\n # Input: A string Text and an integer k.\n # Output: All most frequent k-mers in Text.\n\n # Sample Input:\n # ACGTTGCATGTCGCATGATGCATGAGAGCT\n # 4\n\n # Sample Output:\n # CATG GCAT\n\n frequent_patterns = []\n frequency_array = frequency_array(text, k)\n max_count = 0\n frequency_array.each {|count| max_count = count if count > max_count }\n (0..(4**k - 1)).each do |i|\n if frequency_array[i] == max_count\n pattern = number_to_pattern(i,k)\n frequent_patterns << pattern\n end\n end\n\n return frequent_patterns\n end",
"def choose(n, k)\n return [[]] if n.nil? || n.empty? && k == 0\n return [] if n.nil? || n.empty? && k > 0\n return [[]] if n.size > 0 && k == 0\n c2 = n.clone\n c2.pop\n new_element = n.clone.pop\n choose(c2, k) + append_all(choose(c2, k-1), new_element)\n end",
"def maximumToys(prices, k)\n counter = 0\n prices.sort.each do |price|\n if (price <= k)\n counter += 1\n k -= price\n else\n break\n end\n end\n counter\nend",
"def electionsWinners(votes, k)\n m = votes.max\n m_count = 0\n winners = votes.select{|x|\n m_count += 1 if m == x\n x+k > m }.size\n if( 0 == winners)\n 1 == m_count ? 1 : 0\n else \n winners\n end\nend",
"def quickselect(lst, k)\n if lst.size <= 1\n return lst[0]\n else\n medians = []\n lst.each_slice(5).to_a.each{|g| medians << g.sort[g.size/2]}\n pivot = quickselect(medians, lst.size/10)\n left, right = lst.select{|x| x < pivot}, lst.select{|x| x > pivot}\n l = left.size\n if k == l + 1\n return pivot\n elsif k <= l\n return quickselect(left, k)\n else\n return quickselect(right, k-l-1)\n end\n end\nend",
"def mode(arr)\n count = Hash.new(0)\n arr.each { |value| count[value] += 1 }\n count = count.sort_by { |key, value| value }\n count.reverse!\n high = count[0][1]\n count.select! { |key, value| value == high } \n result = count.collect(&:first)\n result.sort!\nend",
"def most_frequent(nums)\n hash = {}\n max_occurence = 0\n\n nums.each do |num|\n if !hash.has_key?(num.to_s)\n hash[num.to_s] = 1\n else\n hash[num.to_s] += 1\n if max_occurence < hash[num.to_s] \n max_occurence = hash[num.to_s]\n end\n end\n end\n\n hash.select { |key, value| value == max_occurence }\n .map { |key, value| key.to_i} \nend",
"def find_1(arr, k)\n l = arr.length\n result = []\n arr.each_index do |i|\n (i+1).upto(l-1) do |j|\n result << [arr[i], arr[j]] if (arr[i] + arr[j]) == k\n end\n end\n result\nend",
"def mode(array)\n frequency = Hash.new\n array.each do |x|\n array.count(x)\n frequency[x] = array.count(x)\n end\n\n most_frequent = Array.new\n max = frequency.max_by { |x, y| y}\n min = frequency.min_by { |x, y| y}\n if min == max\n frequency.each do |x,y| \n most_frequent = most_frequent.push(x)\n end\n else\n most_frequent[0] = max[0]\n end\n return most_frequent\nend",
"def mode(array)\n count = Hash.new 0\n array.each do |n|\n count[n] += 1\n end\n\n frequency = count.values.max\n \n x = []\n count.each do |k, v|\n if frequency == v \n x.push k\n end\n end\n x\nend",
"def counting_sort(input, k)\n counts = Array.new(k+1)\n sorted = Array.new(input.size)\n (0..k).each { |i| counts[i] = 0 }\n # set counts [i] to the number of elements equal to i\n input.each { |element| counts[element] += 1 }\n # to preserve STABILITY we actually have to\n # track the less than or equal counts and\n # use the input array, however if we were just sorting\n # integers, (or things we don't care about for stability)\n # we could just iterate the counts from large to small\n # and output that many elements of i to the end of the output array\n\n # set counts[i] to the number of elements in input <= i\n (1..k).each { |i| counts[i] += counts[i-1] }\n # now lay everything into the output\n (input.size-1).downto(0).each do |index|\n input_elem = input[index]\n counts_elem = counts[input_elem] # ow many elements are less than this?\n # our arrays are zero indexed\n output_index = counts_elem - 1\n sorted[output_index] = input_elem\n counts[input_elem] -= 1\n end\n sorted\nend",
"def mode array\n greatestRepeats = 0\n frequent = []\n array.each do |current|\n totalCurrent = array.count current\n puts \"For \" + current.to_s + \" we have found: \" + totalCurrent.to_s + \" repeats\"\n if totalCurrent > greatestRepeats\n counter = 0\n while frequent.length > 0 #wipe frequent\n frequent.delete(counter)\n counter += 1\n end\n greatestRepeats = totalCurrent\n frequent.push current\n elsif totalCurrent == greatestRepeats && totalCurrent > 0 #add without wiping frequent\n frequent.push current\n end\n end\n\n frequent.uniq\nend",
"def mode(list)\n my_hash = {}\n list.each do |item| \n if my_hash[item]\n my_hash[item] += 1\n else\n my_hash[item] = 1\n end\n end\n max_count = my_hash.values.max\n my_hash.select { |key, value| value == max_count }.keys\nend",
"def getKth(nums1, nums2, k)\n p \"nums1: #{nums1} nums2: #{nums2} k: #{k}\"\n\n return nums2[k] if nums1.size == 0\n return nums1[k] if nums2.size == 0\n\n mid1 = nums1.size / 2\n mid2 = nums2.size / 2\n\n if nums1[mid1] > nums2[mid2]\n return getKth(nums2, nums1, k)\n end\n\n if mid1 + mid2 + 1 > k\n return getKth(nums1, nums2[0...mid2], k)\n else\n return getKth(nums1[mid1+1..-1], nums2, k - mid1 - 1)\n end\nend",
"def majority_element(nums)\n return nums.first if nums.size == 1\n return nums.sort[nums.size/2]\nend",
"def most_common(string)\n # binding.pry\n arr = string.downcase.gsub(/[^a-z0-9\\s]/i, '').split(\" \")\n arr = arr.map { |x| x.downcase }\n words_hash = arr.group_by { |x| x }\n final_arr = []\n words_hash.each do |k,v|\n #binding.pry\n if v.length > 1\n final_arr << k\n end\n end\n p final_arr\nend",
"def select_actors_greedy(k, r, n, actor_list)\n # pick the actor with the most movies as first actor\n result_a = [0]\n result_m = actor_list[0][1].clone\n result_q = result_m.length\n\n # store the indexes of actors that are still being considered\n actor_indexes = Array(1..n)\n\n # pick the remaining k-1 actors (since 1st has been picked)\n 1.upto(k-1) do |i|\n best_index = actor_indexes[0] # first actor still being considered\n best_q = result_q\n best_m = result_m.clone\n\n # examine all the actors still being considered\n for index in actor_indexes do\n # optimisation\n # don't go on if the remaining actors are too small to improve on\n # the currently found best quality\n break if result_q + actor_list[index][1].length < best_q\n\n # get all the movies that the actors are in (without duplicates)\n c_movies = best_m.clone | actor_list[index][1]\n\n # replace if better than previous solution\n if c_movies.length > best_q\n best_index = index\n best_q = c_movies.length\n best_m = c_movies\n end\n end\n\n # take the best found solution\n result_a << best_index\n result_q = best_q\n result_m = best_m\n actor_indexes.delete(best_index)\n end\n\n # convert actor ID to actor names\n return result_a.map { |i| actor_list[i][0] }\nend",
"def k_closest_points(arr, k)\n temp = []\n \n arr[0..k-1].each do |coords|\n temp << Math.sqrt((coords[0] ** 2 + coords[1] ** 2))\n end\n\n arr[k..-1].each do |coords|\n distance = Math.sqrt((coords[0] ** 2 + coords[1] ** 2))\n\n max_idx = 0\n temp.each_with_index { |temp_dist, i| max_idx = i if temp_dist > temp[max_idx] }\n\n temp[max_idx] = distance if distance < temp[max_idx]\n end\n\n temp\nend",
"def kth_to_last_element(head, k)\n # First pointer (tail) will be k nodes ahead of second. When tail hits the end,\n # second will be k elements from the end \n tail = head\n second = head\n elements_apart = 0\n until tail.next.nil?\n tail = tail.next\n # Increment second if they are k elements apart, or just increment elements apart\n elements_apart == k ? second = second.next : elements_apart += 1\n end\n # Return nil if there are less than k elements\n elements_apart == k ? second : nil\nend"
] |
[
"0.8274519",
"0.8235083",
"0.82255286",
"0.8201063",
"0.8198959",
"0.81717825",
"0.81675684",
"0.8158951",
"0.81535006",
"0.8152905",
"0.81302035",
"0.81290895",
"0.81058466",
"0.80998975",
"0.8096886",
"0.8062835",
"0.8052698",
"0.8042175",
"0.8035827",
"0.80031466",
"0.7986023",
"0.7984389",
"0.7982643",
"0.7976175",
"0.79741424",
"0.7969836",
"0.7969836",
"0.7969836",
"0.7969836",
"0.7969594",
"0.79684144",
"0.7944905",
"0.7927877",
"0.7926738",
"0.78974044",
"0.786749",
"0.78242224",
"0.77655405",
"0.72011447",
"0.70655423",
"0.6724977",
"0.65445405",
"0.65126693",
"0.6384769",
"0.63300824",
"0.62615246",
"0.6211313",
"0.6182273",
"0.6151186",
"0.6142822",
"0.6142574",
"0.6051029",
"0.6049865",
"0.6016966",
"0.6002382",
"0.5996569",
"0.59763306",
"0.59520215",
"0.5950509",
"0.5939163",
"0.5938732",
"0.59224874",
"0.59055716",
"0.5900311",
"0.58895755",
"0.5860855",
"0.5851345",
"0.5843469",
"0.5827526",
"0.5820634",
"0.58112556",
"0.5805208",
"0.5804471",
"0.57977486",
"0.57899356",
"0.57820284",
"0.5775274",
"0.57705426",
"0.57553804",
"0.57510024",
"0.5724297",
"0.5720464",
"0.5706961",
"0.56947625",
"0.56885666",
"0.5681263",
"0.56805223",
"0.5669234",
"0.56656605",
"0.5657914",
"0.56566066",
"0.56559277",
"0.56519073",
"0.56444687",
"0.5643688",
"0.56272167",
"0.5619643",
"0.56146544",
"0.56088924",
"0.5599927"
] |
0.8150817
|
10
|
This method will return the true if the table is still a valid sudoku table. Each element can either be a ".", or a digit 19 The same digit cannot appear twice or more in the same row, column or 3x3 subgrid Time Complexity: ? Space Complexity: ?
|
def valid_sudoku(table)
raise NotImplementedError, "Method hasn't been implemented yet!"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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 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 # 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 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 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 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 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 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_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 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 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 valid_sudoku(table)\n\n return true if in_row?(table) && in_column?(table) && in_box?(table)\n\n return false\n\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 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 valid_sudoku(table)\n \nend",
"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 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?\n # Valid puzzle has 9 rows.\n unless @puzzle.size == 9\n raise RuntimeError, \"Sudoku puzzle must have 9 rows.\"\n end\n\n # Valid puzzle has 9 columns of 9 cells.\n each_row do |row|\n unless row.size == 9\n raise RuntimeError, \"Each row in the Sudoku puzzle must have 9 cells.\"\n end\n end\n\n # Valid puzzle has valid cells.\n each do |cell|\n cell.valid?\n end\n\n #TODO: Find out if there are conflicts in row, column or nonet.\n\n # If we get this far without error, the puzzle is valid.\n return true\n end",
"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 valid?\n 1.upto(puzzle.size) { |index| return false unless valid_row?(index - 1) && valid_column?(index - 1) }\n sections.all? { |section| valid_section?(section) }\n end",
"def solved?\n cols = @grid.transpose\n return false unless (0..8).all? {|i| check_cols(i) && check_row(i)}\n (0..2).each do |horiz| \n (0..2).each {|vert| return false unless check_square(horiz,vert)}\n end\n true\n end",
"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 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",
"def valid?\n cells.find_all(&:filled?).compact.length == 1\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_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_sudoku(grid)\n return (check_rows(grid) and check_cols(grid) and check_squares(grid))\nend",
"def legal?\n [rows, columns, boxes].all? do |group|\n group.all? { |_, n| n.uniq == n }\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 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 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 sudoku_not_filled?\n flg = false\n @sudoku.each do |row|\n flg = true if row.include? \" \"\n end\n flg\n end",
"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 board_solved?\r\n # Check that all the cells are filled with values\r\n #\r\n (0 .. 8).each do |row|\r\n (0 .. 8).each do |col|\r\n return false unless board[row][col] > 0\r\n end\r\n end\r\n \r\n # Check column constraints\r\n #\r\n @board.each do |column|\r\n return false unless column.uniq.size == 9\r\n end\r\n \r\n # Check row constraints\r\n #\r\n @board.transpose.each do |column|\r\n return false unless column.uniq.size == 9\r\n end\r\n \r\n # Check box constraints\r\n #\r\n (0 .. 2).each do |box_x|\r\n (0 .. 2).each do |box_y|\r\n box_vals = []\r\n \r\n (0 .. 2).each do |i|\r\n (0 .. 2).each do |j|\r\n box_vals << @board[3 * box_x + i][3 * box_y + j]\r\n end\r\n end\r\n \r\n return false unless box_vals.uniq.size == 9\r\n end\r\n end\r\n \r\n true\r\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 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 valid?(board_array)\n board_array.each { |row| return false if row.length != row.uniq.length }\n return true\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 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 valid_sudoku(table)\n # seen_set = Set.new()\n # for i in \nend",
"def valid?\n !!free_cell_index\n end",
"def is_safe(grid, row, column, number)\n $count += 1\n return !exist_in_row(grid, row, number) && !exist_in_column(grid, column, number) && !exists_in_box(grid, row - (row % 3), column - (column % 3), number)\nend",
"def valid?\n return false if @first_row_index.nil?\n return false if @first_cell_index.nil?\n return false if @last_row_index.nil?\n return false if @last_cell_index.nil?\n return false if @allow_splitting.nil?\n true\n end",
"def all_cells_cleared?\n count_num_of_cells_cleared = @cleared_field.select{|key, value| value == true}.size\n total_cell_count = @column_count * @row_count\n cell_clear_check = total_cell_count - @mine_count == count_num_of_cells_cleared\n return true if !any_mines_detonated? && cell_clear_check\n false\n\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 valid?\n tally = Hash.new(0)\n tally[:xxx] = 1\n \n 5.times do |u|\n 5.times do |h|\n if !@solution[h][u].nil?\n tally[@solution[h][u]] += 1\n end\n end\n return true if tally.values.max < 2\n end\n puts \"invalid: #{tally.inspect}\"\n puts self.to_s\n return false\n end",
"def in_column?(table)\n\n table.length.times do |col|\n column_hash = Hash.new()\n\n table.length.times do |i|\n\n if column_hash[table[i][col]]\n return false\n end\n if table[i][col] != '.'\n column_hash[table[i][col]] = 1\n end\n end\n end\n end",
"def all_cells_cleared?\n count = 0\n (0..row_count).each do |row|\n (0..column_count).each do |column|\n if cell_cleared?(row, column) || contains_mine?(row, column)\n count += 1\n end\n end\n end\n if count == row_count*column_count\n true\n else\n false\n end\n end",
"def all_cells_cleared?\n cell_count = 0\n (0..row_count).each do |row|\n (0..column_count).each do |column|\n if cell_cleared?(row, column) || contains_mine?(row, column)\n cell_count += 1\n end\n end\n end\n\n (row_count * column_count) == cell_count\n end",
"def all_cells_cleared?\n x = 0\n @field.each do |row|\n y = 0\n row.each do |col|\n if !contains_mine?(x, y)\n if @field[x][y].cleared == false\n return false\n end\n end\n y += 1\n end\n x += 1\n end\n true\n end",
"def valid_column(column)\n bits = 0\n\n @size.times { |i|\n if @state[(@size *i) + column]\n bits += 1\n if bits > 1\n return false\n end\n end\n }\n\n return true\n end",
"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 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?\n (0..@dimension - 1).each do |i|\n return false unless valid_enum(row_elems(i))\n return false unless valid_enum(col_elems(i))\n return false unless valid_enum(block(i))\n end\n true\n end",
"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 full?\n @cells.all?{|element| element != \" \"}\n end",
"def all_cells_cleared?\n row_count.times do |row|\n column_count.times do |col|\n if !contains_mine?(row, col)\n return false unless cell_cleared?(row, col)\n end\n end\n end\n true\n end",
"def is_valid_cell?(cell)\n if cell.nil?\n return false\n end\n\n if cell.col < 0 || cell.row < 0\n return false\n end\n\n if cell.row < @maze.size && cell.col < @maze[0].size\n return true\n end\n\n false\n end",
"def valid_collection?(row)\n # union of array of chars with range of number chars 1.. 9 ruby preserves order\n return row.split(//) | ('1'..'9').to_a == row.split(//)\nend",
"def is_solved?\n return false unless is_rows_valid?\n return false unless is_columns_valid?\n return false unless is_subgrids_valid?\n true\n end",
"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 check_rows\n 0.upto(5) do |i|\n str = \"\"\n 0.upto(6) do |j|\n str += @board[j][i].to_s\n end\n if str.match(/RRRR|BBBB/) != nil\n return true\n end\n end\n return false\n end",
"def valid?(length, row, column, direction)\n begin\n for i in 1..length\n if @board[row][column] != \".\"\n return false\n else\n direction == \"Horizontal\" ? column += 1 : row += 1\n end\n end\n rescue\n return false\n end\n return true\n end",
"def check_full? \n \t\treturn true if @size==16 #size increase by 1 with every turn so when it reaches 16 we know that all cells are full\n\tend",
"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 full?\n cells.each do | position |\n if position == \" \"\n return false\n end\n end\n end",
"def solved?\n # Return whether the total passed in is equal to the total for a valid house.\n def is_valid_house_total?(total)\n return total == 45\n end\n\n # Return the total of adding up all the cells in this house.\n def house_total(house)\n return house.inject(0) {|sum, cell| sum + cell.to_i }\n end\n\n ## Check whether all the houses in the puzzle have valid totals.\n ##\n\n each_row do |row|\n return false unless is_valid_house_total?(house_total(row))\n end\n\n each_column do |column|\n return false unless is_valid_house_total?(house_total(column))\n end\n\n each_nonet do |nonet|\n return false unless is_valid_house_total?(house_total(nonet))\n end\n end",
"def all_cells_cleared?\n @board.each do |row|\n row.each do |cell|\n if !cell.has_bomb && !cell.is_open\n return false\n end\n end\n end\n true\n end",
"def spans_all_rows?(cells_list)\n cells_list.inject([]) {|rows, (_, r)| rows << r }.uniq.size == @board.size\n end",
"def spaces?\n @cells.map{|cell| cell[4] }.include?(0)\n end",
"def full?(cells = @cells)\n cells.all?{|taken| taken == \"X\" || taken == \"O\"}\n end",
"def full?\n !@cells.include? \" \"\n end",
"def solved?(board_array)\n return valid?(board_array) && valid?(transpose_arrays(board_array)) && valid?(create_grid(board_array))\nend",
"def check_valid (size)\n #checks length of string correct according to n x m\n if @arg.length != size\n puts \"String length incorrect\"\n end\n #checks if outer wall is all 1's\n string=''\n @col_nums.times do\n string+='1'\n end\n if !@arg[0..@col_nums-1].eql? string\n puts \"Invalid maze (outer wall)\"\n end\n (0..@row_nums*@col_nums-1).step(@col_nums) do |i|\n if @arg[i] != \"1\" || @arg[i-1] != \"1\"\n puts \"Invalid maze (outer wall)\"\n break\n end\n end\n #cell centers should be 0's\n #takes values of cell centers and uses coordinates for make_cell method\n (@col_nums..@row_nums*@col_nums-1).step(@col_nums*2) do |i|\n (1..@col_nums-2).step(2) do |j|\n if @arg[i+j]!=\"0\"\n puts \"Invalid maze (cell center)\"\n break\n else\n make_cell(i+j)\n end\n end\n end\n #cell corners should be 1's\n (0..@row_nums*@col_nums-1).step(@col_nums*2) do |i|\n (0..@col_nums-2).step(2) do |j|\n if @arg[i+j]!=\"1\"\n puts \"Invalid maze (cell corner)\"\n break\n end\n end\n end\n end",
"def check?(ptr)\n ptr_x, ptr_y = x_y(ptr)\n\n # Keep track of what we've seen\n row = {}\n col = {}\n sec = {}\n\n @board.each_with_index do |value, i|\n next if value == 0\n\n x, y = x_y(i)\n\n if y == ptr_y\n return false if row[value]\n\n row[value] = true\n end\n\n if x == ptr_x\n return false if col[value]\n\n col[value] = true\n end\n\n # Check the cells in the sector\n if x / 3 == ptr_x / 3 && y / 3 == ptr_y / 3\n return false if sec[value]\n\n sec[value] = true\n end\n end\n\n # These checks aren't *theoretically* necessary, given the algorithm,\n # but nice to have as a sanity check.\n if row.length == 9\n return false unless row.keys.inject(:+) == 45\n end\n\n if col.length == 9\n return false unless col.keys.inject(:+) == 45\n end\n\n true\n end",
"def full?\n cells.all? {|cell| cell != \" \"}\n end",
"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 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"
] |
[
"0.8212062",
"0.8189767",
"0.81472987",
"0.80699843",
"0.80013365",
"0.7923469",
"0.78971994",
"0.76089597",
"0.7595211",
"0.73546684",
"0.7339686",
"0.7301575",
"0.7012136",
"0.6995036",
"0.697842",
"0.69175667",
"0.6853357",
"0.6807671",
"0.6776444",
"0.6755473",
"0.6710372",
"0.6703097",
"0.6695406",
"0.66735125",
"0.6671516",
"0.6659843",
"0.66013867",
"0.65319437",
"0.651683",
"0.6491394",
"0.646203",
"0.64273554",
"0.6419378",
"0.6410174",
"0.64053446",
"0.6385949",
"0.638524",
"0.6384154",
"0.63568985",
"0.6336201",
"0.6326514",
"0.6311579",
"0.63025177",
"0.6301836",
"0.6295453",
"0.627894",
"0.62786275",
"0.62747663",
"0.62707704",
"0.62663263",
"0.62647986",
"0.62375253",
"0.6221494",
"0.621443",
"0.6202686",
"0.61947244",
"0.61824006",
"0.6179133",
"0.61740625",
"0.61576355",
"0.61551064",
"0.6153747",
"0.61511767",
"0.61480016",
"0.6144923",
"0.61354476",
"0.6099108",
"0.60851496",
"0.6082909",
"0.6077637",
"0.60469806",
"0.6042803",
"0.6037675",
"0.6017129",
"0.6004462",
"0.60038453",
"0.5995064",
"0.5992688"
] |
0.6490444
|
49
|
Places robot on the table
|
def place(x, y, buddy)
# Skip invalid states, when the buddy may fall down from the table
if validate_pos(x, y)
buddy.x = x
buddy.y = y
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def place_robot(new_place, direction)\n if @table_top.move_robot(new_place)\n @toy_place = new_place\n @toy_direction = direction\n end\n end",
"def place_robot(robot, x, y, direction)\n return false unless position_valid?(x, y)\n\n robot.remove if robot.table\n\n robot.instance_variable_set(:@table, self)\n robot.instance_variable_set(:@x, x)\n robot.instance_variable_set(:@y, y)\n robot.instance_variable_set(:@direction, direction)\n\n @robots.push(robot) unless robots.include?(robot)\n\n true\n end",
"def place args\n \n @is_robot_availabe = true\n \n @pos_x,@pos_y,@direction = args\n\n if not (0..TABLE_X).include?(@pos_x) or not (0..TABLE_Y).include?(@pos_y)\n puts \"Warning: The position of Robot at (#{@pos_x}, #{@pos_y}) is outside the table (5,5).\"\n @is_robot_availabe = false\n return\n end\n\n if not DIRECTIONS.include?(@direction)\n puts \"Warning: #{@direction} is invaid. Robot can only move towards the four directions: \\n\"\\\n \"#{DIRECTIONS.inspect}.\"\n @is_robot_availabe = false\n return\n end\n\n # return \"PLACE\" #for test\n end",
"def test_can_move_north\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :TEST)\n\n assert_equal(:NORTH, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(0, 0))\n\n @robot.move\n assert_equal(0, @robot.x, \"X position should be 0 (not changed)\")\n assert_equal(1, @robot.y, \"Y position should be 1 (moved 1 north)\")\n assert_equal(:NORTH, @robot.direction, \"Direction should be :NORTH (not changed)\")\n assert_equal(\"M\", @robot.get_path_value(0, 1))\n end",
"def move\n position_after_move = @position.new_coordinates_for_step_size(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n #ignore the command if robot is being out off tabletop\n if(@table_top.has_within_bounds?(position_after_move))\n @position = @position.new_coordinates_for(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n end\n end",
"def execute\n return unless @robot.table\n step_addition = Coordinate.step_addition_for(@robot.direction)\n new_coordinate = @robot.coordinate.add(step_addition)\n if @robot.table.is_on_table(new_coordinate)\n @robot.coordinate = new_coordinate\n end\n end",
"def execute\n return unless @robot.table\n x = @robot.coordinate.x\n y = @robot.coordinate.y\n direction = @robot.direction.to_s.upcase\n @out.puts(\"#{x},#{y},#{direction}\")\n end",
"def move\n case @facing\n when \"north\"\n @posY += 1 if @posY+1 < @table.width\n when \"east\"\n @posX += 1 if @posX+1 < @table.height\n when \"south\"\n @posY -= 1 if @posY-1 >= 0\n when \"west\"\n @posX -= 1 if @posX-1 >= 0\n end\n end",
"def place(x, y, orientation)\n position(x, y, @table.size)\n self.direction = orientation.to_sym\n end",
"def execute\n if @robot.placed?\n new_position = @robot.current_position.go_to(@robot.current_position.direction)\n\n @robot.current_position = new_position if @table.position_is_valid?(new_position)\n end\n end",
"def test_can_not_move_north\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :TEST, 1, 5)\n\n assert_equal(:NORTH, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(1, 5))\n\n @robot.move\n assert_equal(1, @robot.x, \"X position should be 1 (not changed)\")\n assert_equal(5, @robot.y, \"Y position should be 5 (not changed)\")\n assert_equal(:NORTH, @robot.direction, \"Direction should be :NORTH (not changed)\")\n assert_equal(\"P\", @robot.get_path_value(1, 5))\n end",
"def test_can_move_south\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :SOUTH, 1, 2)\n\n assert_equal(:SOUTH, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(1, 2))\n\n @robot.move\n assert_equal(1, @robot.x, \"X position should be 1 (not changed)\")\n assert_equal(1, @robot.y, \"Y position should be 1 (moved 1 south)\")\n assert_equal(:SOUTH, @robot.direction, \"Direction should be :SOUTH (not changed)\")\n assert_equal(\"M\", @robot.get_path_value(1, 1))\n end",
"def place_robot(x,y,name)\n if (0..max_length).include?(x) && (0..max_height).include?(y)\n self.robot_position[name] = [x,y]\n end\n end",
"def execute\n if @table.is_on_table(@coordinate) && !@robot.table\n @robot.put_on_table(@table,@coordinate,@direction)\n end\n end",
"def test_scenario1 \n r = robot\n r.move(table)\n assert_equal('0,1,NORTH', r.report)\n end",
"def test_can_move_west\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :WEST, 5, 5)\n\n assert_equal(:WEST, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(5, 5))\n\n @robot.move\n assert_equal(4, @robot.x, \"X position should be 4 (moved 1 east)\")\n assert_equal(5, @robot.y, \"Y position should be 5 (not changed)\")\n assert_equal(:WEST, @robot.direction, \"Direction should be :WEST (not changed)\")\n assert_equal(\"M\", @robot.get_path_value(4, 5))\n end",
"def test_can_not_move_south\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :SOUTH, 1, 0)\n\n assert_equal(:SOUTH, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(1, 0))\n\n @robot.move\n assert_equal(1, @robot.x, \"X position should be 1 (not changed)\")\n assert_equal(0, @robot.y, \"Y position should be 0 (not changed)\")\n assert_equal(:SOUTH, @robot.direction, \"Direction should be :SOUTH (not changed)\")\n assert_equal(\"P\", @robot.get_path_value(1, 0))\n end",
"def place(robot, x:0, y:0)\n raise PlacementError.new \"Coordinates (#{x},#{y}) are not on this board\" if \n !width_range.include?(x) || !height_range.include?(y)\n # @playing_field[x][y] = robot\n @robots[robot] = {x: x, y: y}\n robot.place(self)\n end",
"def test_can_move_east\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :EAST, 1, 2)\n\n assert_equal(:EAST, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(1, 2))\n\n @robot.move\n assert_equal(2, @robot.x, \"X position should be 2 (moved 1 east)\")\n assert_equal(2, @robot.y, \"Y position should be 2 (not changed)\")\n assert_equal(:EAST, @robot.direction, \"Direction should be :EAST (not changed)\")\n assert_equal(\"M\", @robot.get_path_value(2, 2))\n end",
"def move\n placed?\n if @direction == \"NORTH\"\n raise \"Out of bounds\" unless @tabletop.table_boundary?(@x, (@y+1))\n @y+=1\n elsif @direction == \"SOUTH\"\n raise \"Out of bounds\" unless @tabletop.table_boundary?(@x, (@y-1))\n @y-=1\n elsif @direction == \"WEST\"\n raise \"Out of bounds\" unless @tabletop.table_boundary?((@x-1), @y)\n @x-=1\n elsif @direction == \"EAST\"\n raise \"Out of bounds\" unless @tabletop.table_boundary?((@x+1), @y)\n @x+=1\n end\n end",
"def test_can_not_move_west\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :WEST, 0, 4)\n\n assert_equal(:WEST, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(0, 4))\n\n @robot.move\n assert_equal(0, @robot.x, \"X position should be 0 (not changed)\")\n assert_equal(4, @robot.y, \"Y position should be 4 (not changed)\")\n assert_equal(:WEST, @robot.direction, \"Direction should be :WEST (not changed)\")\n assert_equal(\"P\", @robot.get_path_value(0, 4))\n end",
"def move\n origin = @table.find(self)\n\n # Check if the robot can move without falling off the table\n case @direction\n when Direction::NORTH\n movement = Coordinate.new(0, 1)\n when Direction::EAST\n movement = Coordinate.new(1, 0)\n when Direction::SOUTH\n movement = Coordinate.new(0, -1)\n when Direction::WEST\n movement = Coordinate.new(-1, 0)\n end\n destination = origin + movement\n return unless @table.contain? destination\n\n # Safe to move\n @table.place origin, nil\n @table.place destination, self\n end",
"def place_command_proceed\n @robot.place(@x_position.to_i, @y_position.to_i, @vector.to_s.strip)\n end",
"def place\n next_move = {x: command.arguments[:x], y: command.arguments[:y]}\n if inside_table?(next_move_x_y(next_move, false))\n update_position!(next_move_x_y(next_move, false))\n update_direction!\n else\n almost_die\n end\n end",
"def execute\n return unless @robot.placed?\n\n original_position = @robot.position\n new_position = original_position.dup\n new_position.move\n\n @robot.position = new_position if @table.position_valid?(new_position)\n end",
"def move\n case self.direction\n when 'NORTH'\n self.y += 1 unless self.y == @table.y\n when 'EAST'\n self.x += 1 unless self.x == @table.x\n when 'SOUTH'\n self.y -= 1 unless self.y == 0\n when 'WEST'\n self.x -= 1 unless self.x == 0\n end\n end",
"def initialize\n\t\t@table = Table.new\n\t\t@robot = Robot.new(@table)\n\t\t@height = @table.instance_variable_get(:@height)\n\t\t@width = @table.instance_variable_get(:@width)\n\t\t@min = @table.instance_variable_get(:@min)\n\t\t@x = @robot.instance_variable_get(:@x)\n\t\t@y = @robot.instance_variable_get(:@y)\n\t\t@robot_direction = @robot.instance_variable_get(:@robot_direction)\n\tend",
"def test_can_not_move_east\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :EAST, 5, 2)\n\n assert_equal(:EAST, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(5, 2))\n\n @robot.move\n assert_equal(5, @robot.x, \"X position should be 5 (not changed)\")\n assert_equal(2, @robot.y, \"Y position should be 2 (not changed)\")\n assert_equal(:EAST, @robot.direction, \"Direction should be :EAST (not changed)\")\n assert_equal(\"P\", @robot.get_path_value(5, 2))\n end",
"def place(rbot, x: nil, y: nil, direction: nil)\n rbot.at(x, y)\n rbot.orient(direction)\n end",
"def place(position, orientation, table)\n if table.has_coordinate(position)\n @position = position\n @orientation = orientation\n @table = table\n end\n end",
"def update_head_vertical_location(row)\n locate_head[0] = row\n end",
"def move\n check_placement\n\n new_position = make_move(current_position, direction)\n position(new_position[0], new_position[1], @table.size)\n end",
"def initialize(width, height)\n @table = Table.new(width, height)\n @view = RobotView.new\n @robot = Robot.new(@table)\n end",
"def move(robot, direction_sym)\n raise PlacementError.new \"Robot is not on this table\" unless placed?(robot)\n new_position = calculate_position(@robots[robot].clone, direction_sym)\n # Move the robot by placing it at its new location\n place(robot, **new_position)\n end",
"def move\n if @placed\n position = @face.move(@x, @y)\n x = position[0]\n y = position[1]\n if @table.validate(x, y)\n @x = x\n @y = y\n end\n end\n end",
"def place(x, y, heading_symbol)\n heading = Heading.create(heading_symbol)\n valid_location = @board.safe_location(x, y)\n if valid_location && heading\n @state.unshift(Robot.new(x,y,heading))\n else\n puts \"Invalid heading: #{heading}\" if heading.nil?\n puts \"Invalid location: (#{x}, #{y}). Must be between (0, 0) and (#{@width}, #{@height})\" unless valid_location\n end\n self\n end",
"def valid_placement?\n\t\t@table.placed_on_table?(@x, @y) && @robot.vectors.include?(@robot_direction)\n\tend",
"def choppy_movement_tb\n @tb_grid_mv = @tb_grid_mv == 3 ? 0 : @tb_grid_mv + 1\n if TactBattleManager.tact_battle? && @tb_grid_mv == 2 \n Sound.play_cursor if Input.dir4 > 0 && @x == @real_x && @y == @real_y\n mv_by_input_tb_mod\n end\n end",
"def move\n case @toy_direction\n when \"NORTH\"\n new_place = [@toy_place[0], @toy_place[1] + 1]\n when \"EAST\"\n new_place = [@toy_place[0] + 1, @toy_place[1]]\n when \"SOUTH\"\n new_place = [@toy_place[0], @toy_place[1] - 1]\n when \"WEST\"\n new_place = [@toy_place[0] - 1, @toy_place[1]]\n end\n place_robot(new_place, @toy_direction)\n end",
"def place(x, y, direction_to_face)\n # Check if we're working with a valid destination\n if @table.valid_destination x, y \n # Set our new position instance variable values\n @current_position[:x] = x\n @current_position[:y] = y\n @current_position[:direction] = direction_to_face\n\n puts \"Toy Robot placed at (#{@current_position[:x]}, #{@current_position[:y]}) facing #{@current_position[:direction]}\"\n\n return true\n else\n puts \"Invalid placement given, please specify a valid place within the range of the table in the format X, Y e.g. PLACE 1, 2\" \n return false\n end\n end",
"def place(command)\n\t\tcommand.sub!(\"PLACE\", \"\")\n\t\tif (command =~ /\\s*\\d,\\d,\\w+/).nil?\n\t\t\tputs \"\"\n puts \"You forgot to tell the robot where to be placed or ..\"\n else\n \t\t@x, @y, @robot_direction = command.split(\",\")\n \t\t@x = number_or_nil(@x)\n \t\t@y = number_or_nil(@y)\n end\n\t\t#validates the location of the placement\n\t\tif valid_placement?\n\t\t\t@robot.location(@x, @y, @robot_direction)\n\t\t\tputs \"\"\n\t\t\tputs \"The robot has been placed at #{@x} #{@y} facing #{@robot_direction}. Let\\'s go on a rampage!\"\n\t\telse\n\t\t\tputs \"..the place command is incorrectly formatted or outside the table bounds. \"\n\t\t\tputs \"The boundries of this world reach from #{@min},#{@min} up to #{@width - 1},#{@height - 1}\"\n\t\t\tputs \"A place command looks like \\'PLACE 0,0,North \\' \"\n\t\tend\n\tend",
"def test_scenario3\n r = Robot.new(1, 2, 'EAST')\n r.move(table)\n r.move(table)\n r.turn_left\n r.move(table)\n assert_equal('3,3,NORTH', r.report)\n end",
"def move\n # Robot cannot move if not placed on the table.\n if !self.on_table\n return false\n end\n\n # Assigning new coordinates depending on the orientation\n # The robot can only move 1 unit at a time\n # If the new coordinate is outside of the table, return false\n case self.orientation\n when 0\n if !(self.x + 1).between?(0,4)\n return false\n else\n self.x += 1\n end\n\n when 90\n if !(self.y - 1).between?(0,4)\n return false\n else\n self.y -= 1\n end\n\n when 180\n if !(self.x - 1).between?(0,4)\n return false\n else\n self.x -= 1\n end\n\n when 270\n if !(self.y + 1).between?(0,4)\n return false\n else\n self.y += 1\n end\n\n else\n return false # If the orientation is none of the authorised values, return false\n end\n\n return true\n end",
"def put_on_table(table, coordinate, direction)\n raise 'nil validation error' if table.nil? || coordinate.nil? || direction.nil?\n @table = table\n self.coordinate=coordinate\n self.direction=direction\n end",
"def redraw\n (1..5).each do |n|\n row = 6 - n\n \n if floor == n\n @table.setValueAt(passenger_person_glyph, row, elevator_column)\n else\n @table.setValueAt(\"\", row, elevator_column)\n end\n end\n \n @building.redraw(@table)\n end",
"def go_to(rows,cols,face=nil)\n \tface = 'north' if (rows == 0 && cols == 0)\n @position.change ({:x => rows, :y => cols, :face => face.to_sym}) if face\n end",
"def execute(command)\n if command =~ /^PLACE\\s+\\d+\\s*,\\s*\\d+\\s*,\\s*(NORTH|SOUTH|EAST|WEST)$/\n command, x, y, direction = command.gsub(',', ' ').split\n robot.place(table, Position.new({x: x.to_i, y: y.to_i, direction: direction}))\n elsif command == \"MOVE\"\n robot.move(table)\n elsif command == \"LEFT\"\n robot.left\n elsif command == \"RIGHT\"\n robot.right\n elsif command == \"REPORT\"\n robot.report\n else\n \"Invalid command!\"\n end\n end",
"def place(x, y)\n self.robot_position = {\n x: x,\n y: y\n } if valid_coordinates?(x, y)\n end",
"def table_click_index(name,x,y,top = 2)\n first_row = top # header bar + top of table\n first_row += 2 if self.special_elements[:table][:header]\n\n if y >= top && y < self.height - 1\n y - first_row\n else\n nil\n end\n end",
"def put_in_tableau\n if can_put_in_tableau?\n @cards.keys.each_with_index do |card, i|\n add_to_pile_beneath(card)\n if @pile_beneath.size == 1 # It was empty one line before.\n card.pos = @pile_beneath.pos + [0, i*19]\n else\n card.pos = @pile_beneath.cards[-2].pos + [0, 19]\n end\n @pile.cards.last.face_up unless @pile.empty?\n end\n else\n call_off\n end\n end",
"def place_object\n @board.place_object *next_position\n end",
"def home\n @heading = 0.0\n @xy = [0.0, 0.0]\n @pen_is_down = false\n end",
"def valid_move?\n\t\t@table.stays_on_table?(@robot_direction, @x, @y)\n\tend",
"def update_position!(next_move)\n table.x = next_move[:x]\n table.y = next_move[:y]\n end",
"def placehuman(boat, row, col, grid) \n\t\tif grid == 1\n\t\t\tgrid = $shot_at\n\t\telse\n\t\t\tgrid = $comp\n\t\tend\n\n\t\tcount = 0\n\t\thold = 0\n\t\tdone = 0\n\t\trow = row -1\n\t\tcol = col -1\n\t\t$error = 0\n\t\tuntil done == 1\n\t\t\thold = 0\n\t\t\tif $vert == true\n\t\t\t\tif row + boat > 9\n\t\t\t\t\t$error = 1\n\t\t\t\telse\n\t\t\t\t\tboat.times do |x|\n\t\t\t\t\t\thold = hold + grid[row + x][col]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse \n\t\t\t\tif col + boat > 9\n\t\t\t\t\t$error = 1\n\t\t\t\telse\t\n\t\t\t\t\tboat.times do |x|\n\t\t\t\t\t\thold = hold + grid[row][col + x]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tif hold == 0 && $error == 0\n\t\t\t\tif $vert == true\n\t\t\t\t\tboat.times do |x|\n\t\t\t\t\t\tgrid[row + x][col] = 1\n\t\t\t\t\tend\n\t\t\t\telse \n\t\t\t\t\tboat.times do |x|\n\t\t\t\t\t\tgrid[row][col + x] = 1\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tdone = 1\n\t\t\telse\n\t\t\t\tdone = 1\n\t\t\t\t$error =1\n\t\t\tend\n\t\tend\n\tend",
"def setup_board\r\n place_pawns\r\n place_bishops\r\n place_rooks\r\n place_knights\r\n place_queens\r\n place_kings\r\n end",
"def home\n pen_up\n self.xy = ORIGIN\n self.heading = 0.0\n end",
"def move_robot_forward details\r\n\tif(details.f == 1 and details.y<5)\r\n\t\tdetails.y += 1\r\n\telsif(details.f == 2 and details.x<5)\r\n\t\tdetails.x += 1\r\n\telsif(details.f == 3 and details.y>0)\r\n\t\tdetails.y -= 1\r\n\telsif(details.f == 4 and details.x>0)\r\n\t\tdetails.x -= 1\r\n\telse\r\n\t\tprint(\"\\nRobot will fall off the table. Aborting movement.\")\r\n\tend\r\n\tdetails\r\nend",
"def place_robot(args)\n x, y, direction = args.split(',')\n [x, y, direction].each do |arg|\n fail 'Missing argument' if arg.to_s.empty?\n end\n\n @toy_robot.place x.strip.to_i, y.strip.to_i,\n direction.strip.downcase.to_sym\n end",
"def update_head_horizontal_location(column)\n locate_head[1] = column\n end",
"def dine(table, position, waiter)\r\n @waiter = waiter\r\n @position = position\r\n\r\n @left_chopstick = table.left_chopstick_at(position)\r\n @right_chopstick = table.right_chopstick_at(position)\r\n\r\n think\r\n end",
"def unit_move_tb(x,y)\n @tb_event.flash_soft_tb = false if @tb_event\n give_move_command(@tb_event)\n @tb_event.tb_unit.used_action(:move, @tb_event.tb_unit.move)\n @showing_temp_hls = false\n end",
"def home()\n\t\t@cursor_y = 0\n\t\t@cursor_x = 0\n\tend",
"def move\n\n if @position != []\n if @position[2] == \"EAST\"\n @position[0] += 1\n elsif @position[2] == \"WEST\"\n @position[0] -= 1\n elsif @position[2] == \"NORTH\"\n @position[1] += 1\n elsif @position[2] == \"SOUTH\"\n @position[1] -= 1\n end\n check_position()\n else\n puts \"Invalid Command!!.\\nPlease execute command (place) to place the robot on the table.\"\n end\n @position\nend",
"def interpret_place(command)\n matches = command.upcase.match(/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(NORTH|SOUTH|EAST|WEST)/)\n raise CommandError, \"Invalid place command.\" if matches.nil?\n \n xpos = matches[1].to_i\n ypos = matches[2].to_i\n direction = matches[3]\n \n coords = Coordinate.new(xpos, ypos)\n direction = Direction[direction]\n \n if @robot.nil?\n @robot = Robot.new(coords, direction, @table)\n else\n @robot.place(coords, direction, @table)\n end\n end",
"def move_east\n # Each time we move_east we move the Robot 1 space to the left\n @east += 1\n end",
"def robot_move\n state_execute do |robot|\n robot.move\n end\n end",
"def place(x, y, direction)\n # Set target position. Cancel processing the method if it's outside current surface\n target_position = NavigationEntities::Position.new(x, y)\n return cancel_action(\"Robot can't be placed outside\") unless surface.position_on_surface?(target_position)\n\n # Set direction of the robot. Store it in the placement object.\n target_direction = NavigationEntities::Direction.new(direction)\n self.target_placement = NavigationEntities::Placement.new(target_position, target_direction)\n\n # Update information about current location.\n update_placement(target_placement)\n end",
"def south\n Textcell.new(@x, @y+1,@parent)\n end",
"def place?(robot, direction_sym)\n true\n end",
"def move\n # Check that we have been placed\n if self.placed?\n # Create a new version to hold our new position for validation later\n new_position = @current_position.dup\n \n # Get our direction constant to establish whether we want to operate on the X or Y co-ordinate and whether to subtract or add based on direction\n direction_constant = self.get_direction_constant\n\n # Calculate our new position operating on the correct coordinate with the correct operation using the constants we have on the class\n new_position[direction_constant[:coordinate]] = new_position[direction_constant[:coordinate]] + direction_constant[:operation_value] \n # Check if the new position is valid move to this position\n if @table.valid_destination new_position[:x], new_position[:y]\n # Set our new valid position\n @current_position = new_position \n puts \"The Toy Robot has moved to (#{@current_position[:x]}, #{@current_position[:y]}) facing #{@current_position[:direction]}...\"\n else\n puts \"The Toy Robot cannot move any further, position unchanged, skipping command...\"\n return false\n end\n else\n puts \"The Toy Robot has not been placed, skipping command...\"\n return false\n end\n end",
"def north\n return nil if @y == 0\n Textcell.new(@x, @y-1,@parent)\n end",
"def update(x, y, face)\n # raise error for invalid arguments\n raise ArgumentError, 'Robot x position is invalid.' unless x.is_a?(Numeric)\n raise ArgumentError, 'Robot y position is invalid.' unless y.is_a?(Numeric)\n raise ArgumentError, 'The direction where the robot is facing is not provided.' if face.nil?\n \n if @table.validate(x, y)\n @x = x\n @y = y\n @face = Direction.toDirection(face)\n @placed = true\n end\n end",
"def ensure_cursor_visible\r\n self.top_col = index if index < top_col\r\n self.bottom_col = index if index > bottom_col\r\n end",
"def move\n if inside_table?(next_move_x_y(next_move))\n update_position!(next_move_x_y(next_move))\n else\n almost_die\n end\n end",
"def configure_cells\n\t\teach_cell do |cell|\n\t\t\trow, col = cell.row, cell.column\n\n\t\t\tcell.north = self[row - 1, col]\n\t\t\tcell.south = self[row + 1, col]\n\t\t\tcell.east = self[row, col + 1]\n\t\t\tcell.west = self[row, col - 1]\n\t\tend\n\tend",
"def position_for_next_harvest()\n turn_right()\n move()\n turn_right()\n end",
"def edit_table_cell(table, coords)\n append_to_script \"edit_table_cell \\\"#{table}\\\" , \\\"#{coords}\\\"\"\n end",
"def exec(position)\n return unless table.valid_position?(position)\n\n robot.update_robot(position)\n end",
"def insert_table(ingredients)\n @ingredients = ingredients\n rows = [ingredients].transpose\n table = Terminal::Table.new headings: %w(Ingredients), rows: rows\n puts Paint[table, :red]\n end",
"def setup \n size 640, 360\n @arm = SpinArm.new width/2, height/2, 0.01\n @spots = SpinSpots.new width/2, height/2, -0.02, 90.0\nend",
"def up(robot, robot_positions)\n move_vertical(robot, robot_positions, :up)\n end",
"def place(args)\n return if (args.empty?) ||\n (args.length != 3) ||\n (args[0].to_i < 0 || args[0].to_i >= @table.height) ||\n (args[1].to_i < 0 || args[1].to_i >= @table.width) ||\n !DIRECTIONS.include?(args[2])\n\n @posX = args[0].to_i\n @posY = args[1].to_i\n @facing = args[2]\n @placed = true\n end",
"def start_actor_place\n if Layy_Meta.active\n Layy_Meta.focus_on_coordinates(@place_loc.first[0], @place_loc.first[1])\n end\n start_actor_place_mgc_lm_gtbs\n @placement_done = true\n end",
"def locate\n x = mouse_x + @viewport.ox\n approx = x * value.length / @sprite.bitmap.width\n match = approach(approx, x)\n @text.cursor_jump(match)\n @viewport.ox -= 10 if mouse_x < 0\n @viewport.ox += 10 if (self.width - mouse_x) < 0\n end",
"def table1_e18( game_board, professor, prof_position_finder )\n log_event( game_board, __method__ )\n professor.spotted( game_board, self, prof_position_finder )\n end",
"def reset_robot\n @commands_array = []\n @next_command_index = 0\n\n # Robot robot should not move before getting PLACEd.\n @is_placed = false\n\n # Start at origin, looking EAST.\n @face = FACES.keys[0]\n @location = {:x=>0, :y=>0}\n end",
"def putOnTable\n # take the 12 cards on top of the deck and deal on \"table\"\n @cardsOnTable = @cards[0..11]\n 12.times{@cards.shift}\n end",
"def place_rooks\r\n $board[0][0] = Rook.new('white')\r\n\t\t$board[7][0] = Rook.new('white')\r\n\t\t$board[0][7] = Rook.new('black')\r\n\t\t$board[7][7] = Rook.new('black')\r\n end",
"def sit(table)\n puts \"#{name} sits down at table\"\n table.smokers << current_actor # DON'T USE SELF!\n @table = table\n\n transition :procuring\n end",
"def ensure_cursor_visible\n self.top_col = index if index < top_col\n self.bottom_col = index if index > bottom_col\n end",
"def ensure_cursor_visible\n self.top_col = index if index < top_col\n self.bottom_col = index if index > bottom_col\n end",
"def ensure_cursor_visible\n self.top_col = index if index < top_col\n self.bottom_col = index if index > bottom_col\n end",
"def ensure_placed\n raise CommandError, \"The robot must be PLACEd first.\" if @robot.nil?\n end",
"def move(robot_name,robot_direction)\n case robot_direction\n when \"NORTH\"\n self.robot_position[robot_name][1] +=1 if robot_position[robot_name][1] < max_height\n when \"SOUTH\"\n self.robot_position[robot_name][1] -=1 if robot_position[robot_name][1] > 0\n when \"WEST\"\n self.robot_position[robot_name][0] -=1 if robot_position[robot_name][0] > 0\n when \"EAST\"\n self.robot_position[robot_name][0] +=1 if robot_position[robot_name][0] < max_length\n else\n nil\n end\n end",
"def update_placement\n self.x = (Graphics.width - self.width) / 2\n self.y = (Graphics.height - self.height) / 2\n end",
"def move!\n if placed?\n case orientation.to_sym\n when :NORTH then @y += 1 if valid_coordinates?(x, y + 1)\n when :EAST then @x += 1 if valid_coordinates?(x + 1, y)\n when :SOUTH then @y -= 1 if valid_coordinates?(x, y - 1)\n when :WEST then @x -= 1 if valid_coordinates?(x - 1, y)\n end\n nil\n else\n raise RobotSimulation::NotPlacedError, \"Robot has not been placed yet.\"\n end\n end",
"def draw_on(matrix)\n @position.each_with_index do |coords, i|\n coords.symbolize_keys!\n if i.zero?\n matrix.set(coords[:x], coords[:y], \"head-#{@snek.id}\")\n elsif i == (position.length - 1)\n matrix.set(coords[:x], coords[:y], \"tail-#{@snek.id}\")\n else\n matrix.set(coords[:x], coords[:y], \"body-#{@snek.id}\")\n end\n end\n end",
"def execute(toyRobot)\n\t\traise \"Argument error. Needs to be of type ToyRobot\" unless toyRobot.kind_of?(ToyRobot)\n\t\ttoyRobot.move\n\tend",
"def autogrow_table_rows\n wait_until_bus_section_load\n tables.last.rows_text\n end",
"def c_topleft\n print cursor.column(0)\n print cursor.row(0)\n end"
] |
[
"0.71289927",
"0.660013",
"0.65822315",
"0.65517014",
"0.65369964",
"0.6439933",
"0.63989305",
"0.63843757",
"0.6320665",
"0.63050216",
"0.62543577",
"0.6253614",
"0.6249276",
"0.62326777",
"0.62162423",
"0.6211203",
"0.6197198",
"0.616257",
"0.6147079",
"0.6128484",
"0.6113232",
"0.6103196",
"0.6097548",
"0.6095075",
"0.6084491",
"0.6084332",
"0.6082942",
"0.601991",
"0.601084",
"0.5986279",
"0.59608924",
"0.5947411",
"0.592877",
"0.5891833",
"0.5876025",
"0.5785579",
"0.5734008",
"0.5723084",
"0.5709129",
"0.5681006",
"0.56768155",
"0.56508017",
"0.5646514",
"0.55684805",
"0.5530635",
"0.5493653",
"0.5459476",
"0.5458333",
"0.54496634",
"0.54317033",
"0.54021436",
"0.5395917",
"0.5395266",
"0.5392936",
"0.53904027",
"0.53743047",
"0.53733987",
"0.537312",
"0.5370556",
"0.5349159",
"0.5320702",
"0.53114164",
"0.52971137",
"0.52966297",
"0.5293106",
"0.52831393",
"0.5276104",
"0.52724564",
"0.5264212",
"0.5255933",
"0.5255614",
"0.5254797",
"0.5240209",
"0.5202844",
"0.520276",
"0.5194162",
"0.5187463",
"0.51802254",
"0.51770544",
"0.5173805",
"0.5166731",
"0.51662844",
"0.5161913",
"0.515659",
"0.5153463",
"0.51493514",
"0.51451945",
"0.5142921",
"0.5138907",
"0.5131465",
"0.51310897",
"0.51310897",
"0.51310897",
"0.5129888",
"0.51264906",
"0.51091325",
"0.5105288",
"0.51024765",
"0.5090536",
"0.508121",
"0.50756305"
] |
0.0
|
-1
|
Moves the robot one unit according the its current facing
|
def move(buddy)
x = buddy.x
y = buddy.y
case
when buddy.orient == Buddy::NORTH then y += 1
when buddy.orient == Buddy::SOUTH then y -= 1
when buddy.orient == Buddy::EAST then x += 1
when buddy.orient == Buddy::WEST then x -= 1
end
if validate_pos(x, y)
# Set buddy position only if the future is valid
buddy.x = x
buddy.y = y
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def move_forward\n new_location = @location + facing_direction.coordinate_component\n \n if !surface.within_bounds?(new_location)\n raise OutOfBoundaryError, \"The movement has put the robot out of boundaries\"\n end\n \n @location = new_location\n self\n end",
"def forward_move\n case @facing\n when 'NORTH'\n @y += 1\n when 'SOUTH'\n @y -= 1\n when 'EAST'\n @x += 1\n when 'WEST'\n @x -= 1\n end\n self\n end",
"def move!\n case @facing\n when Direction::NORTH\n @loc[:y] += 1 unless out_of_bounds? @loc[:x], @loc[:y] + 1\n when Direction::EAST\n @loc[:x] += 1 unless out_of_bounds? @loc[:x] + 1, @loc[:y]\n when Direction::SOUTH\n @loc[:y] -= 1 unless out_of_bounds? @loc[:x], @loc[:y] - 1\n when Direction::WEST\n @loc[:x] -= 1 unless out_of_bounds? @loc[:x] - 1, @loc[:y]\n else\n raise %q{Don't know which direction to move}\n end\n end",
"def turn_robot(name, direction)\n\t\ttarget_robot = find_robot_by_name(name)\n\t\t#switch in case we want different directions in the future, like turn around \n\t\tif target_robot != nil\n\t\t\ti = @facings.find_index(target_robot.facing)\n\t\t\tcase direction\n\t\t\twhen \"LEFT\"\n\t\t\t\ti -= 1\n\t\t\twhen \"RIGHT\"\n\t\t\t\ti += 1\n\t\t\telse\n\t\t\t\tputs \"invalid command: invalid direction\"\n\t\t\tend\n\t\t\tnew_facing = @facings[(i) % @facings.length]\n\t\t\ttarget_robot.facing = new_facing\t\n\t\tend\n\tend",
"def move(direction)\n \n end",
"def move\n case @current_rotation\n when ToyEnums::NORTH\n @position_y +=1\n when ToyEnums::SOUTH\n @position_y -=1\n when ToyEnums::EAST\n @position_x +=1\n when ToyEnums::WEST\n @position_x -=1\n else\n\n end\n end",
"def move\n check_placed\n new_position = case facing\n when :north then @position.inc_y\n when :south then @position.dec_y\n when :east then @position.inc_x\n when :west then @position.dec_y\n end\n check_position(new_position)\n @position = new_position\n end",
"def move_forward\n self.velocity_x = Gosu::offset_x(self.angle, 0.5)*self.max_velocity_x\n self.velocity_y = Gosu::offset_y(self.angle, 0.5)*self.max_velocity_y\n end",
"def move_robot(command, unit)\n if /#{FORWARD}/.match?(command)\n case $current_direction \n when 0\n $y += unit\n when 1\n $x += unit\n when 2\n $y -= unit\n else\n $x -= unit\n end\n elsif /#{BACKWARD}/.match?(command)\n case $current_direction \n when 0\n $y -= unit\n when 1\n $x -= unit\n when 2\n $y += unit\n else\n $x += unit\n end \n end \nend",
"def change_direction\n @move_x = -@move_x\n @speed = -@speed\n end",
"def move_forward\n case @orientation\n when :north\n @position.y_coordinate += 1\n when :east\n @position.x_coordinate += 1\n when :south\n @position.y_coordinate -= 1\n when :west\n @position.x_coordinate -= 1\n end\n end",
"def move\n case @direction\n when \"NORTH\" then move_north\n when \"SOUTH\" then move_south\n when \"EAST\" then move_east\n when \"WEST\" then move_west\n end\n end",
"def move\n\t\tif valid_move?\n\t\t\tputs \"\"\n\t\t\tif OS.mac?\n\t\t\t\tcmd = ('say \"roger-roger\"')\n\t\t\t\tsystem cmd\n\t\t\tend\n\t\t\tputs \"Roger, roger I\\'m moving forward one field!\"\n\t\t\tcase @robot_direction\n\t\t\twhen \"EAST\" then @x += 1\n\t\t\twhen \"WEST\" then @x -= 1\n\t\t\twhen \"NORTH\" then @y += 1\n\t\t\twhen \"SOUTH\" then @y -= 1\n\t\t\tend\n\t\telse\n puts \"This is the end of this world and I can't go further in this direction, please change direction\"\n\t\tend\n\tend",
"def move(*_)\n dir = direction_compass.to_direction(direction)\n new_value = direction_compass.direction[dir.to_sym]\n\n place(x + new_value[:x], y + new_value[:y])\n end",
"def move\n case @rover_facing\n when 'N'\n @coordinates[1] += 1\n when 'E'\n @coordinates[0] += 1\n when 'S'\n @coordinates[1] -= 1\n when 'W'\n @coordinates[0] -= 1\n end\n end",
"def move\n\t\tcase @car.orientation\n\t\t\twhen 0 \n\t\t\t\t@car.y += 1\n\t\t\twhen 2\n\t\t\t\t@car.y -= 1\n\t\t\twhen 1\n\t\t\t\t@car.x += 1\n\t\t\twhen 3\n\t\t\t\t@car.x -= 1\n\t\tend\n\tend",
"def move\n @x += @vel_x\n @y += @vel_y\n @spin += @vel_spin\n end",
"def rotate_robot(command, unit)\n if /#{RIGHT}/.match?(command)\n case unit\n when 1\n $current_direction += 1\n when 2\n $current_direction += 2\n when 3\n $current_direction += 3\n else\n $current_direction += 0\n end\n elsif /#{LEFT}/.match?(command)\n case unit\n when 1\n $current_direction += 3\n when 2\n $current_direction += 2\n when 3\n $current_direction += 1\n else\n $current_direction += 0\n end\n end\n $current_direction %= 4\nend",
"def robot_move\n state_execute do |robot|\n robot.move\n end\n end",
"def move( turn, forward)\n\t\tif forward < 0 \n\t\t raise 'Robot cant move backwards ' + forward.to_s \n\t\tend\n\t\t# turn, and add randomness to the turning command\n\t\t# puts 'o:'+(@orientation/PI).to_s\n\t\t@orientation = @orientation + turn.to_f + random_gauss(0.0, @turn_noise)\n\t\t \n\t\t\n\t\t@orientation = @orientation % ( 2 *PI )\n\t\t# puts 'o:'+(@orientation/PI).to_s\n\t\t# move, and add randomness to the motion command\n\t\tdist = forward.to_f + random_gauss(0.0, @forward_noise)\n\t\t@x = @x + (cos(@orientation) * dist)\n\t\t@y = @y + (sin(@orientation) * dist)\n\t\t@x = @x % world_size # cyclic truncate\n\t\t@y = @y % world_size\n\t \n\t\t# set particle\n\t\tres = Robot.new()\n\t\tres.set(@x, @y, @orientation)\n\t\tres.set_noise(@forward_noise, @turn_noise, @sense_noise)\n\t\treturn res\n\tend",
"def move( turn, forward)\n\t\tif forward < 0 \n\t\t raise 'Robot cant move backwards ' + forward.to_s \n\t\tend\n\t\t# turn, and add randomness to the turning command\n\t\t# puts 'o:'+(@orientation/PI).to_s\n\t\t@orientation = @orientation + turn.to_f + random_gauss(0.0, @turn_noise)\n\t\t \n\t\t\n\t\t@orientation = @orientation % ( 2 *PI )\n\t\t# puts 'o:'+(@orientation/PI).to_s\n\t\t# move, and add randomness to the motion command\n\t\tdist = forward.to_f + random_gauss(0.0, @forward_noise)\n\t\t@x = @x + (cos(@orientation) * dist)\n\t\t@y = @y + (sin(@orientation) * dist)\n\t\t@x = @x % world_size # cyclic truncate\n\t\t@y = @y % world_size\n\t \n\t\t# set particle\n\t\tres = Robot.new()\n\t\tres.set(@x, @y, @orientation)\n\t\tres.set_noise(@forward_noise, @turn_noise, @sense_noise)\n\t\treturn res\n\tend",
"def move(direction)\n @x += @velocity if direction == :right\n @x -= @velocity if direction == :left\n end",
"def move \n self.send(@orientation.current.to_sym)\n end",
"def drive(cmd)\n if @steer.include?(cmd)\n @orientation = @gps.turn(cmd)\n else\n move\n end\n end",
"def move\n if @direction.north? then @y += 1\n elsif @direction.south? then @y -= 1\n elsif @direction.east? then @x += 1\n elsif @direction.west? then @x -= 1\n end\n return self\n end",
"def move\n\t\t@x += 0\n\t\t@y += @vel\n\tend",
"def move\n if me\n turn_left if window.button_down? Gosu::KbLeft\n turn_right if window.button_down? Gosu::KbRight\n run if window.button_down? Gosu::KbUp\n run_with_ball\n end\n end",
"def move\r\n @x += @x_direction\r\n @y += @y_direction\r\n # Preventing the Alien moving out of the screen\r\n if @x > (SCREEN_WIDTH - GAME_PRESET[\"alien_reach\"]) || @x < 0\r\n @x_direction= -@x_direction\r\n elsif @y > (SCREEN_HEIGHT * @height_limit)\r\n @y_direction = 0\r\n end\r\n end",
"def accelForward\n @vel_y -= @VELOCITY\n end",
"def move(args)\n return if !@is_robot_availabe\n case @direction\n when \"NORTH\"\n if @pos_y + STEP <= TABLE_Y\n @pos_y += STEP\n return\n end\n \n when \"EAST\"\n if @pos_x + STEP <= TABLE_X\n @pos_x += STEP\n return\n end\n \n when \"SOUTH\"\n if @pos_y - STEP >= 0\n @pos_y -= STEP\n return\n end\n \n when \"WEST\"\n if @pos_x - STEP >= 0\n @pos_x -= STEP\n return\n end\n \n end\n puts \"Warning: Robot cannot move towards #{@direction} anymore. \"\n # return \"MOVE\" #for test\n end",
"def move(robot_name,robot_direction)\n case robot_direction\n when \"NORTH\"\n self.robot_position[robot_name][1] +=1 if robot_position[robot_name][1] < max_height\n when \"SOUTH\"\n self.robot_position[robot_name][1] -=1 if robot_position[robot_name][1] > 0\n when \"WEST\"\n self.robot_position[robot_name][0] -=1 if robot_position[robot_name][0] > 0\n when \"EAST\"\n self.robot_position[robot_name][0] +=1 if robot_position[robot_name][0] < max_length\n else\n nil\n end\n end",
"def move\n\t\tif @direction == \"N\"\n\t\t\t@y += 1\n\t\telsif @direction == \"W\"\n\t\t\t@x -= 1\n\t\telsif @direction == \"E\"\n\t\t\t@x += 1\n\t\telsif @direction == \"S\"\n\t\t\t@y -= 1\n\t\tend\n\tend",
"def move\n\t\t# move 5px to the left\n\t @x = @x - 5\n\t # move up or down based on the Y velocity\n\t @y = @y + @vy\n\tend",
"def turn(by: 90)\n next_direction_index = DIRECTIONS.find_index(@facing) + (by / 90).to_i\n @facing = DIRECTIONS[next_direction_index % 4]\n end",
"def turn dir\n self.a = (a + dir).degrees if dir\n end",
"def move\n case @toy_direction\n when \"NORTH\"\n new_place = [@toy_place[0], @toy_place[1] + 1]\n when \"EAST\"\n new_place = [@toy_place[0] + 1, @toy_place[1]]\n when \"SOUTH\"\n new_place = [@toy_place[0], @toy_place[1] - 1]\n when \"WEST\"\n new_place = [@toy_place[0] - 1, @toy_place[1]]\n end\n place_robot(new_place, @toy_direction)\n end",
"def turn_left\n if @@compass.index(@direction) == 0\n @direction = @@compass[-1]\n else\n current_index = @@compass.index(@direction)\n @direction = @@compass[current_index - 1]\n end\n end",
"def moving!\n end",
"def move(direction)\n @old = @pos\n @pos += direction\n end",
"def move_up\n\t\t@y_speed -= @speed_inc_step\n\t\tif @y_speed < -@max_speed\n\t\t\t@y_speed = -@max_speed\n\t\tend\n\n\t\tupdate_y(@y_speed)\n\t\t\n\t\trotation = (face_left?) ? @rotation_speed : -@rotation_speed\n\t\tif (face_left? && @angle >= 270 - @rotation_speed) ||\n\t\t\t(!face_left? && @angle <= 270 + @rotation_speed)\n\t\t\t\n\t\t\tupdate_angle(270)\n\t\telse\n\t\t\tupdate_angle(calculate_angle(rotation))\n\t\tend\n\n\t\t@has_moved = @player_moved = @moved_y_axis = true\n\tend",
"def move\n if $window.button_down?(Gosu::KbD)\n @facing = :right\n @x += speed unless out_of_bounds?(@x + speed, @y)\n end\n \n if $window.button_down?(Gosu::KbA)\n @facing = :left\n @x -= speed unless out_of_bounds?(@x - speed, @y)\n end\n \n if $window.button_down?(Gosu::KbW)\n @facing = :up\n @y -= speed unless out_of_bounds?(@x, @y - speed)\n end\n \n if $window.button_down?(Gosu::KbS)\n @facing = :down\n @y += speed unless out_of_bounds?(@x, @y + speed)\n end\n \n sprinting?\n end",
"def move!\n\t\tbounce! until !will_bounce? #TODO add surroundedness checking\n\t\t@x += @@target_coords[@direction][:dx]\n\t\t@y += @@target_coords[@direction][:dy]\n\tend",
"def move\n case @direction\n when \"N\"\n @y_coord += 1\n when \"S\"\n @y_coord -= 1\n when \"W\"\n @x_coord += 1\n when \"E\"\n @x_coord -= 1\n end\n end",
"def turning_move_style\n # spin\n @angle[0] -= @axial if $program.holding?(:turn_left)\n @angle[0] += @axial if $program.holding?(:turn_right)\n # momentum\n if $program.holding?(:move_backward)\n @x += @speed * Math::cos(@angle[0] * Math::PI / 180.0)\n @z += @speed * Math::sin(@angle[0] * Math::PI / 180.0)\n elsif $program.holding?(:move_forword)\n @x -= @speed * Math::cos(@angle[0] * Math::PI / 180.0)\n @z -= @speed * Math::sin(@angle[0] * Math::PI / 180.0)\n end\n # camera position updates\n @tx = @x - Math::cos(@angle[0] * Math::PI / 180.0)\n @ty = @y \n @tz = @z - Math::sin(@angle[0] * Math::PI / 180.0) \n end",
"def move\n if @x + @x_vel < 0\n net_move = (-2 * @x) - @x_vel\n @x += net_move\n @truex += net_move\n @x_vel = -@x_vel\n elsif @x + @x_vel > (1280 - @w)\n net_move = (2 * (1280 - @w - @x)) - @x_vel \n @x += net_move\n @truex += net_move\n @x_vel = -@x_vel\n else\n @truex += @x_vel\n @x += @x_vel\n end\n\n if @y + @y_vel < 0\n net_move = (-2 * @y) - @y_vel\n @y += net_move\n @truey += net_move\n @y_vel = -@y_vel\n elsif @y + @y_vel > (720 - @h)\n net_move = (2 * (720 - @h - @y)) - @y_vel \n @y += net_move\n @truey += net_move\n @y_vel = -@y_vel\n else\n @truey += @y_vel\n @y += @y_vel\n end\n end",
"def turnLeft\n case @currentDir\n when :north\n @currentDir = :west\n when :south\n @currentDir = :east\n when :east\n @currentDir = :north\n when :west\n @currentDir = :south\n end\n end",
"def turn(this_much)\n @angle += this_much\n calculate_heading\n end",
"def move_forward\n case @direction\n when 2\n move_down(false)\n when 4\n move_left(false)\n when 6\n move_right(false)\n when 8\n move_up(false)\n end\n end",
"def move\n \n end",
"def move\n \n end",
"def move_forward\r\r\n @move_poll+= [[@direction, true]] * (32.0 / CXJ::FREE_MOVEMENT::PIXELS_PER_STEP).ceil\r\r\n end",
"def standard_move\n pos.set(x,y)\n tar = move_towards_player\n sep = seperate_from_enemies\n sep.scalar(5.5, '*')\n tar.scalar(4.0, '*')\n apply_force(sep)\n apply_force(tar)\n if acc.x == 0 and acc.y == 0\n return\n else\n vel.add(acc)\n vel.limit(speed)\n end\n pos.add(vel)\n @x = pos.x\n @y = pos.y\n acc.scalar(0, '*')\n end",
"def move\n case @direction\n when \"n\"\n @y_axis += 1\n when \"e\"\n @x_axis += 1\n when \"s\"\n @y_axis -= 1\n when \"w\"\n @x_axis -= 1\n end\n end",
"def turn\n @delta.x = -@delta.x\n @delta.y = -@delta.y\n end",
"def move(forward,rotx,rotz)\n \n return if not (forward!=0 or rotx!=0 or rotz!=0)\n \n if CONFIG[:log][:camera]\n puts \"move: forward=#{forward} rotx=#{rotx} rotz=#{rotz}\"\n puts \"cam: pos=#{@pos} rot=#{@rot}\" \n end\n\n #@pos = @pos+@view.normalize if forward != 0\n @rot.x -= rotx\n @rot.z -= rotz\n\n end",
"def move\n move_by get_incremental_position_for_velocity if (any_velocity?)\n decrease_velocity\n @has_increased_velocity_for = {\n x: false,\n y: false\n }\n @velocity_deltatime.update\n end",
"def move(direction)\n @position += direction\n end",
"def move\n case @facing\n when \"north\"\n @posY += 1 if @posY+1 < @table.width\n when \"east\"\n @posX += 1 if @posX+1 < @table.height\n when \"south\"\n @posY -= 1 if @posY-1 >= 0\n when \"west\"\n @posX -= 1 if @posX-1 >= 0\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 move(direction)\n\t\tcase direction\n\t\twhen \"North\"\n\t\t\tmove_north\n\t\twhen \"East\"\n\t\t\tmove_east\n\t\twhen \"South\"\n\t\t\tmove_south\n\t\twhen \"West\"\n\t\t\tmove_west\n\t\tend\n\tend",
"def move(view, time, direction, speed)\n # compute how far to move\n distance = @distance_to_target * time / 5.0\n distance *= speed\n \n vec = direction\n return if( vec.length == 0.0 )\n vec.length = distance\n \n # now move the camera\n camera = view.camera\n eye = camera.eye\n target = camera.target\n up = camera.up\n \n eye.offset! vec\n target.offset! vec\n\n camera.set(eye, target, up)\nend",
"def move\n # Do not continue if robot isn't placed\n return cancel_action(\"Robot isn't placed on the surface yet\") unless placed?\n\n # Calculate target position. Cancel processing the method if it's outside current surface\n target_position = current_placement.position.add(current_placement.direction.to_unit_vector)\n return cancel_action(\"Robot can't drive outside the surface\") unless surface.position_on_surface?(target_position)\n\n # Set the current placement, calculate movement vector and pass it ot the mobility system.\n self.target_placement = NavigationEntities::Placement.new(target_position, current_placement.direction)\n mobility_system.move_by(target_position - current_placement.position)\n\n # Current mobility system is just a placeholder, so it's always executed\n if mobility_system.standby\n # Update information about current location.\n # TODO: Refactor this part when a real mobility system will be plugged in\n update_placement(target_placement)\n end\n end",
"def rotate direction\n # Check if the toy robot has been placed on the table yet\n return unless placed?\n\n # Calculate new direction by finding out the next or previous item on the const array DIRECTIONS\n curr_index = DIRECTIONS.find_index(@direction)\n \n # If the result would be out of bounds, wrap around.. \n\n\n if (direction == 1 and curr_index == 3)\n # if direction = right and the robot's direction is :west\n # we wrap around the array, so new direction = :north\n\n new_index = 0 \n elsif direction == -1 and curr_index == 0\n # if direction = left and the robot's direction is :north\n # we wrap around the array, so new direction = :west\n\n new_index = 3 \n else\n # Calculate new index based on index of the robot's position on the DIRECTIONS array \n # and the direction the robot is turning\n new_index = curr_index + direction\n end\n\n @direction = DIRECTIONS[new_index]\n end",
"def update\n accelerate(0, 1) if should_fall?\n move\n end",
"def move_home_z\n @axis_z.move_home()\n @axis_z.disable_motor()\n end",
"def move_toward(character)\n # calculate differences in x and y\n dx, dy = @real_x - character.real_x, @real_y - character.real_y\n # determines where to move according to the x and y differences\n if dx > 0 && dy > 0 # player is up left\n move_upper_left\n elsif dx > 0 && dy < 0 # player is down left\n move_lower_left\n elsif dx < 0 && dy > 0 # player is up right\n move_upper_right\n elsif dx < 0 && dy < 0 # player is down right\n move_lower_right\n elsif dx < 0 && dy == 0 # player is right\n move_right\n elsif dx > 0 && dy == 0 # player is left\n move_left\n elsif dx == 0 && dy < 0 # player is down\n move_down\n elsif dx == 0 && dy > 0 # player is up\n move_up\n end\n end",
"def move(direction)\n turn direction unless @dir_fixed\n return(stop) if scene_collision?\n \n @moving = true\n animate\n case direction\n when :up\n @y -= @speed\n when :left\n @x -= @speed\n when :down\n @y += @speed\n when :right\n @x += @speed\n end\n end",
"def move(forward)\n if @direction == \"N\"\n if @y + 1 < @@ymax\n @y += 1\n else\n puts \"Nice try sucker\"\n end\n elsif @direction == \"S\"\n if @y - 1 > @@ymin\n @y -= 1\n else\n puts \"Nice try sucker\"\n end\n elsif @direction ==\"E\"\n if @x + 1 < @@xmax\n @x += 1\n else\n puts \"Nice try sucker\"\n end\n elsif @direction == \"W\"\n if @x - 1 > @@xmin\n @x -= 1\n else\n puts \"Nice try sucker\"\n end\n else\n puts \"Where in the world are you?\"\n end\nend",
"def move_forward\n\t\tnew_position = forward_position\n\t\t@x = new_position[0]\n\t\t@y = new_position[1]\n\tend",
"def move\n # Check that we have been placed\n if self.placed?\n # Create a new version to hold our new position for validation later\n new_position = @current_position.dup\n \n # Get our direction constant to establish whether we want to operate on the X or Y co-ordinate and whether to subtract or add based on direction\n direction_constant = self.get_direction_constant\n\n # Calculate our new position operating on the correct coordinate with the correct operation using the constants we have on the class\n new_position[direction_constant[:coordinate]] = new_position[direction_constant[:coordinate]] + direction_constant[:operation_value] \n # Check if the new position is valid move to this position\n if @table.valid_destination new_position[:x], new_position[:y]\n # Set our new valid position\n @current_position = new_position \n puts \"The Toy Robot has moved to (#{@current_position[:x]}, #{@current_position[:y]}) facing #{@current_position[:direction]}...\"\n else\n puts \"The Toy Robot cannot move any further, position unchanged, skipping command...\"\n return false\n end\n else\n puts \"The Toy Robot has not been placed, skipping command...\"\n return false\n end\n end",
"def move\n origin = @table.find(self)\n\n # Check if the robot can move without falling off the table\n case @direction\n when Direction::NORTH\n movement = Coordinate.new(0, 1)\n when Direction::EAST\n movement = Coordinate.new(1, 0)\n when Direction::SOUTH\n movement = Coordinate.new(0, -1)\n when Direction::WEST\n movement = Coordinate.new(-1, 0)\n end\n destination = origin + movement\n return unless @table.contain? destination\n\n # Safe to move\n @table.place origin, nil\n @table.place destination, self\n end",
"def move\n x_mov, y_mov = MOVEMENT_VECTORS[@direction]\n\n #add vector to current position\n @x_pos += x_mov\n @y_pos += y_mov\n\n throw \"fell off plateau, position: [#{@x_pos}, #{@y_pos}]\" if @x_pos < 0 || @y_pos < 0\n throw \"fell off plateau, position: [#{@x_pos}, #{@y_pos}]\" if @x_pos > @mars_plateau.max_x || @y_pos > @mars_plateau.max_y\n\n [@x_pos, @y_pos]\n end",
"def move\n @coordinates[1] += 1 if @rover_facing == 'N'\n @coordinates[0] += 1 if @rover_facing == 'E'\n @coordinates[1] -= 1 if @rover_facing == 'S'\n @coordinates[0] -= 1 if @rover_facing == 'W'\nend",
"def turnRight\n case @currentDir\n when :north\n @currentDir = :east\n when :south\n @currentDir = :west\n when :east\n @currentDir = :south\n when :west\n @currentDir = :north\n end\n end",
"def truck(view, time)\n direction = view.camera.direction * Z_AXIS\n direction.reverse! if( (@keys & LEFT_ARROW) != 0 )\n self.move(view, time, direction, @speedx)\nend",
"def move(direction,length)\n case direction\n when \"F\"\n @position[:y] += length if @position[:facing]==\"N\"\n @position[:x] += length if @position[:facing]==\"E\"\n @position[:y] -= length if @position[:facing]==\"S\"\n @position[:x] -= length if @position[:facing]==\"W\"\n when \"B\"\n @position[:y] -= length if @position[:facing]==\"N\"\n @position[:x] -= length if @position[:facing]==\"E\"\n @position[:y] += length if @position[:facing]==\"S\"\n @position[:x] += length if @position[:facing]==\"W\"\n when \"R\"\n facing_array=[\"N\",\"E\",\"S\",\"W\"]\n length.times{\n @position[:facing] = turning(facing_array,@position[:facing])\n }\n when \"L\"\n facing_array=[\"N\",\"W\",\"S\",\"E\"]\n length.times{\n @position[:facing] = turning(facing_array,@position[:facing])\n }\n else puts \"This direction is not valid\"\n end\n end",
"def rotate(direction)\n\t\tnew_vector = (@robot.vectors[@robot_direction] + TURNING[direction]) % @robot.vectors.length\n\t\t@robot_direction = @robot.vectors.key(new_vector)\n\t\tputs \"Roger, roger. I\\'ve turned to the #{direction}! I\\'m now facing #{@robot_direction}\"\n\tend",
"def move\n position_after_move = @position.new_coordinates_for_step_size(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n #ignore the command if robot is being out off tabletop\n if(@table_top.has_within_bounds?(position_after_move))\n @position = @position.new_coordinates_for(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n end\n end",
"def move\n\n end",
"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 move\n return false unless on_the_table?\n\n next_x, next_y = facing.next_move_position(x, y)\n unless falls_off?(next_x, next_y)\n self.x = next_x\n self.y = next_y\n true\n else\n false\n end\n end",
"def turn_right\n if @@compass.index(@direction) == @@compass.length - 1\n @direction = @@compass[0]\n else\n current_index = @@compass.index(@direction)\n @direction = @@compass[current_index + 1]\n end\n end",
"def move_robot_forward details\r\n\tif(details.f == 1 and details.y<5)\r\n\t\tdetails.y += 1\r\n\telsif(details.f == 2 and details.x<5)\r\n\t\tdetails.x += 1\r\n\telsif(details.f == 3 and details.y>0)\r\n\t\tdetails.y -= 1\r\n\telsif(details.f == 4 and details.x>0)\r\n\t\tdetails.x -= 1\r\n\telse\r\n\t\tprint(\"\\nRobot will fall off the table. Aborting movement.\")\r\n\tend\r\n\tdetails\r\nend",
"def move_by a, m\n rad = a * D2R\n self.x += Math.cos(rad) * m\n self.y += Math.sin(rad) * m\n end",
"def forward(steps)\n move(steps)\n end",
"def move_upper_left\n unless @direction_fix\n @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)\n end\n if (passable?(@x, @y, 8) && passable?(@x, @y - 1, 4)) ||\n (passable?(@x, @y, 4) && passable?(@x - 1, @y, 8))\n move_follower_to_character\n @x -= 1\n @y -= 1\n if @follower && $game_variables[Yuki::Var::FM_Sel_Foll] == 0\n @memorized_move = :move_upper_left\n @follower.direction = @direction\n end\n movement_process_end(true)\n increase_steps\n end\n end",
"def turn_right\n @angle += ROTATION_SPEED\n end",
"def moveUpAndDown(dis)\n vector = getCurrentDirection\n vector.length = dis\n moveTransformation = Geom::Transformation.translation(vector)\n @@componentInstance.transform! moveTransformation\n updateAvatarLocation\n updateTransformation\n updateViewPort\n\n \n\n end",
"def move!\n if placed?\n case orientation.to_sym\n when :NORTH then @y += 1 if valid_coordinates?(x, y + 1)\n when :EAST then @x += 1 if valid_coordinates?(x + 1, y)\n when :SOUTH then @y -= 1 if valid_coordinates?(x, y - 1)\n when :WEST then @x -= 1 if valid_coordinates?(x - 1, y)\n end\n nil\n else\n raise RobotSimulation::NotPlacedError, \"Robot has not been placed yet.\"\n end\n end",
"def move\n move_by a, m\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 walk\n case @direction\n when 'N'\n @y += 1\n when 'W'\n @x += 1\n when 'S'\n @y -= 1\n when 'E'\n @x -= 1\n end\n end",
"def advance\n case bearing\n when :north\n coordinates[1] += 1\n when :east\n coordinates[0] += 1\n when :south\n coordinates[1] -= 1\n when :west\n coordinates[0] -= 1\n end\n end",
"def test_turn_left\n\t\trobot = Robot.new(0,0,'E')\n\t\trobot.turn('L')\n\t\tassert_equal(0,robot.orientation)\n\tend",
"def move(direction)\n\t\tnorth = [\"n\", \"up\", \"north\"]\n\t\teast = [\"e\", \"right\", \"east\"]\n\t\twest = [\"w\", \"left\", \"west\"]\n\t\tsouth = [\"s\", \"down\", \"south\"]\n\t\tif north.include?(direction)\n\t\t\tdirection == \"north\"\n\t\telsif east.include?(direction)\n\t\t\tdirection == \"east\"\n\t\telsif west.include?(direction)\n\t\t\tdirection == \"west\"\n\t\telsif south.include?(direction)\n\t\t\tdirection == south\n\t\tend\n\t\tif $hero.location.exits.has_key?(direction)\n\t\t\tnewroom = $hero.location.exits[direction]\n\t\t\t$hero.location = newroom\n\t\t\t$hero.xy = newroom.xy\n\t\telse\n\t\t\tputs \"You cannot travel #{direction}. The path does not lead there.\"\n\t\tend\n\tend",
"def forward\n\n\t\t#Could use case statement here\n\t\t# case (@angle.abs % 360)\n\t\t# \twhen 0 then x = @x + 1\n\t\t# \tetc...\n\t\t# end\n\n\t\t#Get new x\n\t\tx = @x + Math.cos(@angle * (Math::PI / 180)).round\n\n\t\t#Get new y\n\t\ty = @y + Math.sin(@angle * (Math::PI / 180)).round\n\n\t\t# This should perhaps be tested in the command method after each command\n\t\tif !isLostPoint(x, y) and !isLost(x, y) then\n\t\t\t@x = x\n\t\t\t@y = y\n\t\tend\n\n\tend",
"def move_toward_beeper()\n if front_is_clear?()\n move()\n else\n turn_left()\n end\n end",
"def move_west\n @x -= 1\n end",
"def move # takes (x, y, direction) from Rover\n\t\tif direction == \"N\"\n\t\t\t@y += 1\n\t\telsif direction == \"W\"\n\t\t\t@x -= 1\n\t\telsif direction == \"S\"\n\t\t\t@y -= 1\n\t\telsif direction == \"E\"\n\t\t\t@x += 1\n\t\telse \n\t\t\treturn \"The input direction enterned is wrong\"\n\t\tend\n\tend",
"def change_direction\n if @movement_direction == @directions.fetch(\"forward\")\n @movement_direction = @directions.fetch(\"backward\")\n else\n @movement_direction = @directions.fetch(\"forward\")\n end\n end",
"def new_direction(dir)\n @direction = dir unless @turned\n @turned = true\n end"
] |
[
"0.7247961",
"0.7131725",
"0.7057966",
"0.704066",
"0.69752014",
"0.69297004",
"0.68995297",
"0.67977434",
"0.6795773",
"0.66788924",
"0.66527456",
"0.6635252",
"0.6599254",
"0.65729797",
"0.654845",
"0.654327",
"0.6513447",
"0.64954364",
"0.6485316",
"0.64700204",
"0.64700204",
"0.6461596",
"0.64525837",
"0.6445562",
"0.6445512",
"0.6437578",
"0.64084387",
"0.63902926",
"0.6379131",
"0.6376892",
"0.63756317",
"0.63754576",
"0.63620716",
"0.633798",
"0.6335939",
"0.6324393",
"0.63177395",
"0.6312094",
"0.6299714",
"0.627531",
"0.62621653",
"0.6250105",
"0.6232264",
"0.6228855",
"0.6223022",
"0.62191445",
"0.6213924",
"0.61915326",
"0.6175966",
"0.6175966",
"0.61711663",
"0.61592686",
"0.6152675",
"0.6149117",
"0.61341",
"0.6128123",
"0.61259985",
"0.61150205",
"0.610943",
"0.61053264",
"0.6086633",
"0.6086438",
"0.608573",
"0.60808676",
"0.6080485",
"0.608024",
"0.6079194",
"0.6077909",
"0.60773355",
"0.6073074",
"0.60705245",
"0.6065757",
"0.6064451",
"0.60488963",
"0.6034374",
"0.60287035",
"0.6020284",
"0.60201097",
"0.6019474",
"0.6014585",
"0.60139954",
"0.60133225",
"0.60029083",
"0.5986457",
"0.59828806",
"0.59802246",
"0.59637517",
"0.59504527",
"0.5946369",
"0.5935169",
"0.5925523",
"0.5923671",
"0.5922363",
"0.59196067",
"0.591796",
"0.5907848",
"0.59072816",
"0.5900471",
"0.58994365",
"0.58908534",
"0.58816934"
] |
0.0
|
-1
|
Validates coordinated according to table sizes
|
def validate_pos(x, y)
return x.between?(0, @size_x - 1) && y.between?(0, @size_y - 1)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def validate_size\n @num_mines <= MAX_SIZE\n end",
"def check_params(x,y)\n if (x.to_i > self.table_size_x || x.to_i < 0) || (y.to_i > self.table_size_y || y.to_i < 0)\n return false\n else\n return true\n end\n end",
"def validate_entry_sizes; end",
"def validate_entry_sizes=(_arg0); end",
"def verify_dispatch_tables(h)\n\n h.each{|k,h|\n\n field = h['field']\n tbl = h['table']\n\n numrows = tbl.size\n numcols = tbl[0].size\n\n rowctr = 0\n\n tbl.each{|r|\n\n if (r.size != numcols)\n raise \"error: tbl #{k} error row #{rowctr}\"\n end\n\n rowctr += 1\n }\n }\nend",
"def size_check(cmd)\n cursize = @table.join.bytesize + @table.size * 32\n cmdsize = cmd[:name].bytesize + cmd[:value].bytesize + 32\n\n # The addition of a new entry with a size greater than the\n # SETTINGS_HEADER_TABLE_SIZE limit causes all the entries from the\n # header table to be dropped and the new entry not to be added to the\n # header table. The replacement of an existing entry with a new entry\n # with a size greater than the SETTINGS_HEADER_TABLE_SIZE has the same\n # consequences.\n if cmdsize > @limit\n @table.clear\n return false\n end\n\n cur = 0\n while (cursize + cmdsize) > @limit do\n e = @table.shift\n\n # When the modification of the header table is the replacement of an\n # existing entry, the replaced entry is the one indicated in the\n # literal representation before any entry is removed from the header\n # table. If the entry to be replaced is removed from the header table\n # when performing the size adjustment, the replacement entry is\n # inserted at the beginning of the header table.\n if cmd[:type] == :substitution && cur == cmd[:index]\n cmd[:type] = :prepend\n end\n\n cursize -= (e.join.bytesize + 32)\n end\n\n return true\n end",
"def size_check(cmd)\n cursize = @table.join.bytesize + @table.size * 32\n cmdsize = cmd[:name].bytesize + cmd[:value].bytesize + 32\n\n cur = 0\n while (cursize + cmdsize) > @limit do\n e = @table.shift\n\n # When using substitution indexing, it is possible that the existing\n # item being replaced might be one of the items removed when performing\n # the necessary size adjustment. In such cases, the substituted value\n # being added to the header table is inserted at the beginning of the\n # header table (at index position #0) and the index positions of the\n # other remaining entries in the table are incremented by 1.\n if cmd[:type] == :substitution && cur == cmd[:index]\n cmd[:type] = :prepend\n end\n\n cursize -= (e.join.bytesize + 32)\n end\n end",
"def verify_table_length(records)\n records.size == TestRecord.count\n end",
"def check_value_boundaries\n if (@lines < 9 || @columns < 20)\n raise ArgumentError, \" Error: The terminal size is to small for scaled output\".red\n end\n end",
"def second_validate\n across_req_bound = Array.new((2 * (self.across) + 1),1)\n down_req_bound = Array.new((2 * (self.down) + 1),1)\n top_bound = self.plane[0]\n down_bound = self.plane[2 * (self.down)]\n left_bound = self.plane.map{|a| a[0]}\n right_bound = self.plane.map{|a| a[2 * (self.across)]}\n if(top_bound != across_req_bound || down_bound != across_req_bound ||left_bound != down_req_bound || right_bound != down_req_bound)\n puts \"One of the boundaries is not closed\"\n self.valid = false\n end\n cell_validate if(self.valid == true)\n end",
"def validate_schema\n all_cols1 = @db1.column_names(@table1)\n all_cols2 = @db2.column_names(@table2)\n if all_cols1 != all_cols2\n raise \"Columns do not match, please use full coopy toolbox\"\n end\n\n key_cols1 = @db1.primary_key(@table1)\n key_cols2 = @db2.primary_key(@table2)\n if key_cols1 != key_cols2\n raise \"Primary keys do not match, please use full coopy toolbox\"\n end\n end",
"def validate_schema\n all_cols1 = @db1.column_names(@table1)\n all_cols2 = @db2.column_names(@table2)\n if all_cols1 != all_cols2\n raise \"Columns do not match, please use full coopy toolbox\"\n end\n\n key_cols1 = @db1.primary_key(@table1)\n key_cols2 = @db2.primary_key(@table2)\n if key_cols1 != key_cols2\n raise \"Primary keys do not match, please use full coopy toolbox\"\n end\n end",
"def validate_schema\n all_cols1 = @db1.column_names(@table1)\n all_cols2 = @db2.column_names(@table2)\n if all_cols1 != all_cols2\n raise \"Columns do not match, please use full coopy toolbox\"\n end\n\n key_cols1 = @db1.primary_key(@table1)\n key_cols2 = @db2.primary_key(@table2)\n if key_cols1 != key_cols2\n raise \"Primary keys do not match, please use full coopy toolbox\"\n end\n end",
"def proper_size\n unless (self.width.to_i * self.height.to_i) == self.gamedata.length || self.gamedata.length.zero?\n self.errors.add :gamedata, '-- The length of gamedata should be equal to the width times height. Your grid is %d pixels by %d pixels, so gamedata should be %d digits' % [self.width, self.height, (self.width.to_i * self.height.to_i)]\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 set_table_size\n @table_x = @table_reversed[0].size\n @table_y = @table_reversed.size\n end",
"def initialize(table_size_x, table_size_y)\n self.table_size_x = table_size_x.to_i - 1 || 4\n self.table_size_y = table_size_y.to_i - 1 || 4\n end",
"def valid?\n @table\n end",
"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 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 validate\n super\n rescue Sudoku::Constraint::ConstraintError => e\n raise ConstraintError, e.message + \" in a column\"\n end",
"def table_size=(size)\n @limit = size\n size_check(nil)\n end",
"def table_size_for(entry_count); end",
"def set_validations\n # TODO: Move below this line to the partition class itself\n @keys.each do |key|\n case key.type\n when :continuous\n partition_class.validates_uniqueness_of(\"#{key.column}_begin\", :scope => @keys.remaining_columns(\"#{key.column}_begin\"))\n partition_class.validates_uniqueness_of(\"#{key.column}_end\", :scope => @keys.remaining_columns(\"#{key.column}_end\"))\n when :discrete\n partition_class.validates_uniqueness_of(key.column, :scope => @keys.remaining_columns(key.column))\n end\n end\n end",
"def resume_size_validation\n errors[:resume] << \"should be less than 5MB\" if resume.size > 2.megabytes\n end",
"def check_valid (size)\n #checks length of string correct according to n x m\n if @arg.length != size\n puts \"String length incorrect\"\n end\n #checks if outer wall is all 1's\n string=''\n @col_nums.times do\n string+='1'\n end\n if !@arg[0..@col_nums-1].eql? string\n puts \"Invalid maze (outer wall)\"\n end\n (0..@row_nums*@col_nums-1).step(@col_nums) do |i|\n if @arg[i] != \"1\" || @arg[i-1] != \"1\"\n puts \"Invalid maze (outer wall)\"\n break\n end\n end\n #cell centers should be 0's\n #takes values of cell centers and uses coordinates for make_cell method\n (@col_nums..@row_nums*@col_nums-1).step(@col_nums*2) do |i|\n (1..@col_nums-2).step(2) do |j|\n if @arg[i+j]!=\"0\"\n puts \"Invalid maze (cell center)\"\n break\n else\n make_cell(i+j)\n end\n end\n end\n #cell corners should be 1's\n (0..@row_nums*@col_nums-1).step(@col_nums*2) do |i|\n (0..@col_nums-2).step(2) do |j|\n if @arg[i+j]!=\"1\"\n puts \"Invalid maze (cell corner)\"\n break\n end\n end\n end\n end",
"def validate_data\n #first remove any old errors from the table\n self.dataerrors.clear\n \n @s = [] \n # check the necessary fields in the table\n # use the build method so the polymorphic reference is generated cleanly\n # check for the relationships t other tables\n if self.rate_id.blank? && self.rate_override.blank?\n @s.push self.dataerrors.build(:message => \"A rate or override rate must be entered\", :created_user => self.created_user) \n end\n \n #if there are errors, save them to the dataerrors table and return false\n if @s.count > 0\n Dataerror.store(@s) \n return false\n end\n #everything is good, return true\n return true\n end",
"def validate\n super\n rescue Sudoku::Constraint::ConstraintError => e\n raise ConstraintError, e.message + \" in a 3x3 subboard\"\n end",
"def validate_nonoverlapping\n end",
"def check_full? \n \t\treturn true if @size==16 #size increase by 1 with every turn so when it reaches 16 we know that all cells are full\n\tend",
"def validate_all \n valid = true\n valid = validate(@rows)? valid : false\n valid = validate(@cols)? valid : false\n valid = validate(@blks)? valid : false\n end",
"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 check_size_constraints!(other, offset_x, offset_y)\n if width < other.width + offset_x\n raise ChunkyPNG::OutOfBounds, \"Background image width is too small!\"\n end\n if height < other.height + offset_y\n raise ChunkyPNG::OutOfBounds, \"Background image height is too small!\"\n end\n end",
"def checkValid(size)\r\n \r\n if !@valid_phones.key?(size.to_s)\r\n printResult(\"N IN\")\r\n abort\r\n end\r\n \r\n if @valid_phones[size.to_s].include?(@formatted_phone)\r\n printResult(\" \")\r\n else\r\n printResult(\"N IN\")\r\n end\r\n end",
"def valid_sudoku(table)\n \nend",
"def valid_for_table?(table)\n conditions.reject {|c| c.valid?(table)}.length == 0\n end",
"def validate_size(key, items, min, max)\n SquareLite::TooFewError.validate!(items, key, min)\n SquareLite::TooManyError.validate!(items, key, max)\n end",
"def validate_data\n @state = true\n #store the original error count, if there is a chnage to the count, then we want to update all associated insurance_billings and balance_bills\n @original_count = self.dataerrors.count\n #first remove any old errors from the table\n self.dataerrors.clear\n\n @s = []\n # check the necessary fields in the table\n # use the build method so the polymorphic reference is generated cleanly\n @s.push self.dataerrors.build(:message => \"Provider first name is blank\", :created_user => self.created_user) if self.first_name.blank?\n @s.push self.dataerrors.build(:message => \"Provider last name is blank\", :created_user => self.created_user) if self.last_name.blank?\n @s.push self.dataerrors.build(:message => \"Provider NPI is required\", :created_user => self.created_user) if self.npi.blank?\n #either the ein or ssn is required\n @s.push self.dataerrors.build(:message => \"EIN or SSN is required\", :created_user => self.created_user) if self.ssn_number.blank? && self.ein_number.blank?\n @s.push self.dataerrors.build(:message => \"Office phone is required\", :created_user => self.created_user) if self.office_phone.blank?\n\n #if there are errors, save them to the dataerrors table and return false\n if @s.count > 0\n Dataerror.store(@s)\n @state = false\n end\n #if the error counts changed, then update all insurance_bill & balance bills\n if @original_count != @s.count\n self.insurance_billings.each { |billing| billing.validate_claim }\n # need to rethink the validate\n # self.balance_bill_sessions.each { |balance| balance.validate_balance_bill }\n end\n return @state\n end",
"def table_size=(size)\n @cc.table_size = size\n end",
"def table_size=(size)\n @cc.table_size = size\n end",
"def cell_sizes?\n cell_w && cell_h\n end",
"def check_length_of_columns_vs_lines\n longest = 0\n self.line_items.each {|line| longest = line.body_array.length if line.body_array.length > longest }\n set_error_message(\"Column lengths do not match\") unless self.fields.length == longest\n end",
"def validate_tabulator_count(tabulator_count)\n val_fatal(\"Not a Tabulator Count to Validate\") unless\n (tabulator_count.is_a?(Hash) &&\n tabulator_count.keys.include?('tabulator_count'))\n self.tabulator_count = tabulator_count\n state = tabulator_count[\"tabulator_count\"][\"state\"]\n tabulator_count[\"tabulator_count\"][\"state\"] = 'INITIAL'\n errwarn = true\n tcinfo = tabulator_count[\"tabulator_count\"]\n validate_jurisdiction_definition(tcinfo[\"jurisdiction_definition\"])\n validate_election_definition(tcinfo[\"election_definition\"], errwarn)\n eid = tcinfo[\"election_ident\"].to_s\n val_fatal(\"Non-Existent Election UID (#{eid}) in Tabulator Count\") unless\n uid_exists?(\"election\", eid)\n jid = tcinfo[\"jurisdiction_ident\"].to_s\n val_fatal(\"Non-Existent Jurisdiction UID (#{jid}) in Tabulator Count\") unless\n uid_exists?(\"jurisdiction\", jid)\n validate_contest_counts(tcinfo[\"contest_count_list\"])\n validate_question_counts(tcinfo[\"question_count_list\"])\n tcinfo[\"contest_count_list\"].each do |contest_count|\n self.counts_contests[contest_count[\"contest_ident\"]] = contest_count\n end\n tcinfo[\"question_count_list\"].each do |question_count|\n self.counts_questions[question_count[\"question_ident\"]] = question_count\n end\n validate_counter_counts(tcinfo[\"counter_count_list\"], errwarn)\n endstate = tabulator_count[\"tabulator_count\"][\"state\"]\n val_fatal(\"Tabulator end state invalid (#{endstate}) expecting: #{state}\") if\n (endstate != state)\n end",
"def validate\n grid_size = params[:grid_size]\n\n if grid_size.blank?\n raise 'Please provide a grid size'\n end\n\n grid_size = grid_size.to_i\n if grid_size <= 1\n raise 'Please provide a grid size greater than 1'\n end\n end",
"def valid_place?(x, y)\n @table.validate_pos(x, y)\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 validate_data\n @state = true\n #store the original error count, if there is a chnage to the count, then we want to update all associated insurance_billings and balance_bills\n @original_count = self.dataerrors.count\n #first remove any old errors from the table\n self.dataerrors.clear\n\n @s = []\n # check the necessary fields in the table\n # use the build method so the polymorphic reference is generated cleanly\n @s.push self.dataerrors.build(:message => \"Group name is blank\", :created_user => self.created_user) if self.group_name.blank?\n @s.push self.dataerrors.build(:message => \"Office phone number is required\", :created_user => self.created_user) if self.office_phone.blank?\n @s.push self.dataerrors.build(:message => \"EIN number is required\", :created_user => self.created_user) if self.ein_number.blank?\n @s.push self.dataerrors.build(:message => \"NPI is required for group\", :created_user => self.created_user) if self.npi.blank?\n\n #if there are errors, save them to the dataerrors table and return false\n if @s.count > 0\n Dataerror.store(@s)\n @state = false\n end\n #if the error counts changed, then update all insurance_bill & balance bills\n if @original_count != @s.count\n self.insurance_billings.each { |billing| billing.validate_claim }\n #self.balance_bills.each { |balance| balance.validate_balance_bill }\n end\n return @state\n end",
"def validate(table)\r\n establish! do\r\n options[:conditions].each do |cond|\r\n validate! table, cond\r\n end\r\n end\r\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n if(self.rmt_product_type_code.to_s.upcase == \"PRESORT\")\n self.treatment_type_code = \"PRESORT\"\n elsif self.rmt_product_type_code == \"orchard_run\"\n self.product_class_code = \"OR\"\n self.treatment_type_code = \"PRE_HARVEST\"\n else\n self.treatment_type_code = \"PACKHOUSE\"\n end\n\n #self.size_code = \"UNS\" if !self.size_code\n if !self.size_code\n self.size_code = \"UNS\" \n\t self.size_id = Size.find_by_size_code(self.size_code).id\t\t \n end\n \n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:ripe_point_code => self.ripe_point_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_ripe_point\n\t end\n\t \n\t\n\tif is_valid && self.rmt_product_type_code != \"orchard_run\" && self.rmt_product_type_code.to_s.upcase != \"PRESORT\"\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:size_code => self.size_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid && self.rmt_product_type_code != \"orchard_run\" && self.rmt_product_type_code.to_s.upcase != \"PRESORT\"\n\t\t is_valid = set_size\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:product_class_code => self.product_class_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_product_class\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_group_code => self.commodity_group_code},{:commodity_code => self.commodity_code},{:variety_code => self.variety_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_variety\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:treatment_code => self.treatment_code}],self) \n\tend\n\t\n\tif is_valid && self.rmt_product_type_code != \"orchard_run\" && self.rmt_product_type_code.to_s.upcase != \"PRESORT\"\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:bin_type => self.bin_type}],self) \n\tend\n\t\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_treatment\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def table_size\n @table.size\n end",
"def table_size\n @table.size\n end",
"def validate_metadata_size\n errors.add(:metadata, 'can not exceed 64Kb') if metadata.to_s.bytesize > 64.kilobytes\n end",
"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 valid?\n received, sent = received_chunk_sizes, sent_chunk_sizes\n sent.all? { |id, size| received[id] == size }\n end",
"def validate_data\n @state = true\n #store the original error count, if there is a chnage to the count, then we want to update all associated insurance_billings and balance_bills\n @original_count = self.dataerrors.count\n #first remove any old errors from the table\n self.dataerrors.clear\n\n @s = []\n # check the necessary fields in the table\n # use the build method so the polymorphic reference is generated cleanly\n @s.push self.dataerrors.build(:message => \"An Address is required\", :created_user => self.created_user) if self.address1.blank?\n @s.push self.dataerrors.build(:message => \"A city is required as part of the address\", :created_user => self.created_user) if self.city.blank?\n @s.push self.dataerrors.build(:message => \"The state is reuqired as part oof the address\", :created_user => self.created_user) if self.state.blank?\n @s.push self.dataerrors.build(:message => \"The zip code is required\", :created_user => self.created_user) if self.zip.blank?\n @s.push self.dataerrors.build(:message => \"Office phone number is required\", :created_user => self.created_user) if self.office_phone.blank?\n\n #if there are errors, save them to the dataerrors table and return false\n if @s.count > 0\n Dataerror.store(@s)\n @state = false\n end\n\n #if the error counts changed, then update all insurance_bill & balance bills\n if @original_count != @s.count\n self.insurance_sessions.each { |session| session.validate_data }\n end\n return @state\n end",
"def check_presence_on_table\n if !self.on_table\n throw(:abort)\n end\n end",
"def valid?\n received, sent = received_chunk_sizes, sent_chunk_sizes\n sent.all? { |id, size| received[id] == size }\n end",
"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 validate_records\n have_enough_items_to_trade?\n end",
"def check_consistency instance_id, table_id, token\n tables.check_consistency name: table_path(instance_id, table_id), consistency_token: token\n end",
"def validate_table_and_pk\n if entity_type.nil?\n entity_type_pk=nil\n return\n end\n\n if entity_type_pk.nil?\n entity_type=nil\n return\n end\n\n unless entity_type_enum.include? entity_type.to_s\n errors.add :entity_type, :invalid\n return\n end\n unless entity_type_pk_enum.include? entity_type_pk.to_s\n errors.add :entity_type_pk, :invalid\n return\n end\n end",
"def validate_geometry(geometry)\n geometry.tap do |g|\n total = g.width + g.height\n raise ScaleDown::InvalidGeometry if total == 0\n raise ScaleDown::InvalidGeometry if g.width > ScaleDown.max_dimensions[0] || g.height > ScaleDown.max_dimensions[1]\n end\n end",
"def validate_data\n @state = true\n #store the original error count, if there is a chnage to the count, then we want to update all associated insurance_billings and balance_bills\n @original_count = self.dataerrors.count\n #first remove any old errors from the table\n self.dataerrors.clear\n\n @s = []\n # check the necessary fields in the table\n # use the build method so the polymorphic reference is generated cleanly\n @s.push self.dataerrors.build(:message => \"Insurance Company name is required\", :created_user => self.created_user) if self.name.blank?\n @s.push self.dataerrors.build(:message => \"Payor ID is required\", :created_user => self.created_user) if self.insurance_co_id.blank?\n @s.push self.dataerrors.build(:message => \"An Address is required\", :created_user => self.created_user) if self.address1.blank?\n @s.push self.dataerrors.build(:message => \"A city is required as part of the address\", :created_user => self.created_user) if self.city.blank?\n @s.push self.dataerrors.build(:message => \"The state is required as part of the address\", :created_user => self.created_user) if self.state.blank?\n @s.push self.dataerrors.build(:message => \"The zip code is required\", :created_user => self.created_user) if self.zip.blank?\n\n #if there are errors, save them to the dataerrors table and return false\n if @s.count > 0\n Dataerror.store(@s)\n @state = false\n end\n # if the error counts changed, then update all subsciber and provider_insurance records\n # they will in turn re-validate and update insurance_billing && balance_bill records\n if @original_count != @s.count\n self.subscribers.each { |subscribe| subscribe.validate_data }\n self.provider_insurances.each { |provide| provide.validate_data }\n end\n return @state\n end",
"def get_valid_model_table(table)\n new_table = []\n unless table.empty?\n length_table = table.size\n (0..length_table - 1).each do |row_index|\n cells_added = 0\n original_row = [].concat(table[row_index])\n new_table[row_index] = [] if new_table.size <= row_index\n length_row = original_row.size\n (0..length_row - 1).each do |cell_index|\n cell = original_row[cell_index]\n new_cell_index = cell_index + cells_added\n new_row = new_table[row_index]\n until new_row[new_cell_index].nil?\n cells_added += 1\n new_cell_index = cell_index + cells_added\n end\n new_row[new_cell_index] = cell\n\n next unless cell.has_attribute?('rowspan')\n\n rowspan = cell.get_attribute('rowspan').to_i\n\n next unless rowspan > 1\n\n (1..rowspan - 1).each do |rowspan_index|\n new_row_index = row_index + rowspan_index\n new_table[new_row_index] = [] if new_table[new_row_index].nil?\n new_table[new_row_index][new_cell_index] = cell\n end\n end\n end\n end\n new_table\n end",
"def check_constraints\n case self.recordable\n when ExtractionsExtractionFormsProjectsSectionsQuestionRowColumnField\n case self.recordable.question_row_column_field.question_row_column.question_row_column_type.name\n when 'text'\n min_length = self.recordable.question_row_column_field.question_row_column.field_validation_value_for(:min_length).to_i\n max_length = self.recordable.question_row_column_field.question_row_column.field_validation_value_for(:max_length).to_i\n if self.persisted? && self.name.length > 0 && (self.name.length < min_length || self.name.length > max_length)\n errors.add(:length, \"must be between #{ min_length.to_s } and #{ max_length.to_s }\")\n end\n when 'numeric'\n # First check that we aren't trying to validate any of the ~, <, >, ≤, ≥ special characters.\n if self.recordable.question_row_column_field.question_row_column.question_row_column_fields.second == self.recordable.question_row_column_field\n unless (self.name =~ /\\A[-+]?[0-9]*\\.?[0-9]+\\z/) || self.name != ''\n errors.add(:value, 'Must be numeric')\n end\n\n min_value = self.recordable.question_row_column_field.question_row_column.field_validation_value_for(:min_value).to_i\n max_value = self.recordable.question_row_column_field.question_row_column.field_validation_value_for(:max_value).to_i\n if self.persisted? && (self.name.to_i < min_value || self.name.to_i > max_value)\n errors.add(:value, \"must be numeric and between #{ min_value.to_s } and #{ max_value.to_s }\")\n end\n end\n end\n end\n end",
"def validate!\n # If we get num_blocks and block_size, then the user's done something\n # wrong; just take block_size\n self.num_blocks = 0 if num_blocks.positive? && block_size.positive?\n\n # Default to a single block unless otherwise specified\n self.num_blocks = 1 if num_blocks <= 0 && block_size <= 0\n\n reset!\n end",
"def validate\n validate_params\n validate_colour\n validate_coordinates\n validate_dimension\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 check_rules\n tables.each(&:check_rules_on_update)\n tables.each(&:check_rules_on_insert)\n end",
"def model_table_config_is_valid?\n return (attribute_definitions_meet_spec? and not self.table_name.nil?)\n end",
"def validate\n validate_params\n validate_coordinates\n validate_colour\n validate_dimension\n end",
"def valid?\n !!free_cell_index\n end",
"def check_size(&block)\n self.instance_eval(&block)\n end",
"def check_tables_left\n if self.tables_left <= 6\n self.tables_left = (20..30).to_a.sample\n self.save\n end\n end",
"def valid_placement?\n\t\t@table.placed_on_table?(@x, @y) && @robot.vectors.include?(@robot_direction)\n\tend",
"def validate_partition(partition, rd, md)\n\n # Validate based on region data\n r_num_cells_sorted = rd[:r_num_cells].sort\n p_num_cells = Array.new(rd[: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\n # Validate based on moves data\n xxs = create_r_arrays_from_partition(rd[:r_num_cells], partition)\n ms_per_r = rd[:ms_per_r]\n for r in 0...ms_per_r.length do\n next if ms_per_r[r].empty?\n max_size = rd[:r_num_cells][r]\n for i in 0...ms_per_r[r].length do\n partition_r_containing_m = partition[ms_per_r[r][i]-1]\n actual_size = xxs[partition_r_containing_m].length\n if actual_size > max_size\n return false\n end\n end\n end\n return true\nend",
"def minimum_width\n table.columns_size * MIN_WIDTH + border_size\n end",
"def is_solved?\n return false unless is_rows_valid?\n return false unless is_columns_valid?\n return false unless is_subgrids_valid?\n true\n end",
"def size\n table.size\n end",
"def validate_parts_full_chunks!(grid_infos)\n grid_infos.each do |grid_info|\n if grid_info[:length] % grid_info[:chunkSize] != 0 && grid_info != grid_infos.last\n raise Tus::Error, \"cannot concatenate parts which aren't evenly distributed across chunks\"\n end\n end\n end",
"def validate_disk_size\n return unless @dev\n\n # we can't use execute!() since we want to capture the output of the cmd\n output, _, stat = Open3.capture3(\"sudo blockdev --getsize64 #{@dev}\")\n raise RuntimeError, 'Unable determine dev size' unless stat.success?\n\n dev_mib = output.strip.to_i / (1024 * 1024) # space on device (MiB)\n begin\n tot_mib = total_disk_size()\n rescue RuntimeError => e\n warn(\"Performing lax disk size check (#{e})\")\n tot_mib = minimum_disk_size()\n end\n\n if tot_mib >= dev_mib\n warn(\"Insufficient space! need MiB: #{tot_mib}, device MiB: #{dev_mib}\")\n raise RuntimeError, \"Total size #{tot_mib} > block device size #{dev_mib}\"\n end\n\n nil\n end",
"def valid?\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^bck_[a-zA-Z0-9]+$/)\n return false if @auto_reorder.nil?\n return false if @threshold_amount.nil?\n return false if @url.nil?\n return false if @url.to_s.length > 2083\n return false if @url.to_s.length < 1\n return false if @raw_url.nil?\n return false if @raw_url.to_s.length > 2083\n return false if @raw_url.to_s.length < 1\n return false if @front_original_url.nil?\n return false if @front_original_url.to_s.length > 2083\n return false if @front_original_url.to_s.length < 1\n return false if @back_original_url.nil?\n return false if @back_original_url.to_s.length > 2083\n return false if @back_original_url.to_s.length < 1\n return false if @thumbnails.nil?\n return false if @available_quantity.nil?\n return false if @allocated_quantity.nil?\n return false if @onhand_quantity.nil?\n return false if @pending_quantity.nil?\n return false if @projected_quantity.nil?\n return false if @buckslip_orders.nil?\n return false if @buckslip_orders.length < 0\n return false if @stock.nil?\n stock_validator = EnumAttributeValidator.new('String', [\"text\", \"cover\"])\n return false unless stock_validator.valid?(@stock)\n return false if @weight.nil?\n weight_validator = EnumAttributeValidator.new('String', [\"80#\"])\n return false unless weight_validator.valid?(@weight)\n return false if @finish.nil?\n finish_validator = EnumAttributeValidator.new('String', [\"gloss\", \"matte\"])\n return false unless finish_validator.valid?(@finish)\n return false if @status.nil?\n status_validator = EnumAttributeValidator.new('String', [\"processed\", \"rendered\"])\n return false unless status_validator.valid?(@status)\n return false if @object.nil?\n object_validator = EnumAttributeValidator.new('String', [\"buckslip\"])\n return false unless object_validator.valid?(@object)\n return false if @description.to_s.length > 255\n size_validator = EnumAttributeValidator.new('String', [\"8.75x3.75\"])\n return false unless size_validator.valid?(@size)\n true\n end",
"def size\n @table.size\n end",
"def validate_partition_layout\n # Check for exactly one grub_cfg partition\n grub_parts = @partition_layout.select { |p| p.grub_cfg }\n if grub_parts.empty?\n raise RuntimeError, 'Missing grub_cfg partition in layout'\n elsif grub_parts.count > 1\n raise RuntimeError, 'Multiple grub_cfg partitions in layout'\n end\n\n if @partition_layout.select { |p| p.lvm }.count == 0\n validate_partition_layout_non_lvm\n else\n validate_partition_layout_lvm\n end\n end",
"def valid_sudoku(table)\n\n return true if in_row?(table) && in_column?(table) && in_box?(table)\n\n return false\n\nend",
"def check_consistency instance_id, table_id, token\n execute do\n tables.check_consistency(\n table_path(instance_id, table_id),\n token\n )\n end\n end",
"def check_disk_sizes(disk_in_motion, base_disk)\n if base_disk != nil && disk_in_motion.size > base_disk.size\n raise DiskSizeException\n end\n end",
"def size_check(ship, coords)\n ship.length == coords.length\n end",
"def size\n @table.size\n end",
"def current_table_size\n @table.inject(0) { |r, (k, v)| r + k.bytesize + v.bytesize + 32 }\n end",
"def size_check\n @size_check = [0,0,0]\n self.rewards.each do |reward|\n @size_check[reward.size] = 1\n end\n return @size_check\n end",
"def validate_empty\n if self.units.count > 0\n errors.add(:units, \"must not exist in order for a unit to be deleted\")\n throw(:abort)\n elsif self.collections.count > 0\n errors.add(:collections, \"must not exist in order for a unit to be deleted\")\n throw(:abort)\n end\n end",
"def acceptable_size?\n \n return true if width > 50 and\n width < 100 and\n height > 50 and\n height < 100\n \n end",
"def validate_data\n inputs = Set.new(node.in_slots.map(&:carrier))\n effs = Set.new(dependencies)\n\n unless inputs.subset?(effs)\n # One or more efficiencies are missing.\n errors.add(:base, error_msg(:efficiencies, inputs, effs))\n end\n\n unless effs.subset?(inputs)\n # One or more input shares are missing.\n errors.add(:base, error_msg(:inputs, effs, inputs))\n end\n end",
"def check_consistency count\n raise \"Not implemented\"\n end",
"def valid_drawing_size?\n if drawing.length != 15 || drawing.any? {|b| b.length != 31 }\n errors.add(:base, \"drawing dimensions are incorrect\")\n return false\n end\n end",
"def have_size?(size)\n @buckets[size] && @buckets[size].size != 0\n end",
"def bounds_check\n h = scrollatrow()\n rc = row_count\n #$log.debug \" PRE CURR:#{@current_index}, TR: #{@toprow} RC: #{rc} H:#{h}\"\n @current_index = 0 if @current_index < 0 # not lt 0\n @current_index = rc-1 if @current_index >= rc and rc>0 # not gt rowcount\n @toprow = rc-h-1 if rc > h and @toprow > rc - h - 1 # toprow shows full page if possible\n # curr has gone below table, move toprow forward\n if @current_index - @toprow > h\n @toprow = @current_index - h\n elsif @current_index < @toprow\n # curr has gone above table, move toprow up\n @toprow = @current_index\n end\n #$log.debug \" POST CURR:#{@current_index}, TR: #{@toprow} RC: #{rc} H:#{h}\"\n if @oldrow != @current_index\n #$log.debug \"going to call on leave and on enter\"\n on_leave_row @oldrow if respond_to? :on_leave_row # to be defined by widget that has included this\n on_enter_row @current_index if respond_to? :on_enter_row # to be defined by widget that has included this\n end\n set_form_row\n #set_form_col 0 # added 2009-02-15 23:33 # this works for lists but we don't want this in TextArea's\n @repaint_required = true\n end",
"def validate_shape\n base.validate\n base.errors.collect{|error|\n errors.add_to_base(error.show_message)\n }\n end",
"def validate_layout(layout); end",
"def check_for_resize; end"
] |
[
"0.6683595",
"0.6487267",
"0.6484596",
"0.6236838",
"0.62367046",
"0.6098932",
"0.60927933",
"0.60679364",
"0.5877272",
"0.5874671",
"0.58619785",
"0.58619785",
"0.58619785",
"0.5829751",
"0.58282715",
"0.5826025",
"0.57742274",
"0.57713485",
"0.5735161",
"0.57350624",
"0.5635427",
"0.5635314",
"0.562821",
"0.5620683",
"0.5594124",
"0.55719215",
"0.5538628",
"0.553791",
"0.5536157",
"0.5528421",
"0.5518778",
"0.55166215",
"0.5511768",
"0.54994035",
"0.5495134",
"0.54817295",
"0.5474131",
"0.5467675",
"0.5459427",
"0.5459427",
"0.5454254",
"0.5446051",
"0.5445326",
"0.54445887",
"0.54410994",
"0.5438406",
"0.54343265",
"0.5433217",
"0.54138094",
"0.53910774",
"0.53910774",
"0.53646123",
"0.53590095",
"0.5358482",
"0.53483576",
"0.53464925",
"0.533381",
"0.53147095",
"0.5294925",
"0.52840674",
"0.528158",
"0.52695715",
"0.5268335",
"0.52670443",
"0.5258022",
"0.5246647",
"0.5235173",
"0.52220535",
"0.52190584",
"0.5218499",
"0.52150965",
"0.52058786",
"0.5196832",
"0.5189184",
"0.5181007",
"0.5175134",
"0.517432",
"0.5157439",
"0.51533675",
"0.51438063",
"0.5139036",
"0.5138086",
"0.5126024",
"0.5121438",
"0.511995",
"0.51198876",
"0.5106518",
"0.510287",
"0.5099856",
"0.50976926",
"0.50881755",
"0.50819886",
"0.50799817",
"0.5077691",
"0.5076927",
"0.50719",
"0.5063094",
"0.5061772",
"0.50540435",
"0.5052633",
"0.5045633"
] |
0.0
|
-1
|
Execute the step on a given set of records
|
def perform(messages = nil, params = {}, &block)
logger.debug "#{self}(#{params.inspect}) <- #{messages}"
return to_enum(:perform, messages, params) unless block_given?
wrap_input(messages).each do |m|
run_callbacks :perform do
logger.debug "#{object_id} -> #{m}"
result = perform_one(m, params)
handle_result(m, result, &block)
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def execute(step)\n end",
"def process_batch(records)\n benchmarks[:processing] << Benchmark.realtime do\n records.each do |record|\n next if skip_before_transform?(record)\n invoke_callback(:before_each, record)\n attrs = transformer.run(record)\n next unless attrs # skip if transformation failed\n invoke_callback(:each_before_save, attrs, record)\n next if invoke_callback(:reject_after_transform_if, attrs)\n invoke_callback(:after_each, record, attrs)\n attrs = data_scrubber.scrub!(attrs)\n \n if update?(record, attrs)\n update_attrs << attrs\n elsif create_new_records\n new_rows << attrs.values\n end\n end\n end\n end",
"def perform(record)\n run(record, false)\n end",
"def process *args, &block\n raise \"override the process method in your implementation: it should process each record.\"\n end",
"def run_bulk; end",
"def boltProcessRecords(records)\n txs = []\n records.each do |record|\n ctx = ComputationContext.new(self)\n log_failure do\n handler.process_record(ctx, record)\n end\n txs.push(ctx.transaction)\n end\n txs\n end",
"def bulk(records)\n records_array = Array(records)\n\n bulk_delay(records_array)\n\n yield\n\n bulk_queue(records_array)\n end",
"def execute_items(items, scenario, &block)\n items.each {|item| execute_item(scenario, item, &block)}\n end",
"def run_batch\n make_run_batch_call\n end",
"def each\n @job = block = (block_given? ? Proc.new : @job)\n each_set do |records|\n records.each do |record|\n block.call(record)\n @current_id = record.send(@id_field)\n end\n end\n cleanup\n end",
"def process(statements); end",
"def call!\n rows.map.with_index do |row, row_num|\n process_entities(row, row_num, &:call!)\n end\n end",
"def each(&block)\n @result_records.each(&block)\n end",
"def each(&block)\n @records.each(&block)\n end",
"def call\n rows.map.with_index do |row, row_num|\n process_entities(row, row_num, &:call)\n end\n end",
"def each_record(&block)\n return to_enum(:each_record) unless block_given?\n\n @relation.to_enum(:in_batches, of: @of, start: @start, finish: @finish, load: true, order: @order).each do |relation|\n relation.records.each(&block)\n end\n end",
"def run_bulk(t, first, last, incr = 1)\n retry_until { DRMAA.run_bulk_jobs(t.ptr, first, last, incr) }\n end",
"def process(cursor, batch) end",
"def run\r\n ridFieldName = @qbc.lookupFieldNameFromID( \"3\")\r\n records = Records.new\r\n @qbc.iterateRecords(@dbid,@qbc.getFieldNames(@dbid),nil,@id,nil,qyclst()){|qb_record|\r\n record = Record.new\r\n record.build(@qbc,ridFieldName, qb_record)\r\n records << record\r\n }\r\n records\r\n end",
"def each(&block)\n records.each(&block)\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 each\n @records.each { |record| \n yield record\n }\n end",
"def each_record(aLambda = nil, &block)\n @index_steps << EachRecordStep.new(aLambda, block, Traject::Util.extract_caller_location(caller.first) )\n end",
"def each_record(aLambda = nil, &block)\n @index_steps << EachRecordStep.new(aLambda, block, Traject::Util.extract_caller_location(caller.first) )\n end",
"def run(result)\t\t\n\t\tcolumn_names = result.fields #store the column names\n\t\trow_count = result.num_tuples #get the number of rows in the result\n\t\tinitial_data = Array.new #payload holder\n result.each do |item|\n intial_data << item.to_ary\n end\t\t\n\t\tasrecordset = ASRecordset.new(row_count,column_names,initial_data)\n\t\tresult = asrecordset\n\t\tresults\n\tend",
"def run_step(records, wait: nil, **opt, &block)\n\n max_time = (opt[:max_time] || DEFAULT_TIMEOUT) * records.size\n max_time += records.map { |r| r.file_size.to_i / 1.megabyte }.sum if wait\n deadline = timestamp + max_time\n\n meth = opt[:meth] || __method__\n msg = opt.slice(*DEF_MSG.keys).reverse_merge!(DEF_MSG)\n msg.transform_values! { |v| v.include?('%') ? (v % { meth: meth }) : v }\n\n records = records.map { |rec| [manifest_item_id(rec), rec] }.to_h\n remaining = records.dup\n failure = opt.dig(:initial, :failure) || {}\n success = opt.dig(:initial, :success) || records\n\n if wait\n # noinspection RubyMismatchedArgumentType\n while remaining.present? && sleep(wait)\n done = []\n remaining.each_pair do |id, rec|\n begin\n id = nil unless block.call(id, rec)\n rescue => error\n failure[id] = error.message\n Log.warn { \"#{meth}: #{error.message}\" }\n end\n done << id if id\n break if timestamp > deadline\n end\n remaining.except!(*done)\n end\n else\n done = []\n remaining.each_pair do |id, rec|\n begin\n failure[id] = msg[:failure] unless block.call(id, rec)\n rescue => error\n failure[id] = error.message\n Log.warn { \"#{meth}: #{error.message}\" }\n end\n done << id\n break if timestamp > deadline\n end\n remaining.except!(*done)\n end\n\n failure.merge!(remaining.transform_values { msg[:timeout] })\n success.except!(*failure.keys).transform_values! { msg[:success] }\n StepResult.new(success: success, failure: failure)\n end",
"def each_record\n return to_enum(:each_record) unless block_given?\n\n @relation.to_enum(:in_batches, of: @of, start: @start, finish: @finish, load: true).each do |relation|\n relation.records.each { |record| yield record }\n end\n end",
"def process(model, data_set)\n if @data_set.is_a?(Array)\n @data_set.each do |data|\n process_data(model, data)\n end\n else\n process_data(model, @data_set)\n end\n end",
"def run_bulk(t, first, last, incr = 1)\n retry_until { DRMAA.run_bulk_jobs(t.ptr, first, last, incr) }\n end",
"def execute(etl_batch)\n prepare_stage(etl_batch)\n perform_execution(etl_batch)\n end",
"def perform_execution(etl_batch)\n raise \"perform_execution method has not been overridden.\"\n end",
"def perform(&run_interp)\n @queries.each {|q| q.perform(&run_interp)}\n end",
"def run(*test_cases)\n @report.on_start if @report.respond_to?(:on_start)\n test_cases.each do |test_case|\n @report.on_enter(test_case) if @report.respond_to?(:on_enter)\n test_case.run(self)\n @report.on_exit(test_case) if @report.respond_to?(:on_exit)\n end\n @report.on_end if @report.respond_to?(:on_end)\n end",
"def each\n (0...record_count).each do |i|\n yield get_record(i)\n end\n end",
"def step\n log_iteration_start\n\n\n @current_task = tasks_list.shift\n status.no_tasks! and return unless current_task #empty tasks list\n\n solve_current_task\n\n return unless current_basis_plan # no optimal plan, so we don't change record and continue\n\n if current_target_function <= record # not interested as previsous record is higher\n status.target_less_than_record!\n elsif task.satisfies_integer?(current_basis_plan)\n change_record\n else\n split_current_task\n end\n log_status\n end",
"def run_internal\n log.debug(\"Loading in slices of #{@row_slice_size} rows\")\n reader.each_row_slice(@row_slice_size, @batch) do |rows|\n load_slice(rows)\n end\n msg = \"Processed #{reader.rows_processed} input rows for #{@series}\"\n\n ETL::Job::Result.success(reader.rows_processed, msg)\n end",
"def perform\n track do\n reset!\n\n Restforce::DB::Registry.each do |mapping|\n run(\"CLEANING RECORDS\", Cleaner, mapping)\n run(\"ATTACHING RECORDS\", Attacher, mapping)\n run(\"PROPAGATING RECORDS\", Initializer, mapping)\n run(\"COLLECTING CHANGES\", Collector, mapping)\n end\n\n # NOTE: We can only perform the synchronization after all record\n # changes have been aggregated, so this second loop is necessary.\n Restforce::DB::Registry.each do |mapping|\n run(\"UPDATING ASSOCIATIONS\", Associator, mapping)\n run(\"APPLYING CHANGES\", Synchronizer, mapping)\n end\n end\n end",
"def run_set(set)\n set_tasks = @tasks[set]\n\n return true if set_tasks.empty?\n\n @playbook.in_context(set) do\n Log.info(\"About to run task set %s with %d task(s)\" % [set, set_tasks.size])\n\n # would typically use map here but you cant break out of a map and keep the thus far built up array\n # so it's either this or a inject loop\n passed = set_tasks.take_while do |task|\n @playbook.in_context(\"%s.%s\" % [set, task[:type]]) { run_task(task, set, set == \"tasks\") }\n end\n\n set_success = passed.size == set_tasks.size\n\n Log.info(\"Done running task set %s with %d task(s): success: %s\" % [set, set_tasks.size, set_success])\n\n set_success\n end\n end",
"def record_all\n puts \"****************** in record_all match, params: #{params}\"\n params.each do |match_params| \n record_results match_params\n end\n end",
"def run( audit_store, run_afr = true )\n if run_afr\n # run the default report first\n run_one( 'afr', audit_store.deep_clone )\n delete( 'afr' )\n end\n\n loaded.each do |name|\n exception_jail( false ){ run_one( name, audit_store.deep_clone ) }\n end\n end",
"def run(results)\n if(use_multiple?(results))\n results = run_multiple(results)\n else\n results = run_single(results)\n end\n return results\n end",
"def execute_mapped_resource_automation\n begin\n\n # pass along pagination controls\n page = params[:page].to_i\n per_page = params[:per_page].to_i\n offset = page * per_page\n\n # set up a dummy step\n step = Step.new\n\n # since this is a member url we should have the id in the url or throw a 404\n external_script = Script.find(params[:id])\n\n # cache the plan involved for later assignment to selected tickets\n plan = Plan.find(params[:plan_id]) if params[:plan_id].present?\n\n # prepare an argument hash\n argument_hash = {}\n\n # cycle through the form variables to see what has been set, ignoring blank values\n params[:argument].each do |key, value|\n argument_name = ScriptArgument.find(key).argument\n # guarantee that all values are an array\n value = Array(value)\n # select box values are coming through as single element arrays\n if value.length < 2\n argument_hash[argument_name] = value[0] unless value.blank? || value[0].blank?\n else\n # CHKME: Does AO allow arrays of values from a multi-select?\n argument_hash[argument_name] = value\n end\n end\n\n # Execute and fetch the resource automation output\n external_script_output = view_context.execute_automation_internal(step, external_script, argument_hash, nil, offset, per_page)\n\n # for testing purposes construct the hash here\n # external_script_output = {\n # :perPage => 5,\n # :totalItems => 100,\n # :data =>\n # [\n # [\"ra_uniq_identifier\",\"Foreign Id\",\"Name\",\"Ticket Type\", \"Status\", \"Status Label\", \"Extended Attributes\"],\n # [\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\"]\n # ]\n # }\n query_name = \"#{external_script.project_server.name}: #{external_script.name}: #{Time.now.to_s(:short_audit)}\"\n # now is a good time -- with a successful run we hope -- to save this query for later recall\n @query = plan.queries.create( :project_server => external_script.project_server,\n :name => query_name,\n :script => external_script,\n :user => User.current_user )\n # if that was successful, go ahead and add the arguments to the query details\n if @query\n argument_hash.each do |key, value|\n # FIXME: Type in schema for conjunction <> conjuction\n @query.query_details.create(:query_element => key, :query_criteria => \"=\", :query_term => value, :conjuction => 'AND')\n end\n end\n # cache the new saved queries so we can update the menu with this latest run\n # now see if there are any past queries\n saved_queries = plan.queries.where(:last_run_by => User.current_user.try(:id)).order('created_at DESC').limit(25)\n\n # send all this data to a js partial that will reload items as needed\n render :partial => 'shared_scripts/execute_mapped_resource_automation',\n :locals => { :external_script_output => external_script_output,\n :project_server_id => external_script.integration_id,\n :plan => plan, :saved_queries => saved_queries }\n rescue Exception => err\n log_automation_errors(step, err, external_script_output)\n render :text => ApplicationController.helpers.options_for_select([['N.A', '']])\n end\n end",
"def batch\n yield if block_given?\n end",
"def perform(*args)\n\n file_upload_id = args[0]\n row_start = args[1]\n row_end = args[2]\n validate_only = args[3]\n\n file_upload = FileUpload.find_by_id(file_upload_id)\n\n if file_upload.blank?\n Rails.logger.error(\"[Workers::ProcessEmployeeRows] Invalid file upload id - #{file_upload_id}\")\n return\n end\n\n company_id = file_upload.attachable_id\n\n rows = CSV.parse(file_upload.data_file.download, headers: true)\n process_rows = rows[row_start..(row_end - 1)]\n\n total_rows = process_rows.count\n valid_rows = []\n errors = []\n row_count = row_start\n policies = []\n emails = []\n existing_emails = []\n\n #Process employee table data\n process_rows.each_with_index do |row, index|\n name = row[\"Employee Name\"].to_s.strip\n email = row[\"Email\"].to_s.strip\n phone = row[\"Phone\"].to_s.strip\n emails << email\n\n employee_obj = Employee.new(name: name, email: email, phone: phone, company_id: company_id)\n\n if employee_obj.valid?\n valid_rows << employee_obj unless validate_only\n else\n errors << \"Row #{row_count + 1} Error: #{employee_obj.errors.full_messages}\"\n end\n\n row_count += 1\n\n #Bulk insert when INSERT threshold is reached or last row is in process\n if valid_rows.present? && (valid_rows.count == Employee::BULK_INSERT_SIZE || index == total_rows - 1)\n #Bulk SQL insert. No need for model validation. And ignore(don't raise exception) on duplicate emails\n Employee.import valid_rows, validate: false, on_duplicate_key_ignore: true\n valid_rows = []\n end\n\n #To validate existing emails in sheet\n if validate_only && emails.present? && (emails.count == Employee::BULK_INSERT_SIZE || index == total_rows - 1)\n existing_emails << Employee.where(email: emails).pluck(:email)\n end\n\n policies << row[\"Assigned Policies\"].to_s.split(\"|\").map(&:strip)\n end\n\n existing_emails = existing_emails.flatten\n if existing_emails.present?\n errors << \"Error: Emails #{existing_emails.join(\", \")} already exist in system\"\n end\n\n #Redis is used to temporary write the errors raised by several jobs fired for processing millions of rows\n LocalCache.pipelined {\n errors.each {|error| LocalCache.lpush(\"emp_batch_#{file_upload_id}_errors\", error)}\n }\n\n unless validate_only\n #Process employee policy data\n policies = policies.flatten.uniq\n policies_hash = Policy.where(name: policies).pluck(:name, :id).to_h\n process_rows.each_slice(Employee::BULK_INSERT_SIZE) do |batch|\n email_batch = batch.map{|m| m[\"Email\"]}\n emails_id_hash = Employee.where(email: email_batch).pluck(:email, :id).to_h\n\n insert_rows = []\n\n batch.each do |row|\n row[\"Assigned Policies\"].to_s.split(\"|\").map(&:strip).each do |policy|\n insert_rows << EmployeePolicy.new(\n employee_id: emails_id_hash[row[\"Email\"]],\n policy_id: policies_hash[policy]\n ) if emails_id_hash[row[\"Email\"]].present?\n end\n end\n\n #Bulk inser employee policies\n EmployeePolicy.import insert_rows, validate: false\n\n end\n end\n\n #Sidekiq Pro provides Batch processing which provides workflow(dependent job execution).\n #Since we are using the free version of sidekiq, created the custom logic of dependent job processing.\n # LOGIC:: Maintain a counter of rows processed in the Redis and update counter in transaction\n # when set of rows for that job gets processed. When the counter reaches to the total rows,\n # process the dependent job(reporting manager linking)\n redis_key = \"emp_batch_#{file_upload_id}\"\n loop do\n LocalCache.watch(redis_key)\n old_value = LocalCache.get(redis_key).to_i\n new_value = old_value + Employee::BULK_IMPORT_BATCH\n res = LocalCache.multi do |multi|\n multi.set(redis_key, new_value)\n end\n\n if res.present?\n LocalCache.unwatch\n break\n end\n end\n\n #When all rows of csv are processed, process the dependent job(reporting manager linking)\n if LocalCache.get(redis_key).to_i >= rows.count\n LocalCache.del(\"redis_key\")\n ProcessEmployeeManager.perform_async(file_upload_id, validate_only)\n end\n\n end",
"def process_record(record_values,row_index,nuix_case)\n\t\t# Determine matcher for this row\n\t\titems = nil\n\t\tmatchers.each do |matcher|\n\t\t\tcolumn_value = record_values[matcher.col_index] || \"\"\n\t\t\tif !column_value.strip.empty?\n\t\t\t\titems = matcher.obtain_items(column_value,nuix_case)\n\t\t\t\tif items.size > 0\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# If we obtained items, run each annotater\n\t\tif items.nil?\n\t\t\tAnnotationCSVParser.log \"Row #{row_index+1}: No matcher columns had a value or yielded any items\"\n\t\telse\n\t\t\t# Some matcher was able to give us some items\n\t\t\tif @remove_excluded_items\n\t\t\t\titems = items.reject{|i| i.isExcluded}\n\t\t\tend\n\n\t\t\tif items.size < 1\n\t\t\t\tAnnotationCSVParser.log \"After removing excluded items, 0 items remain, moving on...\"\n\t\t\telse\n\t\t\t\tannotaters.each do |annotater|\n\t\t\t\t\tcolumn_value = record_values[annotater.col_index] || \"\"\n\t\t\t\t\tannotater.perform_annotation(items,column_value,nuix_case)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def perform(batch_tracking_record)\n start_tracking_execution(batch_tracking_record)\n\n execute_batch(batch_tracking_record)\n\n batch_tracking_record.succeed!\n rescue Exception => error # rubocop:disable Lint/RescueException\n batch_tracking_record.failure!(error: error)\n\n raise\n ensure\n metrics.track(batch_tracking_record)\n end",
"def perform_analysis(faids)\n @checker = Checker.new(schematron, self)\n faids.each do |faid|\n faid = faid.current if faid.is_a? FindingAid\n ActiveRecord::Base.transaction do\n @checker.check(faid).each_slice(1000) do |batch|\n ConcreteIssue.insert_all(batch)\n end\n self.finding_aid_versions << faid\n self.increment! :eads_processed\n end\n end\n end",
"def run(&block)\n case @sproc_type\n when :select, :all\n all(&block)\n when :first\n first\n when :insert\n insert\n when :update\n update\n when :delete\n delete\n end\n end",
"def batch_edit\n @records = record_class.all\n end",
"def process_batch(batch)\n call([], :process_batch, batch.__calls)\n end",
"def perform(harvest_item_id, should_harvest)\n load_records(harvest_item_id)\n\n process_steps(should_harvest)\n end",
"def step_result; end",
"def step(steps, force = false)\n #This is a stub, used for indexing\n end",
"def exec_steps!\n Executor[result, @options, _self: self]\n end",
"def run_all\n perform\n end",
"def run_all\n perform\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = InsertRecordsResultSet.new(resp)\n return results\n end",
"def each\n response = run\n\n entities = @collection.deserialize(response.entities)\n entities.each { |x| yield(x) }\n\n while continue?(response)\n response.entities = []\n\n @options[:exclusive_start_key] = response.last_evaluated_key\n response = run(response)\n\n entities = @collection.deserialize(response.entities)\n entities.each { |x| yield(x) }\n end\n\n response.count\n end",
"def post_load(all_records)\n end",
"def perform_processing_run(faids)\n perform_analysis(faids)\n perform_processing!\n end",
"def fire\n @thens.each do |t|\n process_then(t)\n end\n end",
"def each(&block)\n @raw_page['records'].each { |record| yield Restforce::Mash.build(record, @client) }\n\n np = next_page\n while np\n np.current_page.each(&block)\n np = np.next_page\n end\n end",
"def execute!\n @actions.each do |action|\n action.call\n end\n end",
"def all_steps\n\t#make calls to step here...\nend",
"def each(&block)\n process_results unless @processed\n @results.each(&block)\n end",
"def script_do_in_batches(options = {}, &block)\n start = Time.now\n count_options = options.reject {|k,v| %w(order select batch_size sleep logger).include?(k.to_s)}\n item_count = count(count_options)\n iteration = 1\n do_in_batches(options) do |record|\n msg = \"#{iteration} of #{item_count} (#{(iteration.to_f / item_count * 100).round(2)}%)\"\n puts \"#{record.id.to_s.ljust(10)} #{msg.ljust(30)} time #{Time.now - start}\"\n yield(record)\n iteration += 1\n end\n puts \"Finished in #{Time.now - start} s\"\n end",
"def records_for_bulk_index(ids, batch_size = 1000)\n transaction do\n offset = 0\n ids.each_slice(batch_size) do |id_slice|\n records = find( :all, :conditions => [\"id in (?)\", id_slice] )\n #yield records, offset\n yield find( :all, :conditions => [\"id in (?)\", id_slice] ), offset\n offset += batch_size\n end\n end\n end",
"def run\n self.prominence!\n return self.send_results if @query.any?\n\n self.fuzzy_match\n self.apply_narrowing_filters\n self.apply_limit\n self.load_and_sort_by_matches\n self.send_results\n end",
"def execute()\n \n # Retrieve a single entry from KS_SRV_Helper form\n base_record = @@remedy_forms['KS_SRV_CustomerSurvey'].find_entries(\n :single,\n :conditions => [%|'CustomerSurveyInstanceId' = \"#{@parameters['Submission ID']}\" OR 'CustomerSurveyID' = \"#{@parameters['Submission ID']}\"|],\n :fields => :all\n )\n \n raise \"Unable to find KS_SRV_CustomerSurvey record with CustomerSurvey ID or instanceId of: #{@parameters['Submission ID']}\" if base_record.nil?\n \n\tif (@taskVersion == \"3\")\n\t#v3\n # Build the template record from the KS_SRV_CustomerSurvey record, which\n # includes the Template fields.\n\t template_record = Records::Template.new(base_record)\n \n # Build the template dataset mappings based on the KS_SRV_DataSet form\n # records for dataset specified on the current KS_SRV_CustomerSurvey\n # record.\n\n\t @dataset_hash = Records::TemplateDataSetMapping.find_all(\n\t\t :data_set => template_record.data_set\n\t\t).inject({}) do |hash, mapping_record|\n\t\t # Define the current KS_SRV_DataSet record's field_id as a Fixnum\n\t\t field_id = mapping_record.field_id.to_i\n\t\t # Retrieve the ArsModels::Field associated with the current\n\t\t # KS_SRV_CustomerSurvey field.\n\t\t mapping_field = Records::RequestBase.form.field_for(field_id)\n\t\t # Unless the field does not exist on the form, or the field is display only\n\t\t unless mapping_field.nil? || mapping_field.entrymode == \"DISPLAY_ONLY\"\n\t\t\t# Retrieve the value of the field on the KS_SRV_CustomerSurvey entry\n\t\t\tvalue = base_record[field_id]\n\t\t\t# Map the KS_SRV_DataSet record's field label value to the field value\n\t\t\thash[mapping_record.field_label] = value.respond_to?(:value) ? value.value : value\n\t\t end\n\t\t # Return the hash to continue injecting\n\t\t hash\n\t\tend\n\t\t puts(format_hash(\"Dataset Found: \", @dataset_hash)) if @debug_logging_enabled\n\t\n\telsif (@taskVersion == \"4\")\n\t \n\t template_record = Records::Template.new(base_record, :context => @@remedy_context)\n\t \n\t @dataset_hash = Records::TemplateDataSetMapping.find_all(\n\t\t :data_set => template_record.data_set, :context => @@remedy_context\n\t\t).inject({}) do |hash, mapping_record|\n\t\t # Define the current KS_SRV_DataSet record's field_id as a Fixnum\n\t\t field_id = mapping_record.field_id.to_i\n\t\t # Retrieve the ArsModels::Field associated with the current\n\t\t # KS_SRV_CustomerSurvey field.\n\t\t mapping_field = Records::RequestBase.form.field_for(field_id)\n\t\t # Unless the field does not exist on the form, or the field is display only\n\t\t unless mapping_field.nil? || mapping_field.entrymode == \"DISPLAY_ONLY\"\n\t\t\t# Retrieve the value of the field on the KS_SRV_CustomerSurvey entry\n\t\t\tvalue = base_record[field_id]\n\t\t\t# Map the KS_SRV_DataSet record's field label value to the field value\n\t\t\thash[mapping_record.field_label] = value.respond_to?(:value) ? value.value : value\n\t\t end\n\t\t # Return the hash to continue injecting\n\t\t hash\n\t\tend\n\t\tputs(format_hash(\"Dataset Found: \", @dataset_hash)) if @debug_logging_enabled\n\t\t\n\tend\n \n dataset_results = \"\" \n @dataset_hash.each_pair {|key, value|\n dataset_results << %|<result name=\"#{key}\">#{escape(value)}</result>|\n }\n \n <<-RESULTS\n <results>\n #{dataset_results}\n </results>\n RESULTS\n \n end",
"def run(*params)\n setup!(*params) # where do we assign/find the model?\n\n [process(*params), @valid].reverse\n end",
"def post_process(records, dependency_map)\n records.each do |record|\n dependency_map.each do |ta, deps|\n assoc_name = alias_map[ta]\n list = record.send(assoc_name)\n rec_list = if type_map[ta]\n list.uniq!\n if lo = limit_map[ta]\n limit, offset = lo\n offset ||= 0\n if type_map[ta] == :offset\n [record.associations[assoc_name] = list[offset]]\n else\n list.replace(list[(offset)..(limit ? (offset)+limit-1 : -1)] || [])\n end\n else\n list\n end\n elsif list\n [list]\n else\n []\n end\n record.send(:run_association_callbacks, reflection_map[ta], :after_load, list) if after_load_map[ta]\n post_process(rec_list, deps) if !rec_list.empty? && !deps.empty?\n end\n end\n end",
"def perform\n return if triggers.blank?\n\n # for each trigger matching this item's class\n triggers.each do |trigger|\n # see if any/all conditions match this item's state\n unless ConditionTriggerJoin\n .meets_condtions?(trigger.condition_trigger_joins, item)\n next\n end\n\n # perform all actions associated with this trigger\n trigger.actions.map do |action|\n perform_crud(fetch_records(action), action)\n end\n end\n end",
"def execute_batch_set(docs)\n self.inserts_valid = true\n inserts = pre_process_batch_insert(docs)\n if insertable?\n collection.find(selector).update_one(\n positionally(selector, '$set' => { path => inserts }),\n session: _session\n )\n post_process_batch_insert(docs)\n end\n inserts\n end",
"def process\n by_time_batch\n by_waiting_batch\n rescue\n @logger.fatal \"Failed to process: #{$!}\"\n @logger.fatal $!.backtrace.join(\"\\n\")\n end",
"def run inputs = {}\n inputs.merge!(self.options)\n output_inputs(inputs)\n run_step_names = run_steps inputs\n puts \"running steps: #{run_step_names.join(\", \")}\"\n missing = missing_step_inputs inputs\n unless missing.empty?\n output_missing(missing)\n return\n end\n results = []\n @steps.each do |step|\n puts \"step: #{step.name}\"\n step_output = step.outputs_given inputs\n if run_step_names.include? step.name\n results << step.call_run_block(inputs,step_output)\n inputs.merge! step_output\n else\n inputs.merge! step_output\n end\n end\n results\n end",
"def update_records(range = nil)\n find(:all).each do |record|\n record.update_record\n end\n end",
"def run(results)\n columns_names = rows.first.inject([]) {|m, kv| m << kv[0]; m}\n row_count = rows.size\n initial_data = results.all.map {|r| columns.map {|c| r[c]}}\n asrecordset = ASRecordset.new(row_count,column_names,initial_data)\n \tresult = asrecordset\n \treturn result\n end",
"def run_by_report_load(report_load)\n # Set the user\n RequestStore[:current_user] = User.system_user\n\n # Establish connection\n conn = ActiveRecord::Base.connection\n\n eps_queried = get_eps(report_load, conn)\n eps_queried.each do |x|\n call_sync_by_report_load(x[\"reference_id\"], report_load, conn)\n end\n\n # Close the connection\n conn.close\n end",
"def run_step_one\n puts \"Executing Step ONE\"\n end",
"def insert_sql_each\n return enum_for(__method__) unless block_given?\n each_row do |row|\n yield table_dataset.insert_sql( row )\n end\n end",
"def run(changes)\n changes.each do |(id, salesforce_model), accumulator|\n next unless salesforce_model == @mapping.salesforce_model\n\n database_instance = @mapping.database_record_type.find(id)\n salesforce_instance = @mapping.salesforce_record_type.find(id)\n next unless database_instance && salesforce_instance\n\n update(database_instance, accumulator) if @strategy.to_database?\n update(salesforce_instance, accumulator) if @strategy.to_salesforce?\n end\n end",
"def upload_records(&block)\n count = input.upload_records(&block)\n self.record_count = (record_count || 0) + count\n count\n end",
"def run\n\n # Gets possible data source(s)\n service(:sniffer).exec\n\n # Filters the data source(s) to extract the relevant only.\n service(:filter).exec\n\n # ETL\n context[:to_be_extracted].each_with_index do |ds, i|\n log.debug \"starting ETL, idx=#{i + 1}\"\n context[:extract] = ds\n service(:extractor).exec\n service(:transformer).exec\n service(:loader).exec\n end\n\n log.info 'Bye bye'\n end",
"def add_records(records)\n records.each do |r|\n condensed_record = condense_record(r)\n load_atoms(condensed_record)\n add_occurences(condensed_record,r.id)\n @records_size += 1\n end\n end",
"def randomize_records\n puts \"Due to the API throughput limitations, this may take some time...\\n\"\n\n execute_customer_record_create(10)\n\n execute_sales_order_create(25)\n\n execute_invoice_create(25)\n\n # 25.times do |t|\n # execute_payment_create(25)\n # end\n\n puts \"\\nFinished creating bulk records!\"\n exit\n end",
"def execute(paginating = false)\n lines = caller\n\n ActiveSupport::Notifications.instrument(:fm_store_execute, :model_name => klass.to_s, :params => params, :options => options, :lines => lines) do\n conn = Connection.establish_connection(klass)\n\n if find_query\n # We will be using the -findquery command\n rs = conn.send(:get_records, \"-findquery\", params, options)\n else\n rs = conn.find(params, options)\n end\n\n @count = rs.foundset_count if paginating\n\n FmStore::Builders::Collection.build(rs, klass)\n end\n end",
"def execute_batch(sql, *args, &block)\n @db.execute_batch(rewrite_table_names(sql), *args, &block)\n end",
"def perform(*args); end",
"def commence\n result = @driver.step( @stmt.handle )\n check result\n @first_row = true\n end",
"def run!\n loop do\n process next_record\n @monitor.periodically{|i| i }\n break if empty?\n end \n end",
"def run(sets)\n sets = Util.to_hash(sets)\n to_run = config['search'].select {|eng,valhash| valhash['run'] }\n to_run.each do |engine,valhash|\n search_engine = Katamari::SearchEngine.const_get(engine.capitalize).new(@config)\n list_of_runs = sets.map {|key,val| val }.flatten\n search_engine.run(list_of_runs)\n end\n end",
"def perform\n Magento2::Api.configure('dz4xnhhgfsfuyj00g6bkel0jq6mwdak2', 'hhjnlf59qh2m7an9sdpfcu0o9nox78y6', 'ie5iafduhqs1dydynidsjki582oti17w', 'mva5hldj17elic6muxmf53fq7zmm7xl5', \"https://mall2door.net\")\n orders = Magento2::Api.get(\"/rest/en/V1/orders\", {searchCriteria: 'all'})\n all_orders = orders[:items]\n all_orders.each do |order|\n order_id = order[:increment_id]\n store = order[:store_id]\n if store === 1 && order_id > \"000000047\" && order_id != \"7000000001\"\n n_perform order,order_id, store\n elsif store === 6 && order_id > \"6000000075\" && order_id != \"7000000001\"\n n_perform order,order_id, store\n end\n\n end\n end",
"def call(records)\n records.each do |rec|\n if rec.is_a?(model)\n change_primary_key(rec)\n # see the class comment on {CompositeFilter}\n rec.instance_eval { remove_instance_variable(:@_key) if defined?(@_key) }\n end\n change_foreign_keys_if_any(rec)\n end\n end",
"def each(&block)\n target.call().find_each do |model|\n row = ETL::Row.new()\n row[self.name] = model\n if map.nil?\n model.attributes.symbolize_keys.each{|k,v| row[k]=v}\n else\n map.each do |obj|\n if obj.kind_of?(Symbol)\n row[obj] = model.send(obj)\n elsif obj.kind_of?(Hash)\n obj.each do |key, val|\n if val.kind_of?(Proc)\n row[key] = val.call(model)\n else\n row[key] = model.resolve_value(val)\n end\n end\n end\n end\n end\n block.call(row)\n end\n end",
"def each_row\n return enum_for(:each_row) unless block_given?\n\n batch.un_pre_assembled_objects.each do |dobj|\n row = process_dobj(dobj)\n summary[:total_size] += row.counts[:total_size]\n if row.errors.empty?\n status = 'success'\n else\n summary[:objects_with_error] += 1\n status = 'error'\n end\n row.counts[:mimetypes].each { |k, v| summary[:mimetypes][k] += v }\n # log the output to a running progress file\n File.open(batch.batch_context.progress_log_file, 'a') { |f| f.puts log_progress_info(dobj, status).to_yaml }\n yield row.to_h\n end\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = GetRecordsByIdResultSet.new(resp)\n return results\n end",
"def each_record\n return enum_for(:each_record) unless block_given?\n\n while (rec = record)\n yield rec\n end\n end",
"def exec__from exec_plan\n batch,\n batch_controller = array__from(exec_plan)\n exec__batch batch, batch_controller\n end",
"def all\n response = run\n\n while continue?(response)\n @options[:exclusive_start_key] = response.last_evaluated_key\n response = run(response)\n end\n\n @collection.deserialize(response.entities)\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = GetRecordsResultSet.new(resp)\n return results\n end",
"def run(list); end"
] |
[
"0.6176198",
"0.6162629",
"0.60867375",
"0.60436374",
"0.59226406",
"0.5849183",
"0.5819848",
"0.58031684",
"0.57502186",
"0.57264334",
"0.57128054",
"0.56950057",
"0.5691858",
"0.56801975",
"0.56704354",
"0.5600656",
"0.55922997",
"0.5591342",
"0.5585435",
"0.55600095",
"0.55553687",
"0.5549183",
"0.55368525",
"0.55368525",
"0.5532106",
"0.55314916",
"0.5529137",
"0.5509474",
"0.5495619",
"0.54861414",
"0.5464958",
"0.54509276",
"0.5439187",
"0.5433293",
"0.5387405",
"0.5384941",
"0.5384743",
"0.53791314",
"0.53703403",
"0.5345574",
"0.5343576",
"0.5333099",
"0.5323107",
"0.53140503",
"0.5305649",
"0.52978784",
"0.52926373",
"0.5286597",
"0.5276439",
"0.5263266",
"0.5260886",
"0.5256347",
"0.523066",
"0.5210478",
"0.52072966",
"0.52072966",
"0.5192637",
"0.5179564",
"0.5171599",
"0.5152368",
"0.5150519",
"0.5122957",
"0.51212704",
"0.5114896",
"0.51076484",
"0.5091956",
"0.50911933",
"0.5089458",
"0.5084069",
"0.5070604",
"0.5068215",
"0.5065479",
"0.5063754",
"0.504923",
"0.5046997",
"0.5042525",
"0.50401115",
"0.5039162",
"0.50369847",
"0.5021306",
"0.50095564",
"0.5002885",
"0.5002394",
"0.49959016",
"0.498882",
"0.49835506",
"0.4979134",
"0.4974483",
"0.4970698",
"0.49659565",
"0.496127",
"0.49559557",
"0.49551314",
"0.495452",
"0.4954347",
"0.49540123",
"0.49423066",
"0.4940363",
"0.49302104",
"0.49291983",
"0.49278623"
] |
0.0
|
-1
|
GET /projects/1 GET /projects/1.xml
|
def show
if params[:unit_id]
@project = Unit.find(params[:unit_id]).project
else
@project = Project.find(params[:id])
end
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @project }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html\n format.xml { render xml: @projects } # index.html.erb\n end\n end",
"def index\n @projects = @client.projects\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n end\n end",
"def index\n @projects = Project.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n end\n end",
"def index\n @projects = Project.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @projects.to_xml }\n end\n end",
"def index\n @projects = Project.all\n\n>>>>>>> 336471e6be257cf55c9afa2a65f928fde34e41fe:app/controllers/projects_controller.rb\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n end\n end",
"def index\n @projects = Project.order( :name ).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.xml { render xml: @project } # show.html.erb\n end\n end",
"def index\n begin\n initialize_projects\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @projects }\n end\n rescue Exception => error\n render inline: \"<span style='color:red;'>No project found: #{error.message}</span>\"\n end\n end",
"def list\n get 'projects'\n end",
"def show\n @project = Project.find(params[:ids])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def show\n @project = Admin::Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @project.to_xml }\n end\n end",
"def show\n @project = Project.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def projects\n records \"project\", \"/project/list\"\n end",
"def index\n @project = Project.find params[:project_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @plays }\n end\n end",
"def show\n @project = Project.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def index\n @projects = Project.all(:conditions => {:visibility => \"Public\"})\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n end\n end",
"def projects\n resource 'projects'\n end",
"def show\n @project_path = ProjectPath.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project_path }\n end\n end",
"def index\n @projects = Project.find_all_by_user_id(current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n end\n end",
"def projects\n request(method: 'getAllProjects')\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.haml\n format.xml { render :xml => @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n set_current_project\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def show\n @current_project = CurrentProject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @current_project }\n end\n end",
"def index\n @projects = @sprint.projects.find(:all, :order => 'position ASC')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @projects.to_xml }\n end\n end",
"def index\n @projects = Project.paginate :page => params[:page], :order => 'created_at DESC', :per_page => 6\n\n respond_to do |format|\n format.html # index.haml\n format.xml { render :xml => @projects }\n end\n end",
"def show\n @project = Project.find(params[:id])\n @sites = @project.spans\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def show\n @project = @client.projects.find(params[:id])\n @events = @project.events.limit(15)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @project }\n end\n end",
"def index\n @tasks = @project.tasks\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tasks }\n end\n end",
"def listprojects\n get('listprojects.json')['projects']\n end",
"def index\n @projects = @user.projects.active.paginate(:per_page => 3, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n end\n end",
"def test_should_create_project_via_API_XML\r\n get \"/logout\"\r\n post \"/projects.xml\", :api_key=>'testapikey',\r\n :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response :created\r\n end",
"def get\n CircleCi.request(conf, '/projects').get\n end",
"def show\n @project = Project.find(params[:id])\n @title = @project.project_name\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def show\n @activities_project = ActivitiesProject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activities_project }\n end\n end",
"def show\n @project = Project.find(params[:id], :include => {:gem_versions => :gem})\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def show\n @pat_project = Pat::Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pat_project }\n end\n end",
"def show\n @admin_project = Admin::Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @admin_project }\n end\n end",
"def listProjects \n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/1/projects')\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {\n 'Content-Type'=> 'application/json',\n 'X-RunDeck-Auth-Token'=> API_KEY \n}\n r = http.get(uri.path, headers)\n return r.body.force_encoding(\"UTF-8\")\n\nend",
"def index_by_project\n @effort_log = EffortLog.new\n @projects = Project.all\n if(params[:id])\n @project = Project.find(params[:id])\n end\n respond_to do |format|\n format.html\n format.xml { render :xml => @project.effort_logs }\n end\n end",
"def index\n #@projects = Project.all\n PivotalTracker::Client.token = current_user.setting.pt_api_key\n logger.debug current_user.setting.pt_api_key\n @projects = PivotalTracker::Project.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n end\n end",
"def show\n @project = @user.projects.find(params[:id])\n @items = @project.items.ready\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def show\n @project_status = ProjectStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project_status }\n end\n end",
"def index\n @cpro_projects = CproProject.find(:all)\n session[:original_uri] = \"/cpro_projects\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cpro_projects }\n end\n end",
"def show\n @project = Salesforce::Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def projects\n Sifter.\n get(\"/api/projects\").\n parsed_response[\"projects\"].\n map { |p| Sifter::Project.new(p) }\n end",
"def project(project_id)\n resource \"projects/#{project_id}\"\n end",
"def show\n @project2 = Project2.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project2 }\n end\n end",
"def index\n @projects = @namespace.projects.all\n end",
"def show\n @project = Project.find(params[:id])\n<<<<<<< HEAD:app/controllers/projects_controller.rb\n @disciplines = collect_disciplines\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @projects }\n end \n end",
"def project(project_id, params = {})\n make_get_request(\"/projects/#{project_id}\", params)\n end",
"def index\n conditions = {}\n conditions[:status] = params[:status] if params[:status]\n @projects = Project.find(:all, :conditions => conditions)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n format.json { render :json => @projects }\n end\n end",
"def show\n @project = Project.find(params[:id])\n @members = @project.members.all\n @tasks = @project.tasks.all(:order => \"status, priority, deadline\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => [@project, @members, @tasks] }\n end\n end",
"def project\n request :project\n end",
"def show\n @cpro_project = CproProject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cpro_project }\n end\n end",
"def projects(params = {})\n make_get_request('/account/projects', params)\n end",
"def show \n PivotalTracker::Client.token = current_user.setting.pt_api_key\n @project = PivotalTracker::Project.find(params[:id].to_i)\n @stories = @project.stories.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def find_project(name)\n get(\"/projects/#{name}\")\n end",
"def find_project(name)\n get(\"/projects/#{name}\")\n end",
"def show\n @project_task = ProjectTask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project_task }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def index\n @repositories = @project.repositories.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @repositories }\n end\n end",
"def new\n @project_path = ProjectPath.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project_path }\n end\n end",
"def index\n @projects = Project.visible\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projecttracks = Projecttrack.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projecttracks }\n end\n end",
"def project(id)\n @xml.search(\"object[@id='#{id}']\")\n end",
"def show\n @play = Play.find(params[:id])\n\n @project = @play.project\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @play }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @projects }\n end\n end",
"def index\n @project_costs = ProjectCost.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @project_costs }\n end\n end",
"def new\n @project = Project.new\n @datasets = Dataset.all\n\n respond_to do |format|\n format.html\n format.xml { render xml: @project } # new.html.erb\n end\n end",
"def get(project_name)\n response = get_request(\"/projects/#{project_name}/\")\n TheShiningSource::Project.new(response)\n end",
"def show\n @projects = find_projects\n end",
"def index\n \t@projects = Project.all\n end",
"def show\n @person = Person.find(params[:id])\n @project = Project.find(params[:project_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def index\n\t\t@projects = Project.all\n\tend",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @user = User.find( params[:user_id] )\n\t@user = current_user unless @user || current_user.is_admin?\n @projects = Project.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n end\n end",
"def show\n @projecttrack = Projecttrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @projecttrack }\n end\n end",
"def index\n @project_objectives = ProjectObjective.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @project_objectives }\n end\n end",
"def index\n \n require 'socket'\n local_ip_address = UDPSocket.open {|s| s.connect '64.233.187.99', 1; s.addr.last}\n @host_url = \"http://#{local_ip_address}:#{PORT}\"\n @title = TITLE\n @projects = []\n @projects += CCTray.new.fetch PROJECTS\n end",
"def new\n @project = @client.projects.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @project }\n end\n end",
"def project(project_id, query_params = nil)\n get(\"/projects/#{project_id}\", query_params)\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end"
] |
[
"0.7413227",
"0.7349132",
"0.7223439",
"0.7223439",
"0.72199285",
"0.7193906",
"0.7157614",
"0.7023897",
"0.70230466",
"0.7021735",
"0.7011579",
"0.69437915",
"0.69343835",
"0.69343835",
"0.69343835",
"0.69343835",
"0.69343835",
"0.69343835",
"0.69343835",
"0.69343835",
"0.69305927",
"0.691403",
"0.68940854",
"0.68877697",
"0.6868802",
"0.68596053",
"0.6848492",
"0.68481284",
"0.684325",
"0.68116856",
"0.67759687",
"0.6703161",
"0.6661667",
"0.66483974",
"0.6635231",
"0.66163623",
"0.6615284",
"0.6610454",
"0.66076165",
"0.65965605",
"0.6593353",
"0.65658414",
"0.65466374",
"0.65409654",
"0.65360016",
"0.65278774",
"0.6526363",
"0.65172225",
"0.6463711",
"0.6448753",
"0.64465874",
"0.6445458",
"0.64444816",
"0.6440188",
"0.64162457",
"0.6396516",
"0.6392695",
"0.6382929",
"0.63680583",
"0.6365984",
"0.63561076",
"0.6352529",
"0.63483566",
"0.63382375",
"0.6337731",
"0.6324134",
"0.6314034",
"0.6314034",
"0.6313072",
"0.6312454",
"0.6307545",
"0.63025105",
"0.6301051",
"0.6296453",
"0.62847334",
"0.6252434",
"0.6241048",
"0.62345815",
"0.62183124",
"0.62120855",
"0.6204892",
"0.6203348",
"0.6196771",
"0.6191816",
"0.6184102",
"0.6183278",
"0.6183278",
"0.6183278",
"0.6183278",
"0.6183278",
"0.6183278",
"0.6183278",
"0.618321",
"0.6176441",
"0.6173651",
"0.61723083",
"0.61702526",
"0.6170073",
"0.6165997",
"0.6165997",
"0.6165997"
] |
0.0
|
-1
|
Download the specified gem and return the binary file contents as a string
|
def download_gem(name, version)
cached = GemCache.get(name, version)
return cached unless cached.nil?
client.url = "https://rubygems.org/gems/#{name}-#{version}.gem"
client.follow_location = true
client.http_get
gemf = client.body_str
GemCache.set(name, version, gemf)
gemf
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def download_gem\n self.class.download_gem @name, @version\n end",
"def download_gem\n self.class.download_gem @name, @version\n end",
"def download\n open(download_url, \"rb\")\n end",
"def download(spec, dir=Dir.pwd)\n fetcher = Gem::RemoteFetcher.fetcher\n fetcher.download spec, uri.to_s, dir\n end",
"def download name\n @checked += 1\n gem_name = \"#{name}.gem\"\n\n if gem_exists? gem_name then\n @gem_queue.push name\n\n info \"#{gem_name} exists\"\n\n return\n end\n\n uri = @base_uri + \"#{name}.gem\"\n\n source_etag = nil\n dest_etag = nil\n\n @http.request uri do |source_res|\n break unless etag = source_res['ETag']\n source_etag = etag.delete '\"'\n\n dest_etag = @swift.write_object @gems_container, gem_name do |io|\n source_res.read_body do |chunk|\n io.write chunk\n end\n end\n end\n\n if dest_etag == source_etag then\n @gem_queue.push name\n\n info \"#{gem_name} downloaded\"\n\n @downloaded += 1\n else\n @gem_name_queue.push name\n @swift.delete_object @gems_container, gem_name\n\n info \"#{gem_name} download failed\"\n @failed += 1\n end\n end",
"def download(full_spec, path) # :nodoc:\n end",
"def download_prog(repo_hash)\n if (repo_hash[:source] == \"github\")\n clone_repo(repo_hash)\n elsif (repo_hash[:source] == \"rubygems\")\n puts \"Unpacking gem #{repo_hash[:name]}...\"\n system \"gem unpack #{repo_hash[:name]} --version #{repo_hash[:version]}\"\n else\n raise \"Unexpected source of repo #{repo_hash[:name]}: #{repo_hash[:source]}\"\n end\nend",
"def download(path)\n Gem.ensure_gem_subdirectories path\n\n if @spec.respond_to? :sources\n exception = nil\n path = @spec.sources.find do |source|\n begin\n source.download full_spec, path\n rescue exception\n end\n end\n return path if path\n raise exception if exception\n\n elsif @spec.respond_to? :source\n source = @spec.source\n source.download full_spec, path\n\n else\n source = Gem.sources.first\n source.download full_spec, path\n end\n end",
"def download(spec, path)\n nil\n end",
"def downloaded_gem_path\n self.class.downloaded_gem_path @name, @version\n end",
"def download_and_extract_package\n @fetcher.get_package_file(@package_name, @version)\n Gem::Package::TarReader.new( Zlib::GzipReader.open @fetcher.temp_package_file_path ) do |tar|\n tar.each do |entry|\n next unless entry.file? and entry.full_name.match(\"DESCRIPTION\")\n @package_desc = entry.read\n end\n end\n FileUtils.rm_rf @fetcher.temp_package_file_path\n end",
"def download\n # Turned off ssl verification\n # This should be acceptable because it won't happen on a user's machine, just CI\n\n # define a progress-bar printer\n chunk_size = 1024 * 1024 * 1024\n total_size = 0\n dots = 0\n dot_printer = lambda do |size|\n total_size += size\n needed_dots = (total_size / chunk_size).to_i\n unprinted_dots = needed_dots - dots\n @output.print(\".\" * unprinted_dots) if unprinted_dots.positive?\n dots = needed_dots\n end\n\n URI.open(package_url, ssl_verify_mode: 0, progress_proc: dot_printer) do |url|\n File.open(package_file, 'wb') { |file| file.write(url.read) }\n end\n rescue Net::OpenTimeout, Net::ReadTimeout, OpenURI::HTTPError, URI::InvalidURIError => e\n @output.puts \"\\nArduino force-install failed downloading #{package_url}: #{e}\"\n end",
"def downloaded_gem_path\n self.class.downloaded_gem_path @name, @version\n end",
"def fetch_gem(name, version)\n http_get(host + \"/gems/#{name}-#{version}.gem\").body\n end",
"def gem_path\n @path || downloaded_gem_path\n end",
"def gem_path\n @path || downloaded_gem_path\n end",
"def download_asset(prog_id)\n return download_data(\"http://www.channel4.com/programmes/asset/#{prog_id}\")\n end",
"def download(url)\n Net::HTTP.get_response(url)\n end",
"def file_download\n blob_cache(:file_download) do\n raw_download = tiddlywiki_file.download\n is_compressed? ? SiteCommon.decompress_html(raw_download) : raw_download\n end\n end",
"def download_url(url)\n ethon = ethon_easy_requester\n ethon.url = uri_escape(url)\n ethon.perform\n check_and_raise_failure(ethon)\n {\n file_contents: ethon.response_body,\n link_url: last_location_header(ethon)\n }\n end",
"def download_package\n path = download_path\n remote_file path do\n source URL\n action :create\n only_if { !::File.exist?(PATH) }\n end\n end",
"def get_file(url)\n get(url).body\n end",
"def download(path)\n downloader.get do |req|\n req.url path\n end.body\n end",
"def package_url\n \"https://github.com/arduino/arduino-cli/releases/download/#{@desired_version}/#{package_file}\"\n end",
"def download_installer\n puts pe_installer_url\n unless `curl #{pe_installer_url} -o ./file_cache/installers/#{installer_filename}`\n fail \"Error downloading the PE installer\"\n end\n gzip_installer if PRE_RELEASE\nend",
"def download\n self.rqrcode.to_blob\n end",
"def yardoc_file_for_gem(gem, ver_require = T.unsafe(nil), for_writing = T.unsafe(nil)); end",
"def downloaded_gem_path(name, version)\n # ensure gem is downloaded\n download_gem name, version\n GemCache.path_for(name, version)\n end",
"def file_from_repo(github_user, repo, sha, filename, to = filename)\n download(\"http://github.com/#{github_user}/#{repo}/raw/#{sha}/#{filename}\", to)\nend",
"def file_from_repo(github_user, repo, sha, filename, to = filename)\n download(\"http://github.com/#{github_user}/#{repo}/raw/#{sha}/#{filename}\", to)\nend",
"def fetch type, version, extension=\"tar.gz\"\n core_url = \"#{@base}/#{type}-#{version}.#{extension}\"\n tmp = Galaxy::Temp.mk_auto_file \"galaxy-download\"\n @log.info \"Fetching #{core_url} into #{tmp}\"\n if @base =~ /^http:/\n begin\n output = Galaxy::HostUtils.system(\"curl -D - #{core_url} -o #{tmp} -s\")\n rescue Galaxy::HostUtils::CommandFailedError => e\n raise \"Failed to download archive #{core_url}: #{e}\"\n end\n status = output.first\n (protocol, response_code, response_message) = status.split\n unless response_code == '200'\n raise \"Failed to download archive #{core_url}: #{status}\"\n end\n else\n open(core_url) do |io|\n File.open(tmp, \"w\") { |f| f.write(io.read) }\n end\n end\n return tmp\n end",
"def download_original ; path_download_file(:original).download end",
"def download_file(f)\n run(\"curl -O http://github.com/meskyanichi/rails-templates/raw/master/files/#{f}\")\nend",
"def absolute_gem_binary\n ::File.expand_path(gem_binary, path)\n end",
"def download(spec, target = nil)\n if target.nil?\n ext = File.extname(spec['file_name'])\n base = File.basename(spec['file_name'], ext)\n target = Dir::Tmpname.create([base, ext]) {}\n end\n\n File.open(target, 'wb') do |output|\n retrieve(spec) do |chunk, retrieved, total|\n output.write(chunk)\n yield(target, retrieved, total) if block_given?\n end\n end\n target\n end",
"def retrieve_bundle\n VCR.use_cassette('bundle_download') do\n bundle_resource = RestClient::Request.execute(method: :get,\n url: 'https://cypress.healthit.gov/measure_bundles/fixture-bundle-2020.zip',\n user: ENV.fetch('VSAC_USERNAME', nil),\n password: ENV.fetch('VSAC_PASSWORD', nil),\n raw_response: true,\n headers: { accept: :zip })\n\n return bundle_resource.file\n end\n end",
"def download_build(file)\n temp = Tempfile.new(['gadgets', \"#{file}.rb\"])\n temp.write(url_request(url_of_file(File.join('lib', 'one_gadget', 'builds', \"#{file}.rb\"))))\n temp.tap(&:close)\n end",
"def download_to_string(params = {})\n sio = StringIO.new()\n download_to_io(sio, params)\n return sio.string\n end",
"def download_file url\n check_session\n result = api_client.execute(:uri => url)\n if result.status == 200\n return result.body\n else\n puts \"An error occurred: #{result.data['error']['message']}\"\n return nil\n end\n end",
"def download(url)\n base.get(url, @file_path)\n end",
"def do_download\n checksum = if new_resource.checksum\n new_resource._?(:checksum, '--checksum=sha-256=').join\n end\n header = if new_resource.header\n \"--header='#{new_resource._?(:header)[1]}'\"\n end\n aria2(checksum, header,\n new_resource._?(:path, '-o'),\n new_resource._?(:directory, '-d'),\n new_resource._?(:split_size, '-s'),\n new_resource._?(:connections, '-x'),\n new_resource._?(:check_cert, '--check-certificate=false'),\n new_resource.source)\n end",
"def get_file(login, token)\n begin\n uri = URI('https://api.github.com/repos/'+ login + '/evil1.github.io/contents/powr/index.html')\n req = Net::HTTP::Get.new(uri)\n req['Authorization'] = 'token ' + token\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n res = http.request(req)\n\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n responseObject = ActiveSupport::JSON.decode res.body\n fileContent = Base64.decode64(responseObject['content'])\n\n response = { 'success' => true, 'content' => fileContent, 'sha' => responseObject['sha'] }\n\n else\n response = { 'success' => false, 'message' => 'Error receiving file: ' + res.value }\n end\n rescue Exception => ex\n response = { 'success' => false, 'message' => 'Error receiving file: ' + ex.message }\n end\n\n return response\n end",
"def download(url)\n STDERR.print \"loading #{url}\"\n response = Faraday.get(url)\n STDERR.puts ' (done)'\n response.body\n end",
"def download\n \n @tmpfile = fetch_remote(location)\n \n @fetched_at = Time.new\n \n return @tmpfile\n \n end",
"def file_from_repo(github_user, repo, sha, filename, to = filename)\n download(\"http://github.com/#{github_user}/#{repo}/raw/#{sha}/#{filename}\", to)\n end",
"def get_file(url); end",
"def download_driver_http\n File.write(\n @target_path,\n open(@params[:jdbc_driver_jar]).read\n )\n end",
"def bundle_download(app_name, fname, bundle_name=nil)\n\t\tdata = get(\"/apps/#{app_name}/bundles/#{bundle_name || 'latest'}\")\n\t\tFile.open(fname, \"wb\") { |f| f.write data }\n\tend",
"def retrieve\n raise RetrieverError.new(\"download retriever is unavailable\") unless available?\n ::FileUtils.remove_entry_secure @repo_dir if File.exists?(@repo_dir)\n ::FileUtils.remove_entry_secure workdir if File.exists?(workdir)\n ::FileUtils.mkdir_p @repo_dir\n ::FileUtils.mkdir_p workdir\n file = ::File.join(workdir, \"package\")\n\n # TEAL FIX: we have to always-download the tarball before we can\n # determine if contents have changed, but afterward we can compare the\n # previous download against the latest downloaded and short-circuit the\n # remaining flow for the no-difference case.\n @logger.operation(:downloading) do\n credential_command = if @repository.first_credential && @repository.second_credential\n ['-u', \"#{@repository.first_credential}:#{@repository.second_credential}\"]\n else\n []\n end\n @output = ::RightScale::RightPopen::SafeOutputBuffer.new\n @cmd = [\n 'curl',\n '--silent', '--show-error', '--location', '--fail',\n '--location-trusted', '-o', file, credential_command,\n @repository.url\n ].flatten\n begin\n ::RightScale::RightPopen.popen3_sync(\n @cmd,\n :target => self,\n :pid_handler => :pid_download,\n :timeout_handler => :timeout_download,\n :size_limit_handler => :size_limit_download,\n :exit_handler => :exit_download,\n :stderr_handler => :output_download,\n :stdout_handler => :output_download,\n :inherit_io => true, # avoid killing any rails connection\n :watch_directory => workdir,\n :size_limit_bytes => @max_bytes,\n :timeout_seconds => @max_seconds)\n rescue Exception => e\n @logger.note_phase(:abort, :running_command, 'curl', e)\n raise\n end\n end\n\n note_tag(file)\n\n @logger.operation(:unpacking) do\n path = @repository.to_url.path\n if path =~ /\\.gz$/\n extraction = \"xzf\"\n elsif path =~ /\\.bz2$/\n extraction = \"xjf\"\n else\n extraction = \"xf\"\n end\n Dir.chdir(@repo_dir) do\n @output = ::RightScale::RightPopen::SafeOutputBuffer.new\n @cmd = ['tar', extraction, file]\n begin\n ::RightScale::RightPopen.popen3_sync(\n @cmd,\n :target => self,\n :pid_handler => :pid_download,\n :timeout_handler => :timeout_download,\n :size_limit_handler => :size_limit_download,\n :exit_handler => :exit_download,\n :stderr_handler => :output_download,\n :stdout_handler => :output_download,\n :inherit_io => true, # avoid killing any rails connection\n :watch_directory => @repo_dir,\n :size_limit_bytes => @max_bytes,\n :timeout_seconds => @max_seconds)\n rescue Exception => e\n @logger.note_phase(:abort, :running_command, @cmd.first, e)\n raise\n end\n end\n end\n true\n end",
"def fetch_file(uri)\n res = Net::HTTP.get_response(uri)\n raise \"#{file_url} ended with #{res.code} #{res.message}\" unless res.is_a?(Net::HTTPSuccess)\n\n res.body\n end",
"def download(url)\n resp = http.get(url, :follow_redirect => true)\n\n unless resp.ok?\n raise(\n HTTPClient::BadResponseError,\n \"Got HTTP #{resp.status}: #{resp.body}\"\n )\n end\n\n return resp.body.force_encoding('UTF-8')\n end",
"def download_resource(loader, src_url)\n # play nice with remote web servers\n sleep(rand / 100) if src_url =~ /^[[:alpha:]]+:/\n begin\n loader.spec_invoke(:data_source, src_url, nil)\n rescue Exception => e\n # FIXME: log\n $stderr.puts \"[NOKOGIRI] Cannot download resource : #{e.message}\"\n $stderr.puts e.backtrace[0,2].join(\"\\n\")\n nil\n end\n end",
"def download(path)\n if File.exists?(path)\n puts \"#{path} already exists\"\n\n return\n end\n\n File.open(path, \"w\") do |file|\n file.binmode\n HTTParty.get(self['href'], stream_body: true) do |fragment|\n file.write(fragment)\n end\n end\n end",
"def get_artifact(job_name,filename)\n @artifact = job.find_artifact(job_name)\n response = make_http_request(Net::HTTP::Get.new(@artifact))\n if response.code == \"200\"\n File.write(File.expand_path(filename), response.body)\n else\n raise \"Couldn't get the artifact\"\n end\n end",
"def load_library\n\t\t#wget some url\n\tend",
"def get_download\n\tend",
"def download_progguide(prog_guide_url)\n return download_data(\"http://www.channel4.com#{prog_guide_url}\")\n end",
"def retrieve_latest(name)\n client.url = \"https://rubygems.org/api/v1/gems/#{name}.json\"\n client.http_get\n spec = client.body_str\n gem = parse spec\n gem\n end",
"def download_source\n unless @download_source\n if new_resource.package_url\n res = chase_redirect(new_resource.package_url)\n else\n params = URI.encode_www_form(full: 1,\n plat: node['platform_family'][0..2])\n res = chase_redirect(\"https://www.dropbox.com/download?#{params}\")\n end\n end\n @download_source ||= res\n end",
"def retrieve_version(name, version)\n path = downloaded_gem_path name, version\n parse :gem => path\n end",
"def download(save_path=\"\")\n url = prefix + \"download\"\n r = response(url) \n if r.class == String #success\n open(File.join(save_path,@filename), \"wb\").write(open(r).read)\n return r\n else #failed\n return r\n end\n end",
"def download(save_path=\"\")\n url = prefix + \"download\"\n r = response(url)\n if r.class == String #success\n open(::File.join(save_path,@filename), \"wb\").write(open(r).read)\n return r\n else #failed\n return r\n end\n end",
"def fetch_artifact_zip(download_path, url)\n # rubocop:disable Security/Open\n open(download_path, 'wb') do |file|\n file.print URI.open(url, 'Authorization' => \"token #{ENV['PERSONAL_TOKEN']}\").read\n end\n # rubocop:enable Security/Open\nend",
"def gem_to_gemfile(gem)\n gem_str = <<~GEM\n #{gem.comment ? \"# #{gem.comment}\" : ''}\n #{(gem.commented_out ? '#' : '')}gem '#{gem.name}'#{gem_version_str(gem)}#{gem_options(gem)}\n GEM\n\n gem_str.strip\nend",
"def download!\n\t\traise_if_error C.glyr_opt_download(to_native, true)\n\tend",
"def download_iso\n IsoRepo.get(iso_url)\n end",
"def download\n if verb == :get\n body = get_http_content\n elsif verb == :post\n body = post_http_content\n end\n\n body\n end",
"def download\n tardata = open(TARBALL_URL).read\n digest = Digest::MD5.hexdigest(tardata)\n\n unless digest == MD5\n raise \"Expected MD5 #{MD5} but got #{digest}.\"\n end\n\n tardata\n end",
"def download_file(url)\n\t\t\tf = Tempfile.new(File.basename(url))\n\t\t\tpath = f.path\n\t\t\turl = URI.parse(url)\n\t\t\tNet::HTTP.start( url.host) { |http|\n\t\t\t\tresp = http.get(url.path)\n\t\t\t\tf.write(resp.body)\n\t\t\t}\n\t\t\tf.close\n\t\t\treturn path\n\t\tend",
"def getfile(md5, client = nil, clientip = nil)\n bucket = Puppet::FileBucket::File.indirection.find(\"md5:#{md5}\")\n contents = bucket.contents\n\n if client\n return Base64.encode64(contents)\n else\n return contents\n end\n end",
"def main\n last_good_root = from_file($cache_dir + '/root.txt') ||\n from_file('config/root.txt') ||\n raise(\"Can't find root.txt\")\n\n repository = Gem::TUF::Repository.new(\n root: JSON.parse(last_good_root),\n bucket: FileCachingBucket.new(HttpBucket.new($host))\n )\n\n gem_name = ARGV.shift\n\n specs = repository.target('latest_specs.4.8.gz')\n raise \"could not find latest_specs.4.8.gz\" unless specs\n specs = unmarshal_gz specs\n gem = specs.detect {|x| x[0] == gem_name } || raise(\"Can't find gem #{gem}\")\n\n gem_with_version = \"#{gem[0]}-#{gem[1]}\"\n gem_path = \"gems/#{gem_with_version}.gem\"\n gemspec_path = \"quick/Marshal.4.8/#{gem_with_version}.gemspec.rz\"\n\n repository.target(gemspec_path)\n repository.target(gem_path)\n\n puts \"Downloaded #{gem_path} and #{gemspec_path}\"\nend",
"def _download_module(name)\n command = \"puppet module install #{name} \"\n command += @modulepath + Silence\n\n puts \"Calling '#{command}'\" if @options[:debug]\n system(command)\n end",
"def download\n return file if file\n\n self.file = retrieve_file\n end",
"def download_resource(resource, options={})\n say_status :download, resource\n\n open(resource) do |input|\n contents = input.binmode.read\n return contents if options[:eval] == false\n\n template = ERB.new(contents)\n template.result(binding)\n end\nend",
"def download(url, filename)\n uri = URI.parse(url)\n f = open(filename,'wb')\n begin\n http = Net::HTTP.start(uri.host) {|http|\n http.request_get(uri.path) {|resp|\n resp.read_body {|segment|\n f.write(segment)\n }\n }\n }\n ensure\n f.close()\n end\nend",
"def download\n @package = Package.find(params[:id])\n if @package.present?\n send_file Munki::Application::PACKAGE_DIR + @package.installer_item_location, :filename => @package.to_s(:download_filename)\n fresh_when :etag => @package, :last_modified => @package.created_at.utc, :public => true\n else\n render page_not_found\n end\n end",
"def download_resource(resource)\n puts \"Downloading resource: #{resource}\"\n open(resource) do |input|\n contents = input.binmode.read\n template = ERB.new(contents)\n template.result(binding)\n end\nend",
"def download(path)\n uri = URI.parse(configuration.browser_url + path)\n puts \"downloading #{uri.to_s}\"\n Net::HTTP.get(uri)\n end",
"def download(path)\n uri = URI.parse(context.browser_url + path)\n puts \"downloading #{uri.to_s}\"\n Net::HTTP.get(uri)\n end",
"def download_patch!(opts={})\n download!(:patch, opts)\n end",
"def download(description = @component_name, &block)\n super_download @version, @uri, description, &block\n end",
"def download(url)\n filedl = url.split(\"/\").last\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n open(filedl, \"w\") do |file|\n file.write(response.body)\n end\n return filedl\nend",
"def download_resource(url, path)\n FileUtils.mkdir_p File.dirname(path)\n the_uri = URI.parse(URI.escape(url))\n if the_uri\n data = html_get the_uri\n File.open(path, 'wb') { |f| f.write(data) } if data\n end\n end",
"def download_install_file(action, args={})\n company = @company\n username = @user\n password = @password\n url = \"https://#{company}.logicmonitor.com/santaba/do/#{action}?\"\n args.each_pair do |key, value|\n url << \"#{key}=#{value}&\"\n end\n url << \"c=#{company}&u=#{username}&p=#{password}\"\n uri = URI(url)\n begin\n http = Net::HTTP.new(uri.host, 443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n req = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(req)\n return response.body\n rescue SocketError => se\n puts \"There was an issue communicating with #{url}. Please make sure everything is correct and try again.\"\n puts se.message\n rescue Error => e\n puts \"There was an issue.\"\n puts e.message\n end\n return nil\nend",
"def download(url, filename)\n uri = URI.parse(url)\n f = open(filename,'wb')\n begin\n http = Net::HTTP.start(uri.host) {|http|\n http.request_get(uri.request_uri) {|resp|\n resp.read_body {|segment|\n f.write(segment)\n }\n }\n }\n ensure\n f.close()\n end\nend",
"def get_latest_release(project, bin)\n api_url = \"https://api.github.com/repos/#{project}/releases/latest\"\n data = URI.parse(api_url).read\n obj = JSON.parse(data)\n version = obj[\"name\"]\n sha_url = \"https://github.com/#{project}/releases/download/#{version}/#{bin}.sha256\"\n sha = URI.parse(sha_url).read\n url = \"https://github.com/#{project}/releases/download/#{version}/#{bin}\"\n sha256 = sha.split(\" \").first\n\n return url, sha256, version\nend",
"def download_archive(url, archive, opts)\n archive.binmode\n remote = open(\n url,\n http_basic_authentication: [opts['user'] || '', opts['password'] || ''],\n )\n\n # download content\n archive.write(remote.read)\n archive.rewind\n archive.close\n\n [archive, remote.meta['content-type']]\n end",
"def download_file(agent, url)\n SouvlakiRS.logger.info \" starting download for #{url}\"\n\n data = agent.get(url)\n unless data\n SouvlakiRS.logger.error ' download failed'\n return nil\n end\n\n filename = get_response_filename(data) || filename_from_url(url)\n [data, filename]\n end",
"def download(url)\n response = client.send(:get, url, {}, 'Content-Type': 'text/html')\n raise ::Errors::BadRequest unless response.success?\n\n response.body\n end",
"def downloaded_path\n @downloaded_path ||= File.join(install_path, file_name(url))\n return @downloaded_path\n end",
"def download(uri)\n target = File.join(@cache_dir, filename(uri))\n @logger.debug \"Downloading file to #{target}\"\n rich_uri = URI(uri)\n Net::HTTP.start(rich_uri.host, rich_uri.port, use_ssl: rich_uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(rich_uri.request_uri)\n http.request request do |response|\n File.open(target, File::CREAT | File::WRONLY) do |file|\n response.read_body do |chunk|\n file.write(chunk)\n end\n end\n end\n end\n rescue => e\n @logger.error \"Unable to download from #{uri}\"\n puts e.backtrace\n end",
"def download_source_of_pod(pod_name)\n return if sandbox.local?(pod_name) || sandbox.predownloaded?(pod_name)\n\n pod_downloader = create_pod_downloader(pod_name)\n pod_downloader.download!\n end",
"def fetch_file(url)\n url =~ %r{/([^/]*)\\.(tar\\.gz|tar\\.bz2|tgz|zip|tbz)$}\n name = $1\n ext = $2\n filename = \"#{name}.#{ext}\"\n archive = File.join(env.path, \"archives\", filename)\n\n rbvm_md5 = config_md5[filename]\n\n if File.exists?(archive)\n archive_md5 = Digest::MD5.file(archive)\n if rbvm_md5\n if archive_md5.to_s == rbvm_md5\n log(\"Using existing archive for #{filename}.\", \"info\")\n fetch = false\n else\n log(\"Existing archive has bad MD5, backup and download again.\", \"error\")\n FileUtils.mv(archive, File.join(env.path, \"archives\", \"#{filename}-#{Time.now.strftime(\"%Y%m%d%H%M%S\")}.orig\"))\n archive_md5 = nil\n fetch = true\n end\n else\n log(\"Unknown archive: #{archive}\", \"warn\")\n fetch = false\n end\n else\n fetch = true\n end\n\n if fetch\n catch_error(\"Failed to fetch: #{url}\") do\n log(\"#{name} - #fetching\", 'info')\n exec_cmd(\"curl\", \"-s\", \"-S\", \"-L\", \"--create-dirs\", \"-C\", \"-\", \"-o\", archive, url)\n end\n end\n\n return archive\n end",
"def download_ais(prog_id)\n return download_data(\"http://ais.channel4.com/asset/#{prog_id}\")\n end",
"def from_rubygems(name, version)\n download_gem name, version\n from_gem downloaded_gem_path(name, version)\n end",
"def fetch_spec(spec)\n spec = spec - [nil, 'ruby', '']\n spec_file_name = \"#{spec.join '-'}.gemspec.rz\"\n\n uri = URI.parse(\"#{@remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}\")\n\n spec_rz = (uri.scheme == \"file\") ? Gem.read_binary(uri.path) : fetch(uri)\n Marshal.load Gem.inflate(spec_rz)\n end",
"def download_exported_file_download(opts = {})\n download_exported_file_download_with_http_info(opts)\n nil\n end",
"def get_file(path, options={})\n remove_file path\n resource = File.join(prefs[:remote_host], prefs[:remote_branch], 'files', path)\n replace_file path, download_resource(resource, options)\nend",
"def download(required_version = :latest)\n required_version = latest if required_version == :latest\n download_file_name = \"selenium-server-#{required_version}.jar\"\n\n return download_file_name if File.exist? download_file_name\n\n begin\n download_location = available_assets[download_file_name]['browser_download_url']\n released = Net::HTTP.get_response(URI.parse(download_location))\n redirected = URI.parse released.header['location']\n\n File.open(download_file_name, 'wb') do |destination|\n download_server(redirected, destination)\n end\n rescue StandardError\n FileUtils.rm_rf download_file_name\n raise\n end\n\n download_file_name\n end",
"def download\n get_metadata\n check_prog_id\n generate_filename\n download_stream\n ffmpeg\n tag\n cleanup\n end"
] |
[
"0.75472873",
"0.7486909",
"0.6622866",
"0.6573864",
"0.64689964",
"0.63826466",
"0.63501334",
"0.6331256",
"0.63282627",
"0.62561774",
"0.6245985",
"0.6192359",
"0.61806095",
"0.6175835",
"0.6166896",
"0.6119817",
"0.6119169",
"0.611227",
"0.61119896",
"0.60937846",
"0.6087407",
"0.60457814",
"0.6025732",
"0.6009479",
"0.600838",
"0.599975",
"0.59879017",
"0.59747505",
"0.5973907",
"0.5973907",
"0.5952184",
"0.5937418",
"0.5923603",
"0.59038746",
"0.5888104",
"0.5885862",
"0.5878755",
"0.5878752",
"0.5876569",
"0.5872547",
"0.5871545",
"0.58584744",
"0.5850835",
"0.5820567",
"0.5808218",
"0.58069617",
"0.5801546",
"0.57984996",
"0.57793087",
"0.57450354",
"0.5725081",
"0.56964076",
"0.5696045",
"0.5694676",
"0.5693049",
"0.56562555",
"0.5651516",
"0.5650303",
"0.5649366",
"0.5643336",
"0.5640254",
"0.5635483",
"0.5626402",
"0.5614611",
"0.56093156",
"0.5601226",
"0.55927706",
"0.5558467",
"0.55567795",
"0.55499667",
"0.5544488",
"0.5541928",
"0.5538741",
"0.5526887",
"0.551368",
"0.55027467",
"0.5493282",
"0.5487732",
"0.54797626",
"0.54724455",
"0.54691327",
"0.5464969",
"0.5461736",
"0.54599077",
"0.5457144",
"0.54540855",
"0.54480195",
"0.5441825",
"0.54345196",
"0.54139537",
"0.54086846",
"0.5406931",
"0.54012764",
"0.5396386",
"0.53916866",
"0.5387992",
"0.53872913",
"0.5386617",
"0.5381625",
"0.5377669"
] |
0.6456606
|
5
|
Download the specified gem / version from rubygems and return instance of Polisher::Gem class corresponding to it
|
def from_rubygems(name, version)
download_gem name, version
from_gem downloaded_gem_path(name, version)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def upstream_gem\n @gem ||= Polisher::Gem.from_rubygems gem_name, version\n end",
"def download_gem\n self.class.download_gem @name, @version\n end",
"def fetch_gem(name, version)\n http_get(host + \"/gems/#{name}-#{version}.gem\").body\n end",
"def download_gem\n self.class.download_gem @name, @version\n end",
"def retrieve_version(name, version)\n path = downloaded_gem_path name, version\n parse :gem => path\n end",
"def retrieve_latest(name)\n client.url = \"https://rubygems.org/api/v1/gems/#{name}.json\"\n client.http_get\n spec = client.body_str\n gem = parse spec\n gem\n end",
"def download_gem(name, version)\n cached = GemCache.get(name, version)\n return cached unless cached.nil?\n\n client.url = \"https://rubygems.org/gems/#{name}-#{version}.gem\"\n client.follow_location = true\n client.http_get\n gemf = client.body_str\n\n GemCache.set(name, version, gemf)\n gemf\n end",
"def gem(name, version)\n version = version.to_s\n\n begin\n json = open(\"https://rubygems.org/api/v1/versions/#{name}.json\") {|f| f.read}\n gems = JSON.parse(json)\n\n gem = gems.detect do |g|\n g[\"number\"] == version && g[\"platform\"] == \"ruby\"\n end\n\n if gem && gem[\"sha\"]\n # Rubygems.org was _supposed_ to provide base64 encoded SHA-256 hashes,\n # but as of now the hashes are base16 encoded...\n base16 = gem[\"sha\"]\n base32 = exec(\"nix-hash --type sha256 --to-base32 #{base16.shellescape}\")\n assert_length!(base32, 52)\n assert_format!(base32, /^[a-z0-9]+$/)\n\n base32\n end\n rescue Exception => ex\n #puts ex.message\n #puts ex.backtrace\n nil\n end\n end",
"def latest_version(name)\n return JSON.parse(open(\"http://rubygems.org/api/v1/gems/#{name}.json\").read)['version']\n end",
"def latest\n url = \"https://pypi.python.org/pypi/#{URI.encode(@resource[:name])}/json\"\n result = self.open_jsonurl(url)\n result['info']['version'] if result != nil\n rescue Timeout::Error => detail\n raise Puppet::Error, \"Error in contacting pypi.python.org: #{detail}\"\n end",
"def ruby_gems_fetcher\n return @ruby_gems_fetcher if defined?(@ruby_gems_fetcher)\n\n @ruby_gems_fetcher = GemsBond::Fetchers::RubyGems.new(name).tap(&:start)\n end",
"def find_gem(name, version)\n spec = source_index.find_name(name, version).last\n unless spec and (spec.installation_path rescue nil)\n alert_error \"Could not find gem #{name} (#{version})\"\n raise Gem::GemNotFoundException, \"Could not find gem #{name}, (#{version})\"\n end\n\n return spec\n end",
"def latest_gemspec(rubygem)\n ::Gem.source_index.gems.values.select {|e| e.name == rubygem }.sort_by {|e| e.version }[-1]\n end",
"def latest\n client = XMLRPC::Client.new2(\"http://pypi.python.org/pypi\")\n client.http_header_extra = {\"Content-Type\" => \"text/xml\"}\n client.timeout = 10\n result = client.call(\"package_releases\", @resource[:name])\n result.first\n rescue Timeout::Error => detail\n raise Puppet::Error, \"Timeout while contacting pypi.python.org: #{detail}\";\n end",
"def latest\n client = XMLRPC::Client.new2(\"http://pypi.python.org/pypi\")\n client.http_header_extra = {\"Content-Type\" => \"text/xml\"}\n client.timeout = 10\n result = client.call(\"package_releases\", @resource[:name])\n result.first\n rescue Timeout::Error => detail\n raise Puppet::Error, \"Timeout while contacting pypi.python.org: #{detail}\";\n end",
"def latest_version(gem_name, pre: false)\n return versions(gem_name).first if pre\n versions(gem_name).find { |version| !version.prerelease? }\n end",
"def get_gem gem_instance_id\n check_validity\n response = api_get gem_instance_id\n if response != nil and response.key?\"gem\"\n return gem_to_note response[\"gem\"]\n else\n return nil\n end\n end",
"def downloaded_gem_path(name, version)\n # ensure gem is downloaded\n download_gem name, version\n GemCache.path_for(name, version)\n end",
"def load_gem(name, version=nil)\n # needed if your ruby version is less than 1.9\n require 'rubygems'\n\n begin\n gem name, version\n rescue LoadError\n version = \"--version '#{version}'\" unless version.nil?\n system(\"gem install #{name} #{version}\")\n Gem.clear_paths\n retry\n end\n\n require name\nend",
"def load_gem(name, version=nil)\n # needed if your ruby version is less than 1.9\n require 'rubygems'\n\n begin\n gem name, version\n rescue LoadError\n version = \"--version '#{version}'\" unless version.nil?\n system(\"gem install #{name} #{version}\")\n Gem.clear_paths\n retry\n end\n\n require name\nend",
"def load_gem(name, version=nil)\n # needed if your ruby version is less than 1.9\n require 'rubygems'\n\n begin\n gem name, version\n rescue LoadError\n version = \"--version '#{version}'\" unless version.nil?\n system(\"gem install #{name} #{version}\")\n Gem.clear_paths\n retry\n end\n\n require name\nend",
"def download_prog(repo_hash)\n if (repo_hash[:source] == \"github\")\n clone_repo(repo_hash)\n elsif (repo_hash[:source] == \"rubygems\")\n puts \"Unpacking gem #{repo_hash[:name]}...\"\n system \"gem unpack #{repo_hash[:name]} --version #{repo_hash[:version]}\"\n else\n raise \"Unexpected source of repo #{repo_hash[:name]}: #{repo_hash[:source]}\"\n end\nend",
"def remote_version\n rubygem_api = JSON.parse open(\"https://rubygems.org/api/v1/versions/osa.json\").read\n rubygem_api.first[\"number\"]\n rescue Exception => e\n puts \"[!] \".yellow + \" Couldn't check the latest version, please check internet connectivity.\"\n exit!\n end",
"def fetch_specification(name, version)\n url = host + \"/quick/#{Configuration.marshal_identifier}\" \\\n \"/#{name}-#{version}.gemspec.rz\"\n\n http_get(url).body\n end",
"def gem_path\n @path || downloaded_gem_path\n end",
"def latest_pre_version(pe_family)\n open(\"http://getpe.delivery.puppetlabs.net/latest/#{pe_family}\").read\nend",
"def downloaded_gem_path\n self.class.downloaded_gem_path @name, @version\n end",
"def gem(gemname)\n if Gem.loaded_specs[gemname]\n require gemname.gsub(/-/, '/')\n path = \"#{Gem.loaded_specs[gemname].lib_dirs_glob.split(':')[0]}/\" \\\n \"#{gemname.gsub(/-/, '/')}/plugin.rb\"\n if File.exist? path\n pl = pluginr(path)\n raise ProtonBot::PluginError, \"`#{path}` did not return plugin!\" unless\n pl.instance_of? ProtonBot::Plugin\n @parr << pl\n else\n raise IOError, \"No such file or directory: #{path}\"\n end\n else\n raise ArgumentError, \"No such gem: #{gemname}\"\n end\n self\n end",
"def gem\n if dependency\n GemsBond::Gem.new(dependency)\n else\n unknown_dependency = Bundler::Dependency.new(@name, nil)\n GemsBond::Gem.new(unknown_dependency, unknown: true)\n end\n end",
"def get_version(gem)\n lockfile_specs.find { |s| s.name == gem }&.version\n end",
"def gem(name, version = Gem::Requirement.default)\n @gems ||= {}\n @gems[name] = version\n end",
"def plugin_gem(name, options = {})\n lib, version = options.values_at(:lib, :version)\n begin\n Kernel.send :gem, name, version\n rescue Gem::LoadError\n dir = File.dirname(caller.first.split(':').first)\n $: << File.expand_path(\"#{dir}/../vendor/gems/#{name}-#{version.gsub(/[^\\d\\.]*/, '')}/lib\")\n end\n require(lib || name)\n end",
"def gem_path\n @path || downloaded_gem_path\n end",
"def download(path)\n Gem.ensure_gem_subdirectories path\n\n if @spec.respond_to? :sources\n exception = nil\n path = @spec.sources.find do |source|\n begin\n source.download full_spec, path\n rescue exception\n end\n end\n return path if path\n raise exception if exception\n\n elsif @spec.respond_to? :source\n source = @spec.source\n source.download full_spec, path\n\n else\n source = Gem.sources.first\n source.download full_spec, path\n end\n end",
"def find_latest_gem(gem_name)\n the_gem = Dir.glob(\"#{Gem.dir}/gems/#{gem_name}-*\")\n\n the_gem.empty? ? nil : the_gem.sort.last\n end",
"def downloaded_gem_path\n self.class.downloaded_gem_path @name, @version\n end",
"def main\n last_good_root = from_file($cache_dir + '/root.txt') ||\n from_file('config/root.txt') ||\n raise(\"Can't find root.txt\")\n\n repository = Gem::TUF::Repository.new(\n root: JSON.parse(last_good_root),\n bucket: FileCachingBucket.new(HttpBucket.new($host))\n )\n\n gem_name = ARGV.shift\n\n specs = repository.target('latest_specs.4.8.gz')\n raise \"could not find latest_specs.4.8.gz\" unless specs\n specs = unmarshal_gz specs\n gem = specs.detect {|x| x[0] == gem_name } || raise(\"Can't find gem #{gem}\")\n\n gem_with_version = \"#{gem[0]}-#{gem[1]}\"\n gem_path = \"gems/#{gem_with_version}.gem\"\n gemspec_path = \"quick/Marshal.4.8/#{gem_with_version}.gemspec.rz\"\n\n repository.target(gemspec_path)\n repository.target(gem_path)\n\n puts \"Downloaded #{gem_path} and #{gemspec_path}\"\nend",
"def download name\n @checked += 1\n gem_name = \"#{name}.gem\"\n\n if gem_exists? gem_name then\n @gem_queue.push name\n\n info \"#{gem_name} exists\"\n\n return\n end\n\n uri = @base_uri + \"#{name}.gem\"\n\n source_etag = nil\n dest_etag = nil\n\n @http.request uri do |source_res|\n break unless etag = source_res['ETag']\n source_etag = etag.delete '\"'\n\n dest_etag = @swift.write_object @gems_container, gem_name do |io|\n source_res.read_body do |chunk|\n io.write chunk\n end\n end\n end\n\n if dest_etag == source_etag then\n @gem_queue.push name\n\n info \"#{gem_name} downloaded\"\n\n @downloaded += 1\n else\n @gem_name_queue.push name\n @swift.delete_object @gems_container, gem_name\n\n info \"#{gem_name} download failed\"\n @failed += 1\n end\n end",
"def version(gem)\n Dir.chdir(@path)\n lockfile = Bundler::LockfileParser.new(\n Bundler.read_file('Gemfile.lock')\n )\n\n lockfile.specs.each do |s|\n if s.name == gem\n return s.version\n end\n end\n raise \"Gem #{gem} not found in #{@path}\"\n end",
"def puppet_gem_version\n Gem::Version.create(puppet_version.split(' ').first.strip.gsub('-', '.'))\n end",
"def gem_version\n ::Gem::Version.new(VERSION::STRING)\n end",
"def latest_version_of(name)\n remote_versions_for(name).collect { |v| ::Gem::Version.new v }.max.to_s\n end",
"def source\n @source ||= Gem::Source::Installed.new\n end",
"def find_gem_to_install(gem_name, version_requirement, caches)\n specs_n_sources = []\n\n caches.each do |source, cache|\n cache.each do |name, spec|\n if /^#{gem_name}$/i === spec.name &&\n version_requirement.satisfied_by?(spec.version) then\n specs_n_sources << [spec, source]\n end\n end\n end\n\n if specs_n_sources.empty? then\n raise GemNotFoundException.new(\"Could not find #{gem_name} (#{version_requirement}) in the repository\")\n end\n\n specs_n_sources = specs_n_sources.sort_by { |gs,| gs.version }.reverse\n\n non_binary_gems = specs_n_sources.reject { |item|\n item[0].platform.nil? || item[0].platform==Platform::RUBY\n }\n\n # only non-binary gems...return latest\n return specs_n_sources.first if non_binary_gems.empty?\n\n list = specs_n_sources.collect { |item|\n\t\"#{item[0].name} #{item[0].version} (#{item[0].platform.to_s})\"\n }\n\n list << \"Cancel installation\"\n\n string, index = choose_from_list(\n\t\"Select which gem to install for your platform (#{RUBY_PLATFORM})\",\n\tlist)\n\n if index == (list.size - 1) then\n raise RemoteInstallationCancelled, \"Installation of #{gem_name} cancelled.\"\n end\n\n specs_n_sources[index]\n end",
"def set_ruby_gem\n @ruby_gem = RubyGem.find(params[:id])\n end",
"def build_gem; end",
"def load_spec(name, version, platform, source) # :nodoc:\n dep = Gem::Dependency.new name, version\n\n found = @specs.find do |spec|\n dep.matches_spec? spec and spec.platform == platform\n end\n\n tuple = Gem::NameTuple.new found.name, found.version, found.platform\n\n found.source.fetch_spec tuple\n end",
"def opal_gem(gem_name)\n Opal.use_gem(gem_name)\n Opal.paths.uniq!\n # require(gem_name)\n end",
"def latest\n # Refresh package metadata before looking for latest versions\n pkg(:refresh)\n\n lines = pkg(:list, \"-Hvn\", @resource[:name]).split(\"\\n\")\n\n # remove certificate expiration warnings from the output, but report them\n cert_warnings = lines.select { |line| line =~ /^Certificate/ }\n unless cert_warnings.empty?\n Puppet.warning(_(\"pkg warning: %{warnings}\") % { warnings: cert_warnings.join(', ') })\n end\n\n lst = lines.select { |line| line !~ /^Certificate/ }.map { |line| self.class.parse_line(line) }\n\n # Now we know there is a newer version. But is that installable? (i.e are there any constraints?)\n # return the first known we find. The only way that is currently available is to do a dry run of\n # pkg update and see if could get installed (`pkg update -n res`).\n known = lst.find { |p| p[:status] == 'known' }\n if known\n options = ['-n']\n options.concat(join_options(@resource[:install_options])) if @resource[:install_options]\n return known[:ensure] if exec_cmd(command(:pkg), 'update', *options, @resource[:name])[:exit].zero?\n end\n\n # If not, then return the installed, else nil\n (lst.find {|p| p[:status] == 'installed' } || {})[:ensure]\n end",
"def build_gem\n Juwelier::Commands::BuildGem.build_for(self).run\n end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def private_gem(name)\n gem name, '0.3.0', git: \"https://#{ENV['GITHUB_TOKEN']}:x-oauth-basic@github.com/mharris717/#{name}.git\", branch: :master\nend",
"def gem_spec\n if @gem_spec.nil?\n unless @gem_spec = Micro::Source.gem_spec(@name, @version_requirements.version)\n raise Micro::GemSpecMissingError, \"Unable to locate Gem::Specification for Gem::Dependency `#{self}'\"\n end\n end\n \n @gem_spec\n end",
"def installed_by_version # :nodoc:\n @installed_by_version ||= Gem::Version.new(0)\n end",
"def get_latest_stable_version_details(http_response)\n versions = stable_gem_versions(http_response)\n sorted_versions = sorted_versions(versions)\n last_version_number = last_version(sorted_versions)\n find_version(versions, last_version_number)\nend",
"def gem_spec(name, version)\n if spec = spec(name, version)\n BareSpecification.new(self, name, spec[1]).gem_spec\n end\n end",
"def try_local(gem_name)\n if ENV['USE_LOCAL_GEMS']\n gem gem_name, path: \"../#{gem_name}\"\n else\n gem gem_name, github: \"omniscrapper/#{gem_name}\"\n end\nend",
"def for_gem\n called_from = caller_locations(1, 1).first.path\n Registry.loader_for_gem(called_from)\n end",
"def remote_versions_for(name)\n require 'json'\n\n client.url = \"https://rubygems.org/api/v1/versions/#{name}.json\"\n client.follow_location = true\n client.http_get\n json = JSON.parse(client.body_str)\n json.collect { |version| version['number'] }\n end",
"def fetch_spec(name_tuple)\n fetcher = Gem::RemoteFetcher.fetcher\n\n spec_file_name = name_tuple.spec_name\n\n source_uri = enforce_trailing_slash(uri) + \"#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}\"\n\n cache_dir = cache_dir source_uri\n\n local_spec = File.join cache_dir, spec_file_name\n\n if File.exist? local_spec\n spec = Gem.read_binary local_spec\n spec = Marshal.load(spec) rescue nil\n return spec if spec\n end\n\n source_uri.path << '.rz'\n\n spec = fetcher.fetch_path source_uri\n spec = Gem::Util.inflate spec\n\n if update_cache?\n require \"fileutils\"\n FileUtils.mkdir_p cache_dir\n\n File.open local_spec, 'wb' do |io|\n io.write spec\n end\n end\n\n # TODO: Investigate setting Gem::Specification#loaded_from to a URI\n Marshal.load spec\n end",
"def patched\n vendored.collect do |dep|\n # TODO: right now just handling git based alternate sources,\n # should be able to handle other types bundler supports\n # (path and alternate rubygems src)\n next unless dep.source.is_a?(Bundler::Source::Git)\n src = dep.source\n\n # retrieve gem\n gem = if src.version\n Polisher::Gem.new(:name => dep.name, :version => src.version)\n else\n Polisher::Gem.retrieve(dep.name)\n end\n\n # retrieve dep\n git = Polisher::Git::Repo.new :url => src.uri\n git.clone unless git.cloned?\n git.checkout src.ref if src.ref\n\n # diff gem against git\n gem.diff(git.path)\n end.compact!\n end",
"def gem_version(version)\n Gem::Version.create(version)\n end",
"def gem_version\n Gem::Version.new VERSION\n end",
"def gem(name, options={})\n puts \"vendoring gem #{name}\"\n if options[:git]\n in_root(\"vendor/gems\") do\n Git.clone(options[:git], options[:branch])\n end\n elsif options[:svn]\n in_root(\"vendor/gems\") do\n Svn.checkout(options[:svn], options[:branch])\n end\n else \n # TODO: Gem dependencies. Split output on \\n, iterate lines looking for Downloaded...\n in_root(\"vendor/gems\") do\n # Filename may be different than gem name\n filename = (`gem fetch #{name}`).chomp.gsub(/Downloaded /, '')\n\n `gem unpack #{filename}.gem`\n File.delete(\"#{filename}.gem\")\n end\n end\n end",
"def source # :nodoc:\n Gem::Source::Installed.new\n end",
"def latest_version(module_name)\n versions(module_name).last\n end",
"def to_ruby\n%{Gem::Specification.new do |s|\n s.name = \"#{@gem_spec.name}\"\n s.version = \"#{@gem_spec.version}\"\n\n s.specification_version = #{ ivar_get(:specification_version) || 2 } if s.respond_to? :specification_version=\n s.required_rubygems_version = Gem::Requirement.new(\"#{ivar_get(:required_rubygems_version) || '>= 0'}\") if s.respond_to? :required_rubygems_version=\n\n#{gem_spec_variables.map { |k,v| \" s.#{k} = #{v.inspect}\" }.join(\"\\n\") }\n\n#{@gem_spec.dependencies.map { |dep| \" s.add_dependency(\\\"#{dep.name}\\\", [\\\"#{dep.version_requirements.to_s}\\\"])\" }.join(\"\\n\") }\nend}\n end",
"def local_or_remote_gem(name, options = Hash.new)\n local_path = File.expand_path(\"../vendor/#{name}\", __FILE__)\n if File.exist?(local_path)\n gem name, options.merge(:path => local_path).delete_if { |key, _| [:git, :branch].include?(key) }\n else\n gem name, options\n end\nend",
"def core_fetch_dependency(package_name, vers, type, verbose)\n prerelease = false\n if vers == '>= 0-pre'\n prerelease = true\n vers = '>= 0'\n else\n prerelease = vers =~ /[a-zA-Z]/\n end\n\n dep = LibGems::Dependency.new(package_name, vers, type)\n cur_installed = LibGems.source_index.search(dep)\n\n begin\n installed = BPM::Remote.new.install(package_name, vers, prerelease)\n rescue LibGems::GemNotFoundException\n # If we have it locally but not remote, that's ok\n installed = []\n end\n\n cur_installed.each do |ci|\n installed.reject! { |i| ci.name == i.name && ci.version == i.version }\n end\n\n installed.each do |i|\n say \"~ Fetched #{i.name} (#{i.version}) from remote\"\n end\n\n end",
"def load_gemfile(path)\n gf = GemFile.new(self, path)\n gf.load\n end",
"def local_gem(*args)\n load_local_gem(args[0]) || gem(*args)\n end",
"def version_from_gem_lock_file\n shell_return = run_shell(\"grep -A 1 RUBY Gemfile.lock\")\n shell_return.nil? ? nil : shell_return.stdout.split(\"\\n\")[1].strip.split(\" \")[1]\n end",
"def latest_matching(dep)\n version = latest_version_matching(dep)\n raise RuntimeError, \"no version found\" if version.nil?\n retrieve dep.name, version\n end",
"def initialize dep_uri = 'https://rubygems.org/api/v1/dependencies'\n super()\n\n dep_uri = URI dep_uri unless URI === dep_uri # for ruby 1.8\n\n @dep_uri = dep_uri\n @uri = dep_uri + '../..'\n\n @data = Hash.new { |h,k| h[k] = [] }\n @source = Gem::Source.new @uri\n end",
"def versions name\n if @data.key?(name)\n return @data[name]\n end\n\n uri = @dep_uri + \"?gems=#{name}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n Marshal.load(str).each do |ver|\n @data[ver[:name]] << ver\n end\n\n @data[name]\n end",
"def specification\n Gem::Specification.find_by_name(name, requirement)\n rescue Gem::LoadError\n nil\n end",
"def requirement\n Gem::Requirement.new('~>' + pharos_version.segments.first(2).join('.') + (pharos_version.prerelease? ? '.0-a' : '.0'))\n end",
"def gemspec\n @gemspec ||= (\n require 'rubygems'\n ::Gem::Specification.load(gemspec_file)\n )\n end",
"def require!\n super do\n gem @gem_name, @version if @version\n end\n end",
"def get_version!(version)\n version.gsub!('_', '.')\n\n if version == 'latest'\n latest_extension_version\n else\n extension_versions.find_by!(version: version)\n end\n end",
"def package_repository(package_name, desired_version, arch = nil)\n package(package_name, arch, true, false) do |pkg|\n return pkg.repoid if desired_version == pkg.version.to_s\n end\n\n nil\n end",
"def spec name, version, &block\n Gem::Specification.new name, v(version), &block\n end",
"def spec\n @spec ||= Gem::Specification.find do |spec|\n spec.name == @name and spec.version == @version\n end\n\n @spec ||= Gem::Specification.new do |s|\n s.name = @name\n s.version = @version\n s.platform = @platform\n\n s.dependencies.concat @dependencies\n end\n end",
"def path; Gem.ruby; end",
"def install_gem; end",
"def resolve( name, version )\n # It is possible, and almost inevitable, that we can install two packages that must oscilate\n # at the same time. As a result, we will be relinking a package that has not been installed yet,\n # but will be on the next commit. In this situation, we need keep a cache of packages mapped in\n # this session, so that when this occurs, we can resolve it with no problems. In this way, we\n # maintain an instance variable hash that is added to whenever map() is called\n cached = @pkg_cache[ \"%s-%s\" % [ name, version ] ]\n if( cached != nil )\n return cached\n end\n\n # Past this, we do not want to proceed if the package is not present in the install\n # dir\n\n # We ensure that this package is in fact installed\n if( !File.directory?( Config.instance.install_dir + \"/\" + name + \"/\" + version ) )\n puts \"%s-%s is not installed!\" % [ name, version ]\n return nil\n end\n\n # If the cache file exists and is in fact a file, slurp it up and use that\n # I'd love to do some digest check here to:\n # 1. Ensure that the cache file is intact and valid\n # 2. The directory installed matches the one that this cache file was generated from\n\n # First, we check the cache to see if we've resolved this package before\n # Figure out where the cache file would be if it existed\n cache_file = Config.instance.cache_dir + \"/\" + name + \"-\" + version + \".json\"\n if( File.file?( cache_file ) )\n file = File.new( cache_file, \"r\" )\n buff = \"\"\n while (line = file.gets)\n buff += line\n end\n file.close( )\n pkg = JSON.parse( buff )\n return pkg\n end\n\n # If we haven't, we'll need to do a full trace of the package\n\n # It may be better to store all of our package file in\n # $(install_dir)/$(name)/$(version)/pkg_files\n # and store the manifest next to pkg_files\n # Therefore, when we need to do this, we can just consult the manifest for\n # data such as dependencies\n pkg = map( Config.instance.install_dir + \"/\" + name + \"/\" + version )\n file = File.new( cache_file, \"w\" )\n\n # Write metadata\n file.write( pkg.to_json( ) )\n\n file.close( )\n\n return pkg\n end",
"def to_spec\n @spec ||= if @data\n loaded = Gem.loaded_specs[name]\n loaded if loaded && loaded.version == version\n end\n\n @spec ||= Gem::Specification.load(loaded_from)\n end",
"def get_latest_release(project, bin)\n api_url = \"https://api.github.com/repos/#{project}/releases/latest\"\n data = URI.parse(api_url).read\n obj = JSON.parse(data)\n version = obj[\"name\"]\n sha_url = \"https://github.com/#{project}/releases/download/#{version}/#{bin}.sha256\"\n sha = URI.parse(sha_url).read\n url = \"https://github.com/#{project}/releases/download/#{version}/#{bin}\"\n sha256 = sha.split(\" \").first\n\n return url, sha256, version\nend",
"def gem_spec\n require 'rubygems/specification'\n spec_fields = %w(\n name author email has_rdoc rubyforge_project summary\n version description required_ruby_version homepage\n )\n Gem::Specification.new do | spec |\n for field in spec_fields\n value = self.send( field )\n spec.send( \"#{field}=\", value )\n end\n \n spec.files = package.files.to_a + %w( Rakefile Manifest.txt )\n spec.test_files = unit_tests.to_a + functional_tests.to_a\n \n spec.executables.push( *executables )\n spec.requirements.push( *requirements )\n end\n end",
"def get_latest_stable_version_details(http_response)\n versions = stable_gem_versions(http_response)\n sorted_versions = sorted_versions(versions)\n last_version_number = last_version(sorted_versions)\n find_version(versions, last_version_number)\n end",
"def initialize(gem_path)\n @gem_path = gem_path\n end",
"def required_rubygems_version\n spec.required_rubygems_version\n end",
"def resource(gem_name, path)\n if not loaded? gem_name\n raise PluginNotLoaded.new(\"Plugin #{gem_name} not loaded when getting resource #{path}\")\n end\n\n file = File.join(@gems[gem_name], \"resources\", path)\n\n if File.exist? file\n return file\n else\n return nil\n end\n end",
"def get_latest_version(opts)\n raise NotImplementedError\n end",
"def to_gemspec(options={})\n require_rubygems\n\n if metadata.resources\n homepage = metadata.resources.homepage\n else\n homepage = nil\n end\n\n if homepage && md = /(\\w+).rubyforge.org/.match(homepage)\n rubyforge_project = md[1]\n else\n # b/c it has to be something according to Eric Hodel.\n rubyforge_project = metadata.name.to_s\n end\n\n #TODO: may be able to get this from project method\n if news = Dir[root + 'NEWS{,.txt}'].first\n install_message = File.read(news)\n end\n\n ::Gem::Specification.new do |spec|\n spec.name = self.name.to_s\n spec.version = self.version.to_s\n spec.require_paths = self.loadpath.to_a\n\n spec.summary = metadata.summary.to_s\n spec.description = metadata.description.to_s\n spec.authors = metadata.authors.to_a\n spec.email = metadata.email.to_s\n spec.licenses = metadata.licenses.to_a\n\n spec.homepage = metadata.homepage.to_s\n\n # -- platform --\n\n # TODO: how to handle multiple platforms?\n spec.platform = options[:platform] #|| verfile.platform #'ruby' ???\n #if metadata.platform != 'ruby'\n # spec.require_paths.concat(spec.require_paths.collect{ |d| File.join(d, platform) })\n #end\n\n # -- rubyforge project --\n\n spec.rubyforge_project = rubyforge_project\n\n # -- compiled extensions --\n\n spec.extensions = options[:extensions] || self.extensions\n\n # -- dependencies --\n\n case options[:gemfile]\n #when String\n # gemfile = root.glob(options[:gemfile]).first # TODO: Alternate gemfile\n when nil, true\n gemfile = root.glob('Gemfile').first\n else\n gemfile = nil\n end\n\n if gemfile\n require 'bundler'\n spec.add_bundler_dependencies\n else\n metadata.requirements.each do |dep|\n if dep.development?\n spec.add_development_dependency( *[dep.name, dep.constraint].compact )\n else\n next if dep.optional?\n spec.add_runtime_dependency( *[dep.name, dep.constraint].compact )\n end\n end\n end\n\n # TODO: considerations?\n #spec.requirements = options[:requirements] || package.consider\n\n # -- executables --\n\n # TODO: bin/ is a POM convention, is there are reason to do otherwise?\n spec.bindir = options[:bindir] || \"bin\"\n spec.executables = options[:executables] || self.executables\n\n # -- rdocs (argh!) --\n\n readme = root.glob_relative('README{,.*}', File::FNM_CASEFOLD).first\n extra = options[:extra_rdoc_files] || []\n\n rdocfiles = []\n rdocfiles << readme.to_s if readme\n rdocfiles.concat(extra)\n rdocfiles.uniq!\n\n rdoc_options = [] #['--inline-source']\n rdoc_options.concat [\"--title\", \"#{metadata.title} API\"] #if metadata.title\n rdoc_options.concat [\"--main\", readme.to_s] if readme\n\n spec.extra_rdoc_files = rdocfiles\n spec.rdoc_options = rdoc_options\n\n # -- distributed files --\n\n if manifest.exist?\n filelist = manifest.select{ |f| File.file?(f) }\n spec.files = filelist\n else\n spec.files = root.glob_relative(\"**/*\").map{ |f| f.to_s } # metadata.distribute ?\n end\n\n # DEPRECATED: -- test files --\n #spec.test_files = manifest.select do |f|\n # File.basename(f) =~ /test\\// && File.extname(f) == '.rb'\n #end\n\n if install_message\n spec.post_install_message = install_message\n end\n end\n\n end"
] |
[
"0.7318445",
"0.7236806",
"0.7141415",
"0.7096529",
"0.6908627",
"0.6807149",
"0.67806834",
"0.6585169",
"0.6513129",
"0.6316885",
"0.62922263",
"0.62437034",
"0.6154554",
"0.609442",
"0.609442",
"0.60709417",
"0.6057071",
"0.6012145",
"0.60067034",
"0.60067034",
"0.60067034",
"0.5995443",
"0.5979305",
"0.59755147",
"0.5964921",
"0.59605145",
"0.59578544",
"0.592278",
"0.59193176",
"0.5914476",
"0.5869811",
"0.58626246",
"0.585473",
"0.58489865",
"0.5846231",
"0.58373",
"0.5818519",
"0.5785767",
"0.57395864",
"0.57272226",
"0.56378233",
"0.5621631",
"0.5604792",
"0.5549145",
"0.55341864",
"0.55192375",
"0.5508891",
"0.55065453",
"0.55064523",
"0.5504761",
"0.54961294",
"0.54961294",
"0.54961294",
"0.54961294",
"0.54961294",
"0.54961294",
"0.5493015",
"0.54907924",
"0.5486263",
"0.54768723",
"0.5475868",
"0.5464014",
"0.5448963",
"0.54467106",
"0.543861",
"0.5437548",
"0.54237175",
"0.5423177",
"0.54211247",
"0.54193527",
"0.5417565",
"0.5414041",
"0.5395654",
"0.5391568",
"0.53869736",
"0.53860337",
"0.5384274",
"0.5384128",
"0.5380767",
"0.53763974",
"0.53722566",
"0.5357013",
"0.53525275",
"0.5350883",
"0.53360677",
"0.5326427",
"0.5321926",
"0.5314426",
"0.53004324",
"0.5296328",
"0.52941537",
"0.52914345",
"0.52869993",
"0.5282245",
"0.52812934",
"0.5278898",
"0.52754235",
"0.5274993",
"0.52710915",
"0.52686834"
] |
0.6783137
|
6
|
Returns path to downloaded gem
|
def downloaded_gem_path(name, version)
# ensure gem is downloaded
download_gem name, version
GemCache.path_for(name, version)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def gem_path\n @path || downloaded_gem_path\n end",
"def downloaded_gem_path\n self.class.downloaded_gem_path @name, @version\n end",
"def gem_path\n @path || downloaded_gem_path\n end",
"def downloaded_gem_path\n self.class.downloaded_gem_path @name, @version\n end",
"def package_path(extension='.gem')\n File.join(package_dir, package_basename(extension))\n end",
"def downloaded_path\n @downloaded_path ||= File.join(install_path, file_name(url))\n return @downloaded_path\n end",
"def download_gem\n self.class.download_gem @name, @version\n end",
"def download_gem\n self.class.download_gem @name, @version\n end",
"def gem_path\n File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))\n end",
"def full_gem_path\n # TODO: This is a heavily used method by gems, so we'll need\n # to aleast just alias it to #gem_dir rather than remove it.\n @full_gem_path ||= find_full_gem_path\n end",
"def full_gem_path\n # TODO: This is a heavily used method by gems, so we'll need\n # to aleast just alias it to #gem_dir rather than remove it.\n @full_gem_path ||= find_full_gem_path\n end",
"def gem_path\n `gem environment gemdir`.chomp\nend",
"def gem_build_complete_path # :nodoc:\n File.join extension_dir, 'gem.build_complete'\n end",
"def download(path)\n Gem.ensure_gem_subdirectories path\n\n if @spec.respond_to? :sources\n exception = nil\n path = @spec.sources.find do |source|\n begin\n source.download full_spec, path\n rescue exception\n end\n end\n return path if path\n raise exception if exception\n\n elsif @spec.respond_to? :source\n source = @spec.source\n source.download full_spec, path\n\n else\n source = Gem.sources.first\n source.download full_spec, path\n end\n end",
"def gem_dir\n directory = File.join(File.dirname(__FILE__), \"..\")\n File.expand_path(directory, File.dirname(__FILE__))\n end",
"def local_path\n fetch_path(DevTools.gem_root)\n end",
"def gem_dir\n if File.directory?(dir = File.join(working_dir, 'gems'))\n dir\n end\n end",
"def gem_dir\n if File.directory?(dir = File.join(working_dir, 'gems'))\n dir\n end\n end",
"def gem_dir\n return force_gem_dir if force_gem_dir\n if File.directory?(dir = default_gem_dir)\n dir\n end\n end",
"def gemfile_path\n @gemfile_path ||= GEMFILES.map { |g| @config.pwd.join g }\n .find { |f| f.exist? }\n end",
"def gemspec_path\n Pathname.glob('*.gemspec').first\n end",
"def gem_dir\n @gem_dir ||= File.expand_path File.join(gems_dir, full_name)\n end",
"def get_path(gemname, version_req)\n return gemname if gemname =~ /\\.gem$/i\n specs = SourceIndex.from_installed_gems.search(gemname, version_req)\n selected = specs.sort_by { |s| s.version }.last\n return nil if selected.nil?\n # We expect to find (basename).gem in the 'cache' directory.\n # Furthermore, the name match must be exact (ignoring case).\n if gemname =~ /^#{selected.name}$/i\n filename = selected.full_name + '.gem'\n return File.join(Gem.dir, 'cache', filename)\n else\n return nil\n end\n end",
"def get_path_to_rails_gem\n path = ''\n rails_gem_contents = `gem contents rails -v #{get_rails_version_from_project}`\n rails_gem_contents.each_line do |contents|\n path_elements = contents.split(File::SEPARATOR)\n path_elements.pop\n path = path_elements.join(File::SEPARATOR)\n break\n end\n path\n end",
"def gem_install_dir\n if gems_use_tool_repo && tool_repo_install_dir && !user_install_enable\n path = eval_path(tool_repo_install_dir)\n else\n path = eval_path(find_val('user_gem_dir') || find_val('gem_install_dir') || home_dir)\n end\n\n append = find_val('append_gems')\n append = 'gems' if append == true || append.nil?\n\n if append\n unless path.end_with?(append)\n path = File.join(path, append)\n end\n end\n path\n end",
"def pkg_path\n \"pkg/#{spec.full_name}\"\n end",
"def package_dir_path\n \"#{package_dir}/#{package_name}\"\n end",
"def absolute_gem_binary\n ::File.expand_path(gem_binary, path)\n end",
"def path; Gem.ruby; end",
"def elm_package_path(package)\n File.join(@git_resolver.repository_path(package), 'elm-package.json')\n end",
"def gemfile_path\n @gemfile_path ||= begin\n path = ::File.expand_path(new_resource.path)\n if ::File.file?(path)\n # We got a path to a real file, use that.\n path\n else\n # Walk back until path==dirname(path) meaning we are at the root\n while path != (next_path = ::File.dirname(path))\n possible_path = ::File.join(path, 'Gemfile')\n return possible_path if ::File.file?(possible_path)\n path = next_path\n end\n end\n end\n end",
"def gem_dir(join=nil)\n if join\n File.join(gem_dir, join)\n else\n \"vendor/plugins/#{file_name}\"\n end\n end",
"def gem_dir\n return Dir.pwd unless Gem.loaded_specs.include? 'cts-mpx'\n\n Gem.loaded_specs['cts-mpx'].full_gem_path\n end",
"def install_path\n Berkshelf.cookbook_store.storage_path\n .join(\"#{dependency.name}-#{revision}\")\n end",
"def dmg_dir_path\n \"#{package_dir}/#{dmg_name}\"\n end",
"def get_pkg_location(cookbook)\n\n version = node.etcd.version\n base_url = get_mirror_svc('etcd')\n Chef::Log.info(\"Etcd base_url: #{base_url}\")\n\n # Replace any $version/$arch/$extn placeholder variables present in the URL\n # e.x: https://github.com/coreos/etcd/releases/download/v$version/etcd-v$version-$arch.$extn\n base_url = base_url.gsub('$version', version)\n .gsub('$arch', node.etcd.arch)\n .gsub('$extn', node.etcd.extn)\n exit_with_err(\"Invalid package base URL: #{base_url}\") unless url_valid?(base_url)\n\n file_name = File.basename(URI.parse(base_url).path)\n Chef::Log.info(\"Package url: #{base_url}, filename: #{file_name}\")\n return File.dirname(base_url), file_name\n\n end",
"def get_pkg_location(cookbook)\n\n version = node.etcd.version\n base_url = get_mirror_svc('etcd')\n Chef::Log.info(\"Etcd base_url: #{base_url}\")\n\n # Replace any $version/$arch/$extn placeholder variables present in the URL\n # e.x: https://github.com/coreos/etcd/releases/download/v$version/etcd-v$version-$arch.$extn\n base_url = base_url.gsub('$version', version)\n .gsub('$arch', node.etcd.arch)\n .gsub('$extn', node.etcd.extn)\n exit_with_err(\"Invalid package base URL: #{base_url}\") unless url_valid?(base_url)\n\n file_name = File.basename(URI.parse(base_url).path)\n Chef::Log.info(\"Package url: #{base_url}, filename: #{file_name}\")\n return File.dirname(base_url), file_name\n\n end",
"def generate_downloaded_file_path(extension)\n \"#{File.join(Dir.tmpdir, VAGRANT_PACKAGE)}.#{extension}\"\n end",
"def gem_root\n Pathname.new(__FILE__).dirname.parent.parent.expand_path\n end",
"def gem_dir\n return Dir.pwd unless Gem.loaded_specs.include? 'cts-mpx'\n Gem.loaded_specs['cts-mpx'].full_gem_path\n end",
"def download_path\n ::File.join(Chef::Config[:file_cache_path], ::File.basename(URL))\n end",
"def autoproj_gemfile_path; File.join(autoproj_install_dir, 'Gemfile') end",
"def release_path\n ::File.join(install_path, artifact_name, artifact_version)\n end",
"def download_path\n ::File.join(Chef::Config[:file_cache_path],\n ::File.basename(source_path))\n end",
"def tar_path\n File.expand_path(@env[\"package.output\"], FileUtils.pwd)\n end",
"def installer_path\n %x[which apt-get].chomp\n end",
"def gem_name\n @gem_name ||= @source_path.sub_ext(\"\").basename.to_s\n end",
"def gem_deps_file # :nodoc:\n File.basename @path\n end",
"def source_package_file\n pkg_file = nil\n pkg_dir = self.source_package_dir\n @source_urls.each do |url|\n poss_pkg_file = File.join(pkg_dir, File.basename(url[0]))\n if File::exists?(poss_pkg_file)\n pkg_file = poss_pkg_file\n break\n end\n end\n pkg_file\n end",
"def source_package_file\n pkg_file = nil\n pkg_dir = self.source_package_dir\n @source_urls.each do |url|\n poss_pkg_file = File.join(pkg_dir, File.basename(url[0]))\n if File::exists?(poss_pkg_file)\n pkg_file = poss_pkg_file\n break\n end\n end\n pkg_file\n end",
"def install_dir # :nodoc:\n File.join Gem.dir, 'bundler', 'gems', \"#{@name}-#{dir_shortref}\"\n end",
"def remote_path_for(package)\n File.join(path, package.trigger)\n end",
"def install_dir # :nodoc:\n return unless File.exist? repo_cache_dir\n\n File.join base_dir, 'gems', \"#{@name}-#{dir_shortref}\"\n end",
"def relative_path\n File.join(@repo, @bundle)\n end",
"def gempath_to_yaypath gem_path\n\t\t\treturn \"#{gem_path}/gems/yay-#{Yay::VERSION}/data/yay\"\n\t\tend",
"def path\n @backend.lib_dir + name_on_disk\n end",
"def relative_install_path\n a = artifact\n name = File.basename(a.to_s)\n a.respond_to?(:group) ? \"#{a.group.gsub('.', '/')}/#{name}\" : \"#{name}\"\n end",
"def target_path(target_name)\r\n File.join(package_dir, target_name)\r\n end",
"def remote_path_for(package)\n File.join(\n Config.artifactory_base_path,\n package.metadata[:name],\n package.metadata[:version],\n publish_platform(package),\n publish_platform_version(package),\n package.metadata[:basename],\n )\n end",
"def package_url\n \"https://github.com/arduino/arduino-cli/releases/download/#{@desired_version}/#{package_file}\"\n end",
"def package_dir\r\n \"${0%/#{target_name}}\"\r\n end",
"def bundle_dir\n File.expand_path(File.join(Bixby.repo_path, self.relative_path))\n end",
"def pack_path(name)\n path = WebpackerLite::Configuration.base_path\n file = WebpackerLite::Manifest.lookup(name)\n \"#{path}/#{file}\"\n end",
"def bundled_path\n File.dirname Wisp::Source.bundled_path\n end",
"def path_from_package(package_name)\n ret = package_from_name package_name\n ret && ret.root_path\n end",
"def pathDist\n\t\"../../\" + distPackageName + \"_\" + version + \"/\"\nend",
"def file_name\n \"#{full_name}.gem\"\n end",
"def package_scripts_path\n \"#{Config.project_root}/package-scripts/#{name}\"\n end",
"def remote_path\n pv = node['platform_version']\n file = if Gem::Version.new(pv) >= Gem::Version.new('10.9')\n 'X2GoClient_latest_macosx_10_9.dmg'\n else\n 'X2GoClient_latest_macosx.dmg'\n end\n \"http://code.x2go.org/releases/#{file}\"\n end",
"def manifest_path\n path = @config[\"manifest\"][\"path\"] if @config[\"manifest\"]\n return Licensed::Git.repository_root.join(path) if path\n\n @config.cache_path.join(\"manifest.json\")\n end",
"def gem_path?(file); end",
"def path_for(package)\n \"#{package.path}.metadata.json\"\n end",
"def gem_root\n @@root\n end",
"def manifest_path\n build_output_dir.join('manifest.json')\n end",
"def gem_uri\n @gem_uri ||=\n @rack_context.getInitParameter('gem.path') ||\n @rack_context.getInitParameter('gem.home') ||\n '/WEB-INF/gems'\n end",
"def gem_uri\n @gem_uri ||=\n @rack_context.getInitParameter('gem.path') ||\n @rack_context.getInitParameter('gem.home')\n end",
"def find_source_directory(gem_name, version=nil)\n if version == 'cwd'\n return Dir.pwd\n elsif version\n version_array = [\"= #{version}\"]\n else\n version_array = [\"> 0.0.0\"]\n end\n \n specs = Gem.source_index.find_name(gem_name,version_array)\n unless specs.to_a.size > 0\n raise InstallFailed, \"Can't locate version #{version}!\"\n end\n \n @install_version = specs.last.version\n message \"Installing #{app_name} #{@install_version}\"\n \n specs.last.full_gem_path\n end",
"def file_path path\n File.join(output_path, manifest.lookup(path).split('/')[2..-1])\n end",
"def find_requireable_file(file)\n root = full_gem_path\n\n require_paths.each do |lib|\n base = File.join(root, lib, file)\n Gem.suffixes.each do |suf|\n path = \"#{base}#{suf}\"\n return path if File.file? path\n end\n end\n\n return nil\n end",
"def repo_path\n @repo_path ||= \"/tmp/extension-repo-#{id}\"\n end",
"def cached_gemfile_md5_path\n File.join(tmp_path, 'git_copy_bundle_gemfile_lock.md5')\n end",
"def component_libpath(cmp)\n vars = component_cmake_vars cmp\n libdir = vars.fetch('INSTALL_LIB_DIR', 'lib')\n File.join component_install_path(cmp), libdir\nend",
"def install_dir(lib)\n if fr = ENV['FAKEROOT']\n return File.join(fr, lib)\n end\n\n lib\nend",
"def build\n\t@built_gem_path ||= @helper.build_gem\nend",
"def gemspec_file\n project_path( \"#{ name }.gemspec\" )\n end",
"def path_for(package)\n \"#{package.path}.metadata.json\"\n end",
"def tarball\n Dir[\"#{dest}/#{SCOPE}-#{gemspec.name}-#{gemspec.version}.tgz\"].first\n end",
"def pkg_dir\n @pkg_dir ||= File.join( self.build_dir, \"#{name + ( version ? \"-#{version}\" : \"\" ) }\" )\n end",
"def gemspec_path\n unless instance_variable_defined? :@gemspec\n path = \"#{name}.gemspec\"\n\n unless File.exist?(path)\n shell.say 'No gemspec found'\n exit 1\n end\n\n @gemspec_path = path\n end\n\n @gemspec_path\n end",
"def license_package_location(component_name, where)\n if local?(where)\n File.join(output_dir, \"#{component_name}-#{File.split(where).last}\")\n else\n u = URI(where)\n File.join(output_dir, \"#{component_name}-#{File.basename(u.path)}\")\n end\n end",
"def license_package_location(component_name, where)\n if local?(where)\n File.join(output_dir, \"#{component_name}-#{File.split(where).last}\")\n else\n u = URI(where)\n File.join(output_dir, \"#{component_name}-#{File.basename(u.path)}\")\n end\n end",
"def expanded_path\n relative_path(dependency.berksfile.filepath)\n end",
"def local_path\n src = if %i(direct repo).include?(new_resource.source)\n package_metadata[:url]\n else\n new_resource.source.to_s\n end\n ::File.join(Chef::Config[:file_cache_path], ::File.basename(src))\n end",
"def extension_dir\n @extension_dir ||= File.expand_path(File.join(extensions_dir, full_name)).tap(&Gem::UNTAINT)\n end",
"def default_path\n Gem.default_path + [@home]\n end",
"def workdir\n @workdir ||= ::File.join(::File.dirname(@repo_dir), 'download')\n end",
"def gems_dir\n raise NotImplementedError\n end",
"def lib_path; end",
"def lib_path; end",
"def lib_path; end"
] |
[
"0.8588547",
"0.8568333",
"0.8475193",
"0.8451593",
"0.75416505",
"0.75260943",
"0.720036",
"0.712495",
"0.7109253",
"0.70687413",
"0.70687413",
"0.69560844",
"0.69488424",
"0.6894721",
"0.68525195",
"0.6821006",
"0.6809589",
"0.6809589",
"0.67988205",
"0.67939615",
"0.66976726",
"0.6685616",
"0.6646119",
"0.6641917",
"0.66417426",
"0.6639141",
"0.6626593",
"0.66241753",
"0.65825325",
"0.6565728",
"0.65368867",
"0.6520047",
"0.6474179",
"0.6467107",
"0.6448717",
"0.6440592",
"0.6440592",
"0.6425705",
"0.6416916",
"0.6406903",
"0.64026475",
"0.6392134",
"0.6376137",
"0.6356914",
"0.63457155",
"0.6341547",
"0.63294256",
"0.63277185",
"0.63130176",
"0.63130176",
"0.6261509",
"0.62292683",
"0.6220044",
"0.62177575",
"0.62176305",
"0.61696506",
"0.6169552",
"0.61635965",
"0.61592287",
"0.6150842",
"0.6146218",
"0.6134761",
"0.6133737",
"0.608414",
"0.60631657",
"0.60601217",
"0.6058181",
"0.6056818",
"0.60488534",
"0.60457253",
"0.60216355",
"0.6020839",
"0.60128903",
"0.6012563",
"0.6003334",
"0.59994346",
"0.5976203",
"0.59744155",
"0.5973331",
"0.5971744",
"0.59566116",
"0.5952004",
"0.59508765",
"0.5946566",
"0.5944261",
"0.59336466",
"0.5916274",
"0.59073234",
"0.5904844",
"0.5903455",
"0.59009784",
"0.5896581",
"0.58963704",
"0.5878712",
"0.5877253",
"0.58694124",
"0.58671194",
"0.58565634",
"0.58565634",
"0.58565634"
] |
0.76494867
|
4
|
Retrieve latest gem metadata and contents from rubygems.org
|
def retrieve_latest(name)
client.url = "https://rubygems.org/api/v1/gems/#{name}.json"
client.http_get
spec = client.body_str
gem = parse spec
gem
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fetch_gem(name, version)\n http_get(host + \"/gems/#{name}-#{version}.gem\").body\n end",
"def gem_info(gem, client)\n gem_data = {}\n uri = (\n Gems.info(gem)['source_code_uri'] || Gems.info(gem)['homepage_uri']).sub!(%r{http.*com/}, '')\n repo = repository(uri, client)\n contributors_count = contributors(uri).css('span.num.text-emphasized').children[2].text.to_i\n used_by_count = dependents(uri).css('.btn-link')[1].text.delete('^0-9').to_i\n gem_data[gem.to_sym] = gem_properties(repo, contributors_count, used_by_count)\n end",
"def latest_gemspec(rubygem)\n ::Gem.source_index.gems.values.select {|e| e.name == rubygem }.sort_by {|e| e.version }[-1]\n end",
"def latest_version(name)\n return JSON.parse(open(\"http://rubygems.org/api/v1/gems/#{name}.json\").read)['version']\n end",
"def main\n last_good_root = from_file($cache_dir + '/root.txt') ||\n from_file('config/root.txt') ||\n raise(\"Can't find root.txt\")\n\n repository = Gem::TUF::Repository.new(\n root: JSON.parse(last_good_root),\n bucket: FileCachingBucket.new(HttpBucket.new($host))\n )\n\n gem_name = ARGV.shift\n\n specs = repository.target('latest_specs.4.8.gz')\n raise \"could not find latest_specs.4.8.gz\" unless specs\n specs = unmarshal_gz specs\n gem = specs.detect {|x| x[0] == gem_name } || raise(\"Can't find gem #{gem}\")\n\n gem_with_version = \"#{gem[0]}-#{gem[1]}\"\n gem_path = \"gems/#{gem_with_version}.gem\"\n gemspec_path = \"quick/Marshal.4.8/#{gem_with_version}.gemspec.rz\"\n\n repository.target(gemspec_path)\n repository.target(gem_path)\n\n puts \"Downloaded #{gem_path} and #{gemspec_path}\"\nend",
"def latest\n client = XMLRPC::Client.new2(\"http://pypi.python.org/pypi\")\n client.http_header_extra = {\"Content-Type\" => \"text/xml\"}\n client.timeout = 10\n result = client.call(\"package_releases\", @resource[:name])\n result.first\n rescue Timeout::Error => detail\n raise Puppet::Error, \"Timeout while contacting pypi.python.org: #{detail}\";\n end",
"def latest\n client = XMLRPC::Client.new2(\"http://pypi.python.org/pypi\")\n client.http_header_extra = {\"Content-Type\" => \"text/xml\"}\n client.timeout = 10\n result = client.call(\"package_releases\", @resource[:name])\n result.first\n rescue Timeout::Error => detail\n raise Puppet::Error, \"Timeout while contacting pypi.python.org: #{detail}\";\n end",
"def latest\n url = \"https://pypi.python.org/pypi/#{URI.encode(@resource[:name])}/json\"\n result = self.open_jsonurl(url)\n result['info']['version'] if result != nil\n rescue Timeout::Error => detail\n raise Puppet::Error, \"Error in contacting pypi.python.org: #{detail}\"\n end",
"def download_gem\n self.class.download_gem @name, @version\n end",
"def retrieve\n return if retrieved_at && retrieved_at.utc > DateTime.now.utc - 1.hour\n \n rubygems_info = Gems.info name\n new_attributes = {\n name: rubygems_info['name'], \n version: rubygems_info['version'], \n info: rubygems_info['info'],\n retrieved_at: DateTime.now\n }\n update_attributes(new_attributes, as: :internal)\n end",
"def fetch_gems_data\n puts \"Fetching data for...\"\n # slice 100 to avoid too many requests on RubyGems and GitHub APIs\n gems.each_slice(100) do |batch|\n each_concurrently(batch) do |gem|\n begin\n retries ||= 0\n # set verbose to true to stdout the gem name\n gem.prepare_data(verbose: true)\n # rescue SocketError, Faraday::ConnectionFailed...\n rescue StandardError\n (retries += 1) <= RETRIES ? retry : nil\n end\n end\n end\n end",
"def download_gem\n self.class.download_gem @name, @version\n end",
"def find_gems\n @gems = RubygemsApi.call :all\n end",
"def download_gem(name, version)\n cached = GemCache.get(name, version)\n return cached unless cached.nil?\n\n client.url = \"https://rubygems.org/gems/#{name}-#{version}.gem\"\n client.follow_location = true\n client.http_get\n gemf = client.body_str\n\n GemCache.set(name, version, gemf)\n gemf\n end",
"def memcached_gem_info\n @memcached_gem_info ||= Rails.cache.read_multi(*@gem_information.values)\n end",
"def find_latest_gem(gem_name)\n the_gem = Dir.glob(\"#{Gem.dir}/gems/#{gem_name}-*\")\n\n the_gem.empty? ? nil : the_gem.sort.last\n end",
"def parse_gemfile\n ParserUtil.gemfile(data[\"Gemfile\"])\n end",
"def get_latest_stable_version_details(http_response)\n versions = stable_gem_versions(http_response)\n sorted_versions = sorted_versions(versions)\n last_version_number = last_version(sorted_versions)\n find_version(versions, last_version_number)\nend",
"def installed_gems\n gems = []\n\n cmd = [attributes.gem_binary, 'list', '-l']\n cmd << '--prerelease' if attributes.prerelease\n\n run_command(cmd).stdout.each_line do |line|\n next unless /\\A([^ ]+) \\(([^\\)]+)\\)\\z/ =~ line.strip\n\n name = $1\n versions = $2.split(', ')\n gems << { name: name, versions: versions }\n end\n gems\n rescue Backend::CommandExecutionError\n []\n end",
"def get_gem_names\n fetcher = Gem::SpecFetcher.fetcher\n\n list, = fetcher.available_specs(:complete)\n\n tuples = list.values.first\n\n tuples.map do |tuple,|\n tuple = tuple.to_a\n case tuple.last\n when Gem::Platform::RUBY then\n tuple[0, 2]\n else\n tuple\n end.join '-'\n end\n end",
"def describe gem, source = { rubygems: true }\n if source[:rubygems]\n Gems.info(gem).fetch \"info\"\n else\n info = GemspecInfo.new gem, source\n info.summary\n end\n end",
"def show_gems name, prerelease\n req = Gem::Requirement.default\n # TODO: deprecate for real\n dep = Gem::Deprecate.skip_during { Gem::Dependency.new name, req }\n dep.prerelease = prerelease\n\n if local? then\n if prerelease and not both? then\n alert_warning \"prereleases are always shown locally\"\n end\n\n display_header 'LOCAL'\n\n specs = Gem::Specification.find_all { |s|\n s.name =~ name and req =~ s.version\n }\n\n spec_tuples = specs.map do |spec|\n [spec.name_tuple, spec]\n end\n\n output_query_results spec_tuples\n end\n\n if remote? then\n display_header 'REMOTE'\n\n fetcher = Gem::SpecFetcher.fetcher\n\n type = if options[:all]\n if options[:prerelease]\n :complete\n else\n :released\n end\n elsif options[:prerelease]\n :prerelease\n else\n :latest\n end\n\n if name.source.empty?\n spec_tuples = fetcher.detect(type) { true }\n else\n spec_tuples = fetcher.detect(type) do |name_tuple|\n name === name_tuple.name\n end\n end\n\n output_query_results spec_tuples\n end\n end",
"def download_and_extract_package\n @fetcher.get_package_file(@package_name, @version)\n Gem::Package::TarReader.new( Zlib::GzipReader.open @fetcher.temp_package_file_path ) do |tar|\n tar.each do |entry|\n next unless entry.file? and entry.full_name.match(\"DESCRIPTION\")\n @package_desc = entry.read\n end\n end\n FileUtils.rm_rf @fetcher.temp_package_file_path\n end",
"def get_repo_list\n Chef::Log.debug(\n \"Fetching all versions of #{new_resource.module_name} \" +\n \"from #{new_resource.repository}.\",\n )\n latest = powershell_out!(\n <<-EOH,\n $splat = @{\n Name = \"#{new_resource.module_name}\"\n Repository = \"#{new_resource.repository}\"\n AllVersions = $True\n }\n (Find-Module @splat).Version.ForEach({$_.ToString()})\n EOH\n ).stdout.to_s.chomp.split(\"\\r\\n\")\n Chef::Log.debug(\"Available versions: #{latest.join(', ')}\")\n\n return latest.map { |v| Gem::Version.new(v) }\n end",
"def retrieve_version(name, version)\n path = downloaded_gem_path name, version\n parse :gem => path\n end",
"def get_last_release_versions\n # determine last SIMP release\n last_release = nil\n last_puppetfile = nil\n debug('Determining last SIMP release')\n\n Dir.chdir(\"#{@options[:work_dir]}/simp-core\") do |dir|\n `git fetch -t origin 2>/dev/null`\n tags = `git tag -l`.split(\"\\n\")\n debug(\"Available simp-core tags = #{tags}\")\n last_release = (tags.sort { |a,b| Gem::Version.new(a) <=> Gem::Version.new(b) })[-1]\n `git checkout -q tags/#{last_release}`\n src = File.join(dir, 'Puppetfile.pinned')\n last_puppetfile = File.join(@options[:work_dir], \"Puppetfile.#{last_release}\")\n debug(\"Copying simp-core #{last_release} Puppetfile.pinned into #{last_puppetfile}\")\n FileUtils.cp(src, last_puppetfile)\n `git checkout -q master`\n end\n\n debug(\"Retrieving component versions for SIMP #{last_release} from #{last_puppetfile}\")\n @last_release_versions = {}\n helper = PuppetfileHelper.new(last_puppetfile, @options[:work_dir], false)\n helper.modules.each do |mod|\n @last_release_versions[mod[:name]] = mod[:desired_ref]\n end\n end",
"def remote_version\n rubygem_api = JSON.parse open(\"https://rubygems.org/api/v1/versions/osa.json\").read\n rubygem_api.first[\"number\"]\n rescue Exception => e\n puts \"[!] \".yellow + \" Couldn't check the latest version, please check internet connectivity.\"\n exit!\n end",
"def query_rubygems\n make_api_request(\"https://rubygems.org/api/v1/versions/alchemy_cms.json\")\n end",
"def name; @gem_data[\"name\"]; end",
"def ruby_gems_fetcher\n return @ruby_gems_fetcher if defined?(@ruby_gems_fetcher)\n\n @ruby_gems_fetcher = GemsBond::Fetchers::RubyGems.new(name).tap(&:start)\n end",
"def sources\n unless @sources\n\trequire_gem(\"sources\")\n\t@sources = Gem.sources\n end\n @sources\n end",
"def get_latest_stable_version_details(http_response)\n versions = stable_gem_versions(http_response)\n sorted_versions = sorted_versions(versions)\n last_version_number = last_version(sorted_versions)\n find_version(versions, last_version_number)\n end",
"def main\n # TODO: Check for expiry across all metadata files.\n\n last_good_root = from_file('root.txt') || get_metadata('root.txt')\n\n timestamp = get_metadata 'timestamp.txt'\n verify! timestamp, extract_keys(last_good_root, 'timestamp')\n\n release = get_hashed_metadata(\"release.txt\", timestamp['signed']['meta'])\n verify! release, extract_keys(last_good_root, 'release')\n\n # TODO: If our release hasn't changed from last known good, don't need to\n # refetch root.txt and targets.txt\n\n root = get_hashed_metadata(\"root.txt\", release['signed']['meta'])\n verify! root, extract_keys(last_good_root, \"root\")\n\n store_file 'root.txt', root\n last_good_root = root\n\n targets = get_hashed_metadata(\"targets.txt\", release['signed']['meta'])\n verify! targets, extract_keys(last_good_root, \"targets\")\n\n gem_name = ARGV[0]\n\n specs = unmarshal_gz(get_hashed_target(\"latest_specs.4.8.gz\", targets['signed']['targets']))\n\n gem = specs.detect {|x| x[0] == gem_name } || raise(\"Can't find gem #{gem}\")\n\n gem_with_version = \"#{gem[0]}-#{gem[1]}\"\n gem_path = \"gems/#{gem_with_version}.gem\"\n gemspec_path = \"quick/Marshal.4.8/#{gem_with_version}.gemspec.rz\"\n\n get_target(gemspec_path, targets['signed']['targets'])\n get_target(gem_path, targets['signed']['targets'])\n\n puts \"Downloaded #{gem_path} and #{gemspec_path}\"\nend",
"def info\n fetcher = Gem::SpecFetcher.new\n\n [[\"about\", MiniReadline::DESCRIPTION],\n [\"version\", MiniReadline::VERSION],\n [\"installed\", Gem::Specification.find_all_by_name(\"mini_readline\")\n .map{|s| s.version.to_s}\n .join(\", \")],\n [\"latest\", insouciant {latest_version_for(\"mini_readline\", fetcher).to_s}],\n [\"about\", MiniTerm::DESCRIPTION],\n [\"version\", MiniTerm::VERSION],\n [\"installed\", Gem::Specification.find_all_by_name(\"mini_term\")\n .map{|s| s.version.to_s}\n .join(\", \")],\n [\"latest\", insouciant {latest_version_for(\"mini_term\", fetcher).to_s}],\n [\"platform\", MiniTerm::TERM_PLATFORM.inspect],\n [\"term type\", MiniTerm::TERM_TYPE.inspect],\n [\"columns\", MiniTerm.width.to_s],\n [\"rows\", MiniTerm.height.to_s],\n [\"code page\", if MiniTerm.windows?; (`chcp`); end],\n [\"term\", ENV['TERM']],\n [\"disp\", ENV['DISPLAY']],\n [\"edit\", ENV['EDITOR']]\n ]\n end",
"def latest\n # Refresh package metadata before looking for latest versions\n pkg(:refresh)\n\n lines = pkg(:list, \"-Hvn\", @resource[:name]).split(\"\\n\")\n\n # remove certificate expiration warnings from the output, but report them\n cert_warnings = lines.select { |line| line =~ /^Certificate/ }\n unless cert_warnings.empty?\n Puppet.warning(_(\"pkg warning: %{warnings}\") % { warnings: cert_warnings.join(', ') })\n end\n\n lst = lines.select { |line| line !~ /^Certificate/ }.map { |line| self.class.parse_line(line) }\n\n # Now we know there is a newer version. But is that installable? (i.e are there any constraints?)\n # return the first known we find. The only way that is currently available is to do a dry run of\n # pkg update and see if could get installed (`pkg update -n res`).\n known = lst.find { |p| p[:status] == 'known' }\n if known\n options = ['-n']\n options.concat(join_options(@resource[:install_options])) if @resource[:install_options]\n return known[:ensure] if exec_cmd(command(:pkg), 'update', *options, @resource[:name])[:exit].zero?\n end\n\n # If not, then return the installed, else nil\n (lst.find {|p| p[:status] == 'installed' } || {})[:ensure]\n end",
"def remote_dependencies(gem_name, _version)\n conn = Faraday.new(url: 'https://rubygems.org') do |h|\n h.headers[:content_type] = 'application/x-www-form-urlencoded'\n h.request :url_encoded\n h.adapter :excon\n end\n response = conn.get(\"/api/v1/gems/#{gem_name}.json\")\n dep_list = MultiJson.load(response.body)\n dep_list['dependencies'].values.flatten.map do |j|\n Gem::Dependency.new(\n j['name'],\n Gem::Requirement.new(j['requirements'].split(','))\n )\n end\n end",
"def latest\n ## make hcmbcs jump through hoops to give us latest pkg version\n begin\n output = hcmbcs \"--search\", \"--xml\", \"--package=#{self.name}\"\n rescue Puppet::ExecutionFailure\n raise Puppet::Error, \"failed hcmbcs --search\"\n end\n\n ## scan with group gives array of arrays\n version = output.scan(/<hcm_release_fq_hcm_pn>#{self.name}-([^<]+)<\\/hcm_release_fq_hcm_pn>/).last.first\n self.debug version\n\n return version\n end",
"def gemspecs; end",
"def gems; end",
"def gems; end",
"def gems; end",
"def latest\n hash = self.class.pkglist(:justme => @resource[:name])\n hash[:avail] if hash\n end",
"def get_gem gem_instance_id\n check_validity\n response = api_get gem_instance_id\n if response != nil and response.key?\"gem\"\n return gem_to_note response[\"gem\"]\n else\n return nil\n end\n end",
"def gem(name, version)\n version = version.to_s\n\n begin\n json = open(\"https://rubygems.org/api/v1/versions/#{name}.json\") {|f| f.read}\n gems = JSON.parse(json)\n\n gem = gems.detect do |g|\n g[\"number\"] == version && g[\"platform\"] == \"ruby\"\n end\n\n if gem && gem[\"sha\"]\n # Rubygems.org was _supposed_ to provide base64 encoded SHA-256 hashes,\n # but as of now the hashes are base16 encoded...\n base16 = gem[\"sha\"]\n base32 = exec(\"nix-hash --type sha256 --to-base32 #{base16.shellescape}\")\n assert_length!(base32, 52)\n assert_format!(base32, /^[a-z0-9]+$/)\n\n base32\n end\n rescue Exception => ex\n #puts ex.message\n #puts ex.backtrace\n nil\n end\n end",
"def download_specs\n UI.puts 'Downloading Rubygem specification index...'\n fetcher = Gem::SpecFetcher.fetcher\n results, errors = fetcher.available_specs(:released)\n\n unless errors.empty?\n UI.puts 'Error downloading Rubygem specification index: ' +\n errors.first.error.to_s\n return []\n end\n\n flatten_fetcher_results(results)\n end",
"def load_details\n @commits = Package.new.git_commits\n @packages = Package.latest_first \n @package = Package.new\n end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def download_prog(repo_hash)\n if (repo_hash[:source] == \"github\")\n clone_repo(repo_hash)\n elsif (repo_hash[:source] == \"rubygems\")\n puts \"Unpacking gem #{repo_hash[:name]}...\"\n system \"gem unpack #{repo_hash[:name]} --version #{repo_hash[:version]}\"\n else\n raise \"Unexpected source of repo #{repo_hash[:name]}: #{repo_hash[:source]}\"\n end\nend",
"def gem_dependencies(rubygem)\n (latest = latest_gemspec(rubygem)) ?\n latest.dependencies.select {|e| e.type == :runtime }.map {|e| e.name} : []\n end",
"def gems\n gem_data = (project['gems'] ||= Gems::List.new)\n return gem_data if gem_data.kind_of? Gems::List\n if gem_data.kind_of? Hash\n project['gems'] = Gems::List.new(gem_data)\n save_config\n return gems\n end\n new_gems = Gems::List.new\n gem_data.each do |gem_ary|\n new_gems[gem_ary[0]] = gem_ary[1]\n end\n project['gems'] = new_gems\n save_config\n return gems\n end",
"def gem_spec\n require 'rubygems/specification'\n spec_fields = %w(\n name author email has_rdoc rubyforge_project summary\n version description required_ruby_version homepage\n )\n Gem::Specification.new do | spec |\n for field in spec_fields\n value = self.send( field )\n spec.send( \"#{field}=\", value )\n end\n \n spec.files = package.files.to_a + %w( Rakefile Manifest.txt )\n spec.test_files = unit_tests.to_a + functional_tests.to_a\n \n spec.executables.push( *executables )\n spec.requirements.push( *requirements )\n end\n end",
"def get_module_info(mod)\n pull_url = \"https://api.github.com/repos/puppetlabs/puppetlabs-#{mod.name}/issues?state=open&access_token=AUTHTOKEN\"\n response = HTTParty.get pull_url#, :headers=>{\"Authorization\"=>\"Token token=\\\"AUTHTOKEN\\\"\", \"User-Agent\"=>\"craig.gomes\"}\n\n\n json = JSON.parse(response.body)\n ticket_count = get_ticket_count_for_module(mod.name)\n component_count = get_component_count_for_module(mod.name)\n p mod.name\n return [\"#{mod.name}\", \"#{json.length}\",\"#{ticket_count}\",\"#{component_count}\",\"#{mod.supported}\", \"#{mod.homepage_url}\"]\n \nend",
"def load_minimal_gems\r\n end",
"def get_last_versions\n @last_release_mods = {}\n helper = PuppetfileHelper.new(@options[:last_release_puppetfile], @options[:root_dir], false)\n helper.modules.each do |mod|\n @last_release_mods[mod[:name]] = mod[:desired_ref]\n end\n end",
"def get_last_versions\n @last_release_mods = {}\n helper = PuppetfileHelper.new(@options[:last_release_puppetfile], @options[:root_dir], false)\n helper.modules.each do |mod|\n @last_release_mods[mod[:name]] = mod[:desired_ref]\n end\n end",
"def fetch_specification(name, version)\n url = host + \"/quick/#{Configuration.marshal_identifier}\" \\\n \"/#{name}-#{version}.gemspec.rz\"\n\n http_get(url).body\n end",
"def gems\n provisioner, version = @impl.split('-')\n get_gem_list(provisioner, version)\n end",
"def latest\n #rug can only get a list of *all* available packages?\n output = rug \"list-updates\"\n\n if output =~ /#{Regexp.escape @resource[:name]}\\s*\\|\\s*([^\\s\\|]+)/\n return $1\n else\n # rug didn't find updates, pretend the current\n # version is the latest\n return @property_hash[:ensure]\n end\n end",
"def required_gem_list\n Mack::Utils::GemManager.instance.required_gem_list\n end",
"def add_gem_facts\n unless @path.directory?\n @result.is_gem = false\n return\n end\n \n path = gemspec_path\n \n if path.nil?\n @result.is_gem = false\n return\n end\n \n @result.is_gem = true\n @result.package.types << 'gem'\n \n gem = @result.gem = Result.new\n \n gem.gemspec_path = gemspec_path.to_s\n \n spec = Gem::Specification::load(gemspec_path.to_s)\n gem.name = spec.name\n gem.version = QB::Package::Version.from_gem_version spec.version\n end",
"def build_gem; end",
"def util_read_spec(filename)\n unless Gem::VERSION >= \"2.0.0\"\n io = File.open(filename, \"rb\")\n Gem::Package.open(io, \"r\") { |x| x.metadata }\n else\n Gem::Package.new(filename).spec\n end\n end",
"def util_read_spec(filename)\n unless Gem::VERSION >= \"2.0.0\"\n io = File.open(filename, \"rb\")\n Gem::Package.open(io, \"r\") { |x| x.metadata }\n else\n Gem::Package.new(filename).spec\n end\n end",
"def latest\n version = nil\n pkg(:list, \"-Ha\", @resource[:name]).each_line do |line|\n v = self.class.parse_line(line.chomp)[:status]\n case v\n when \"known\"\n return v\n when \"installed\"\n version = v\n when \"i--\"\n version = self.class.parse_line(line.chomp)[:version]\n else\n Puppet.warn \"unknown package state for #{@resource[:name]}: #{v}\"\n end\n end\n version\n end",
"def load_gemspec\n\n text = File.read(gemspec_file)\n if text =~ /\\A---/ \n require 'yaml'\n spec = YAML.load(text)\n else\n #spec = eval(text) #, gemspec_file)\n spec = ::Gem::Specification.load(gemspec_file)\n end\n\n data = {}\n data[:name] = spec.name\n data[:version] = spec.version.to_s\n data[:date] = spec.date\n\n data[:paths] = {\n 'load' => spec.require_paths \n }\n\n data[:requirements] = []\n\n spec.runtime_dependencies.each do |dep|\n req = { \n 'name' => dep.name,\n 'version' => dep.requirement.to_s\n }\n data[:requirements] << req\n end\n\n spec.development_dependencies.each do |dep|\n req = { \n 'name' => dep.name,\n 'version' => dep.requirement.to_s,\n 'development' => true\n }\n data[:requirements] << req\n end\n\n update(data)\n end",
"def get_tools_version_info\n timestamp, sha1 = `git log -1 --pretty='%at,%h'`.strip.split(',')\n\n [ Time.at(timestamp.to_i), sha1 ]\nend",
"def versions name\n if @data.key?(name)\n return @data[name]\n end\n\n uri = @dep_uri + \"?gems=#{name}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n Marshal.load(str).each do |ver|\n @data[ver[:name]] << ver\n end\n\n @data[name]\n end",
"def private_gem(name)\n gem name, '0.3.0', git: \"https://#{ENV['GITHUB_TOKEN']}:x-oauth-basic@github.com/mharris717/#{name}.git\", branch: :master\nend",
"def versions name # :nodoc:\n if @data.key?(name)\n return @data[name]\n end\n\n uri = @dep_uri + \"?gems=#{name}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n Marshal.load(str).each do |ver|\n @data[ver[:name]] << ver\n end\n\n @data[name]\n end",
"def latest\n upd = latest_info\n unless upd.nil?\n # FIXME: there could be more than one update for a package\n # because of multiarch\n return \"#{upd[:epoch]}:#{upd[:version]}-#{upd[:release]}\"\n else\n # Yum didn't find updates, pretend the current\n # version is the latest\n raise Puppet::DevError, \"Tried to get latest on a missing package\" if properties[:ensure] == :absent\n return properties[:ensure]\n end\n end",
"def latest\n upd = latest_info\n unless upd.nil?\n # FIXME: there could be more than one update for a package\n # because of multiarch\n return \"#{upd[:epoch]}:#{upd[:version]}-#{upd[:release]}\"\n else\n # Yum didn't find updates, pretend the current\n # version is the latest\n raise Puppet::DevError, \"Tried to get latest on a missing package\" if properties[:ensure] == :absent\n return properties[:ensure]\n end\n end",
"def latest_version(gem_name, pre: false)\n return versions(gem_name).first if pre\n versions(gem_name).find { |version| !version.prerelease? }\n end",
"def build_gems; end",
"def download name\n @checked += 1\n gem_name = \"#{name}.gem\"\n\n if gem_exists? gem_name then\n @gem_queue.push name\n\n info \"#{gem_name} exists\"\n\n return\n end\n\n uri = @base_uri + \"#{name}.gem\"\n\n source_etag = nil\n dest_etag = nil\n\n @http.request uri do |source_res|\n break unless etag = source_res['ETag']\n source_etag = etag.delete '\"'\n\n dest_etag = @swift.write_object @gems_container, gem_name do |io|\n source_res.read_body do |chunk|\n io.write chunk\n end\n end\n end\n\n if dest_etag == source_etag then\n @gem_queue.push name\n\n info \"#{gem_name} downloaded\"\n\n @downloaded += 1\n else\n @gem_name_queue.push name\n @swift.delete_object @gems_container, gem_name\n\n info \"#{gem_name} download failed\"\n @failed += 1\n end\n end",
"def gemspec\n @gemspec ||= (\n require 'rubygems'\n ::Gem::Specification.load(gemspec_file)\n )\n end",
"def gem(*args)\n options = args.extract_options!\n name, version = args\n\n # Set the message to be shown in logs. Uses the git repo if one is given,\n # otherwise use name (version).\n parts, message = [ name.inspect ], name\n if version ||= options.delete(:version)\n parts << version.inspect\n message << \" (#{version})\"\n end\n message = options[:git] if options[:git]\n\n log :gemfile, message\n\n parts_without_group = parts.clone\n options.each do |option, value|\n str = \"#{option}: #{value.inspect}\"\n parts << str\n parts_without_group << str unless option == :group\n end\n\n in_root do\n if options.key?(:group)\n # remove brackets if any and prepend colon if missing\n group = options[:group].inspect.scan(/[[^\\[\\]]]/).join.to_sym\n\n group_definition = \"group #{group} do\"\n str = \"gem #{parts_without_group.join(\", \")}\"\n return if append_to_gem_group(group_definition, str.gsub(/\\\"/, '\\''))\n end\n\n str = \"gem #{parts.join(\", \")}\"\n str = \" \" + str if @in_group\n str = \"\\n\" + str\n append_file \"Gemfile\", str.gsub(/\\\"/, '\\'')\n end\nend",
"def remote_versions_for(name)\n require 'json'\n\n client.url = \"https://rubygems.org/api/v1/versions/#{name}.json\"\n client.follow_location = true\n client.http_get\n json = JSON.parse(client.body_str)\n json.collect { |version| version['number'] }\n end",
"def fetch_releases\n require \"open-uri\"\n\n open(RELEASE_URL) { |f| f.read.scan RELEASE_REGEXP }\n end",
"def get_alchemy_versions\n # first we try rubygems.org\n response = query_rubygems\n if response.code == \"200\"\n alchemy_versions = JSON.parse(response.body)\n alchemy_versions.collect { |h| h[\"number\"] }.sort\n else\n # rubygems.org not available?\n # then we try github\n response = query_github\n if response.code == \"200\"\n alchemy_tags = JSON.parse(response.body)\n alchemy_tags.collect { |h| h[\"name\"].tr(\"v\", \"\") }.sort\n else\n # no luck at all?\n raise UpdateServiceUnavailable\n end\n end\n end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def stable_gem_versions(http_response)\n http_response.blank? ? [] : http_response.select { |val| val['prerelease'] == false }\nend",
"def latest\n version = nil\n pkg(:list, \"-Ha\", @resource[:name]).each_line do |line|\n v = parse_line(line.chomp)[:status]\n case v\n when \"known\"\n return v\n when \"installed\"\n version = v\n else\n Puppet.warn \"unknown package state for #{@resource[:name]}: #{v}\"\n end\n end\n version\n end",
"def outdated\n remotes = Gem::SourceInfoCache.search(//)\n outdateds = []\n latest_specs.each do |_, local|\n name = local.name\n remote = remotes.select { |spec| spec.name == name }.\n sort_by { |spec| spec.version }.\n last\n outdateds << name if remote and local.version < remote.version\n end\n outdateds\n end",
"def refresh!\n from_installed_gems\n end",
"def fetch_dependencies()\n\t\"berks vendor cookbooks #{(@debug ? '-v' : '-q')}\"\n end",
"def latest\n #zypper can only get a list of *all* available packages?\n output = zypper \"list-updates\"\n\n if output =~ /#{Regexp.escape @resource[:name]}\\s*\\|.*?\\|\\s*([^\\s\\|]+)/\n return $1\n else\n # zypper didn't find updates, pretend the current\n # version is the latest\n return @property_hash[:ensure]\n end\n end",
"def source\n @source ||= Gem::Source::Installed.new\n end",
"def gemspec(path)\n installed_gemspec(path) || local_gemspec(path)\n end"
] |
[
"0.6909436",
"0.67987716",
"0.6710202",
"0.66781497",
"0.6618561",
"0.6537107",
"0.6537107",
"0.6492002",
"0.6484249",
"0.6458951",
"0.6332161",
"0.63310087",
"0.632336",
"0.6286475",
"0.6163504",
"0.6142461",
"0.61202216",
"0.6107243",
"0.609859",
"0.60928434",
"0.6092",
"0.60464036",
"0.6038317",
"0.60265684",
"0.5987583",
"0.5971253",
"0.5969823",
"0.5951708",
"0.59262574",
"0.5924875",
"0.591186",
"0.59090984",
"0.5898257",
"0.58942",
"0.5875409",
"0.5859165",
"0.58356726",
"0.58354247",
"0.5831545",
"0.5831545",
"0.5831545",
"0.582754",
"0.5815627",
"0.58103",
"0.5810292",
"0.57929987",
"0.5790759",
"0.5790759",
"0.5790759",
"0.5790759",
"0.5790759",
"0.5790759",
"0.5790759",
"0.5790759",
"0.578061",
"0.5766272",
"0.5765569",
"0.5761346",
"0.5755811",
"0.5752338",
"0.57341456",
"0.57341456",
"0.5731285",
"0.57194895",
"0.56867903",
"0.567323",
"0.56564415",
"0.5656225",
"0.5651296",
"0.5651296",
"0.56438315",
"0.564296",
"0.5636076",
"0.56347775",
"0.5631075",
"0.5630092",
"0.5626316",
"0.5626316",
"0.56149787",
"0.56085604",
"0.5606272",
"0.55981004",
"0.5596278",
"0.55961245",
"0.5592618",
"0.55920565",
"0.5588819",
"0.5588819",
"0.5588819",
"0.5588819",
"0.5588819",
"0.5588819",
"0.5587144",
"0.5575067",
"0.55606985",
"0.5556697",
"0.55558217",
"0.5527803",
"0.5522348",
"0.55219257"
] |
0.7547621
|
0
|
Retrieve specified metadata and contents for gem version from rubygems.org
|
def retrieve_version(name, version)
path = downloaded_gem_path name, version
parse :gem => path
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fetch_gem(name, version)\n http_get(host + \"/gems/#{name}-#{version}.gem\").body\n end",
"def gem_info(gem, client)\n gem_data = {}\n uri = (\n Gems.info(gem)['source_code_uri'] || Gems.info(gem)['homepage_uri']).sub!(%r{http.*com/}, '')\n repo = repository(uri, client)\n contributors_count = contributors(uri).css('span.num.text-emphasized').children[2].text.to_i\n used_by_count = dependents(uri).css('.btn-link')[1].text.delete('^0-9').to_i\n gem_data[gem.to_sym] = gem_properties(repo, contributors_count, used_by_count)\n end",
"def retrieve_latest(name)\n client.url = \"https://rubygems.org/api/v1/gems/#{name}.json\"\n client.http_get\n spec = client.body_str\n gem = parse spec\n gem\n end",
"def describe gem, source = { rubygems: true }\n if source[:rubygems]\n Gems.info(gem).fetch \"info\"\n else\n info = GemspecInfo.new gem, source\n info.summary\n end\n end",
"def gem(name, version)\n version = version.to_s\n\n begin\n json = open(\"https://rubygems.org/api/v1/versions/#{name}.json\") {|f| f.read}\n gems = JSON.parse(json)\n\n gem = gems.detect do |g|\n g[\"number\"] == version && g[\"platform\"] == \"ruby\"\n end\n\n if gem && gem[\"sha\"]\n # Rubygems.org was _supposed_ to provide base64 encoded SHA-256 hashes,\n # but as of now the hashes are base16 encoded...\n base16 = gem[\"sha\"]\n base32 = exec(\"nix-hash --type sha256 --to-base32 #{base16.shellescape}\")\n assert_length!(base32, 52)\n assert_format!(base32, /^[a-z0-9]+$/)\n\n base32\n end\n rescue Exception => ex\n #puts ex.message\n #puts ex.backtrace\n nil\n end\n end",
"def name; @gem_data[\"name\"]; end",
"def latest_version(name)\n return JSON.parse(open(\"http://rubygems.org/api/v1/gems/#{name}.json\").read)['version']\n end",
"def fetch_specification(name, version)\n url = host + \"/quick/#{Configuration.marshal_identifier}\" \\\n \"/#{name}-#{version}.gemspec.rz\"\n\n http_get(url).body\n end",
"def parse_gemfile\n ParserUtil.gemfile(data[\"Gemfile\"])\n end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def util_read_spec(filename)\n unless Gem::VERSION >= \"2.0.0\"\n io = File.open(filename, \"rb\")\n Gem::Package.open(io, \"r\") { |x| x.metadata }\n else\n Gem::Package.new(filename).spec\n end\n end",
"def util_read_spec(filename)\n unless Gem::VERSION >= \"2.0.0\"\n io = File.open(filename, \"rb\")\n Gem::Package.open(io, \"r\") { |x| x.metadata }\n else\n Gem::Package.new(filename).spec\n end\n end",
"def main\n last_good_root = from_file($cache_dir + '/root.txt') ||\n from_file('config/root.txt') ||\n raise(\"Can't find root.txt\")\n\n repository = Gem::TUF::Repository.new(\n root: JSON.parse(last_good_root),\n bucket: FileCachingBucket.new(HttpBucket.new($host))\n )\n\n gem_name = ARGV.shift\n\n specs = repository.target('latest_specs.4.8.gz')\n raise \"could not find latest_specs.4.8.gz\" unless specs\n specs = unmarshal_gz specs\n gem = specs.detect {|x| x[0] == gem_name } || raise(\"Can't find gem #{gem}\")\n\n gem_with_version = \"#{gem[0]}-#{gem[1]}\"\n gem_path = \"gems/#{gem_with_version}.gem\"\n gemspec_path = \"quick/Marshal.4.8/#{gem_with_version}.gemspec.rz\"\n\n repository.target(gemspec_path)\n repository.target(gem_path)\n\n puts \"Downloaded #{gem_path} and #{gemspec_path}\"\nend",
"def get_latest_stable_version_details(http_response)\n versions = stable_gem_versions(http_response)\n sorted_versions = sorted_versions(versions)\n last_version_number = last_version(sorted_versions)\n find_version(versions, last_version_number)\nend",
"def remote_version\n rubygem_api = JSON.parse open(\"https://rubygems.org/api/v1/versions/osa.json\").read\n rubygem_api.first[\"number\"]\n rescue Exception => e\n puts \"[!] \".yellow + \" Couldn't check the latest version, please check internet connectivity.\"\n exit!\n end",
"def gem_spec\n require 'rubygems/specification'\n spec_fields = %w(\n name author email has_rdoc rubyforge_project summary\n version description required_ruby_version homepage\n )\n Gem::Specification.new do | spec |\n for field in spec_fields\n value = self.send( field )\n spec.send( \"#{field}=\", value )\n end\n \n spec.files = package.files.to_a + %w( Rakefile Manifest.txt )\n spec.test_files = unit_tests.to_a + functional_tests.to_a\n \n spec.executables.push( *executables )\n spec.requirements.push( *requirements )\n end\n end",
"def memcached_gem_info\n @memcached_gem_info ||= Rails.cache.read_multi(*@gem_information.values)\n end",
"def latest_gemspec(rubygem)\n ::Gem.source_index.gems.values.select {|e| e.name == rubygem }.sort_by {|e| e.version }[-1]\n end",
"def get_gem gem_instance_id\n check_validity\n response = api_get gem_instance_id\n if response != nil and response.key?\"gem\"\n return gem_to_note response[\"gem\"]\n else\n return nil\n end\n end",
"def info\n fetcher = Gem::SpecFetcher.new\n\n [[\"about\", MiniReadline::DESCRIPTION],\n [\"version\", MiniReadline::VERSION],\n [\"installed\", Gem::Specification.find_all_by_name(\"mini_readline\")\n .map{|s| s.version.to_s}\n .join(\", \")],\n [\"latest\", insouciant {latest_version_for(\"mini_readline\", fetcher).to_s}],\n [\"about\", MiniTerm::DESCRIPTION],\n [\"version\", MiniTerm::VERSION],\n [\"installed\", Gem::Specification.find_all_by_name(\"mini_term\")\n .map{|s| s.version.to_s}\n .join(\", \")],\n [\"latest\", insouciant {latest_version_for(\"mini_term\", fetcher).to_s}],\n [\"platform\", MiniTerm::TERM_PLATFORM.inspect],\n [\"term type\", MiniTerm::TERM_TYPE.inspect],\n [\"columns\", MiniTerm.width.to_s],\n [\"rows\", MiniTerm.height.to_s],\n [\"code page\", if MiniTerm.windows?; (`chcp`); end],\n [\"term\", ENV['TERM']],\n [\"disp\", ENV['DISPLAY']],\n [\"edit\", ENV['EDITOR']]\n ]\n end",
"def versions name\n if @data.key?(name)\n return @data[name]\n end\n\n uri = @dep_uri + \"?gems=#{name}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n Marshal.load(str).each do |ver|\n @data[ver[:name]] << ver\n end\n\n @data[name]\n end",
"def show_gems name, prerelease\n req = Gem::Requirement.default\n # TODO: deprecate for real\n dep = Gem::Deprecate.skip_during { Gem::Dependency.new name, req }\n dep.prerelease = prerelease\n\n if local? then\n if prerelease and not both? then\n alert_warning \"prereleases are always shown locally\"\n end\n\n display_header 'LOCAL'\n\n specs = Gem::Specification.find_all { |s|\n s.name =~ name and req =~ s.version\n }\n\n spec_tuples = specs.map do |spec|\n [spec.name_tuple, spec]\n end\n\n output_query_results spec_tuples\n end\n\n if remote? then\n display_header 'REMOTE'\n\n fetcher = Gem::SpecFetcher.fetcher\n\n type = if options[:all]\n if options[:prerelease]\n :complete\n else\n :released\n end\n elsif options[:prerelease]\n :prerelease\n else\n :latest\n end\n\n if name.source.empty?\n spec_tuples = fetcher.detect(type) { true }\n else\n spec_tuples = fetcher.detect(type) do |name_tuple|\n name === name_tuple.name\n end\n end\n\n output_query_results spec_tuples\n end\n end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def remote_versions_for(name)\n require 'json'\n\n client.url = \"https://rubygems.org/api/v1/versions/#{name}.json\"\n client.follow_location = true\n client.http_get\n json = JSON.parse(client.body_str)\n json.collect { |version| version['number'] }\n end",
"def read_source_parts\n @source_parts ||= begin\n chunked_source = ChunkedSource.new(@source_path.open(\"r\"))\n metadata_extractor = TinyGem::MetadataExtractor.new(chunked_source, 'name' => gem_name)\n {spec: metadata_extractor.as_gemspec, library: chunked_source.library,\n readme: chunked_source.readme, executable: metadata_extractor.executable_code}\n end\n end",
"def query_rubygems\n make_api_request(\"https://rubygems.org/api/v1/versions/alchemy_cms.json\")\n end",
"def versions name # :nodoc:\n if @data.key?(name)\n return @data[name]\n end\n\n uri = @dep_uri + \"?gems=#{name}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n Marshal.load(str).each do |ver|\n @data[ver[:name]] << ver\n end\n\n @data[name]\n end",
"def download_gem(name, version)\n cached = GemCache.get(name, version)\n return cached unless cached.nil?\n\n client.url = \"https://rubygems.org/gems/#{name}-#{version}.gem\"\n client.follow_location = true\n client.http_get\n gemf = client.body_str\n\n GemCache.set(name, version, gemf)\n gemf\n end",
"def download_gem\n self.class.download_gem @name, @version\n end",
"def retrieve\n return if retrieved_at && retrieved_at.utc > DateTime.now.utc - 1.hour\n \n rubygems_info = Gems.info name\n new_attributes = {\n name: rubygems_info['name'], \n version: rubygems_info['version'], \n info: rubygems_info['info'],\n retrieved_at: DateTime.now\n }\n update_attributes(new_attributes, as: :internal)\n end",
"def latest\n url = \"https://pypi.python.org/pypi/#{URI.encode(@resource[:name])}/json\"\n result = self.open_jsonurl(url)\n result['info']['version'] if result != nil\n rescue Timeout::Error => detail\n raise Puppet::Error, \"Error in contacting pypi.python.org: #{detail}\"\n end",
"def gem_signature(gem_full_name); end",
"def gemspecs; end",
"def gem(*args)\n options = args.extract_options!\n name, version = args\n\n # Set the message to be shown in logs. Uses the git repo if one is given,\n # otherwise use name (version).\n parts, message = [ name.inspect ], name\n if version ||= options.delete(:version)\n parts << version.inspect\n message << \" (#{version})\"\n end\n message = options[:git] if options[:git]\n\n log :gemfile, message\n\n parts_without_group = parts.clone\n options.each do |option, value|\n str = \"#{option}: #{value.inspect}\"\n parts << str\n parts_without_group << str unless option == :group\n end\n\n in_root do\n if options.key?(:group)\n # remove brackets if any and prepend colon if missing\n group = options[:group].inspect.scan(/[[^\\[\\]]]/).join.to_sym\n\n group_definition = \"group #{group} do\"\n str = \"gem #{parts_without_group.join(\", \")}\"\n return if append_to_gem_group(group_definition, str.gsub(/\\\"/, '\\''))\n end\n\n str = \"gem #{parts.join(\", \")}\"\n str = \" \" + str if @in_group\n str = \"\\n\" + str\n append_file \"Gemfile\", str.gsub(/\\\"/, '\\'')\n end\nend",
"def get_latest_stable_version_details(http_response)\n versions = stable_gem_versions(http_response)\n sorted_versions = sorted_versions(versions)\n last_version_number = last_version(sorted_versions)\n find_version(versions, last_version_number)\n end",
"def get_gem_names\n fetcher = Gem::SpecFetcher.fetcher\n\n list, = fetcher.available_specs(:complete)\n\n tuples = list.values.first\n\n tuples.map do |tuple,|\n tuple = tuple.to_a\n case tuple.last\n when Gem::Platform::RUBY then\n tuple[0, 2]\n else\n tuple\n end.join '-'\n end\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 to_gemspec(options={})\n require_rubygems\n\n if metadata.resources\n homepage = metadata.resources.homepage\n else\n homepage = nil\n end\n\n if homepage && md = /(\\w+).rubyforge.org/.match(homepage)\n rubyforge_project = md[1]\n else\n # b/c it has to be something according to Eric Hodel.\n rubyforge_project = metadata.name.to_s\n end\n\n #TODO: may be able to get this from project method\n if news = Dir[root + 'NEWS{,.txt}'].first\n install_message = File.read(news)\n end\n\n ::Gem::Specification.new do |spec|\n spec.name = self.name.to_s\n spec.version = self.version.to_s\n spec.require_paths = self.loadpath.to_a\n\n spec.summary = metadata.summary.to_s\n spec.description = metadata.description.to_s\n spec.authors = metadata.authors.to_a\n spec.email = metadata.email.to_s\n spec.licenses = metadata.licenses.to_a\n\n spec.homepage = metadata.homepage.to_s\n\n # -- platform --\n\n # TODO: how to handle multiple platforms?\n spec.platform = options[:platform] #|| verfile.platform #'ruby' ???\n #if metadata.platform != 'ruby'\n # spec.require_paths.concat(spec.require_paths.collect{ |d| File.join(d, platform) })\n #end\n\n # -- rubyforge project --\n\n spec.rubyforge_project = rubyforge_project\n\n # -- compiled extensions --\n\n spec.extensions = options[:extensions] || self.extensions\n\n # -- dependencies --\n\n case options[:gemfile]\n #when String\n # gemfile = root.glob(options[:gemfile]).first # TODO: Alternate gemfile\n when nil, true\n gemfile = root.glob('Gemfile').first\n else\n gemfile = nil\n end\n\n if gemfile\n require 'bundler'\n spec.add_bundler_dependencies\n else\n metadata.requirements.each do |dep|\n if dep.development?\n spec.add_development_dependency( *[dep.name, dep.constraint].compact )\n else\n next if dep.optional?\n spec.add_runtime_dependency( *[dep.name, dep.constraint].compact )\n end\n end\n end\n\n # TODO: considerations?\n #spec.requirements = options[:requirements] || package.consider\n\n # -- executables --\n\n # TODO: bin/ is a POM convention, is there are reason to do otherwise?\n spec.bindir = options[:bindir] || \"bin\"\n spec.executables = options[:executables] || self.executables\n\n # -- rdocs (argh!) --\n\n readme = root.glob_relative('README{,.*}', File::FNM_CASEFOLD).first\n extra = options[:extra_rdoc_files] || []\n\n rdocfiles = []\n rdocfiles << readme.to_s if readme\n rdocfiles.concat(extra)\n rdocfiles.uniq!\n\n rdoc_options = [] #['--inline-source']\n rdoc_options.concat [\"--title\", \"#{metadata.title} API\"] #if metadata.title\n rdoc_options.concat [\"--main\", readme.to_s] if readme\n\n spec.extra_rdoc_files = rdocfiles\n spec.rdoc_options = rdoc_options\n\n # -- distributed files --\n\n if manifest.exist?\n filelist = manifest.select{ |f| File.file?(f) }\n spec.files = filelist\n else\n spec.files = root.glob_relative(\"**/*\").map{ |f| f.to_s } # metadata.distribute ?\n end\n\n # DEPRECATED: -- test files --\n #spec.test_files = manifest.select do |f|\n # File.basename(f) =~ /test\\// && File.extname(f) == '.rb'\n #end\n\n if install_message\n spec.post_install_message = install_message\n end\n end\n\n end",
"def main\n # TODO: Check for expiry across all metadata files.\n\n last_good_root = from_file('root.txt') || get_metadata('root.txt')\n\n timestamp = get_metadata 'timestamp.txt'\n verify! timestamp, extract_keys(last_good_root, 'timestamp')\n\n release = get_hashed_metadata(\"release.txt\", timestamp['signed']['meta'])\n verify! release, extract_keys(last_good_root, 'release')\n\n # TODO: If our release hasn't changed from last known good, don't need to\n # refetch root.txt and targets.txt\n\n root = get_hashed_metadata(\"root.txt\", release['signed']['meta'])\n verify! root, extract_keys(last_good_root, \"root\")\n\n store_file 'root.txt', root\n last_good_root = root\n\n targets = get_hashed_metadata(\"targets.txt\", release['signed']['meta'])\n verify! targets, extract_keys(last_good_root, \"targets\")\n\n gem_name = ARGV[0]\n\n specs = unmarshal_gz(get_hashed_target(\"latest_specs.4.8.gz\", targets['signed']['targets']))\n\n gem = specs.detect {|x| x[0] == gem_name } || raise(\"Can't find gem #{gem}\")\n\n gem_with_version = \"#{gem[0]}-#{gem[1]}\"\n gem_path = \"gems/#{gem_with_version}.gem\"\n gemspec_path = \"quick/Marshal.4.8/#{gem_with_version}.gemspec.rz\"\n\n get_target(gemspec_path, targets['signed']['targets'])\n get_target(gem_path, targets['signed']['targets'])\n\n puts \"Downloaded #{gem_path} and #{gemspec_path}\"\nend",
"def download_gem\n self.class.download_gem @name, @version\n end",
"def remote_dependencies(gem_name, _version)\n conn = Faraday.new(url: 'https://rubygems.org') do |h|\n h.headers[:content_type] = 'application/x-www-form-urlencoded'\n h.request :url_encoded\n h.adapter :excon\n end\n response = conn.get(\"/api/v1/gems/#{gem_name}.json\")\n dep_list = MultiJson.load(response.body)\n dep_list['dependencies'].values.flatten.map do |j|\n Gem::Dependency.new(\n j['name'],\n Gem::Requirement.new(j['requirements'].split(','))\n )\n end\n end",
"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 load_gemspec\n\n text = File.read(gemspec_file)\n if text =~ /\\A---/ \n require 'yaml'\n spec = YAML.load(text)\n else\n #spec = eval(text) #, gemspec_file)\n spec = ::Gem::Specification.load(gemspec_file)\n end\n\n data = {}\n data[:name] = spec.name\n data[:version] = spec.version.to_s\n data[:date] = spec.date\n\n data[:paths] = {\n 'load' => spec.require_paths \n }\n\n data[:requirements] = []\n\n spec.runtime_dependencies.each do |dep|\n req = { \n 'name' => dep.name,\n 'version' => dep.requirement.to_s\n }\n data[:requirements] << req\n end\n\n spec.development_dependencies.each do |dep|\n req = { \n 'name' => dep.name,\n 'version' => dep.requirement.to_s,\n 'development' => true\n }\n data[:requirements] << req\n end\n\n update(data)\n end",
"def parse_gems_for_versions_file(gems)\n gems_hash = {}\n gems.each do |entry|\n gems_hash[entry['name']] ||= []\n gems_hash[entry['name']] << CompactIndex::GemVersion.new(\n entry['number'],\n entry['platform'],\n nil,\n entry['info_checksum']\n )\n end\n\n gems_hash.map do |gem, versions|\n CompactIndex::Gem.new(gem, versions)\n end\n end",
"def version_from_gem_lock_file\n shell_return = run_shell(\"grep -A 1 RUBY Gemfile.lock\")\n shell_return.nil? ? nil : shell_return.stdout.split(\"\\n\")[1].strip.split(\" \")[1]\n end",
"def private_gem(name)\n gem name, '0.3.0', git: \"https://#{ENV['GITHUB_TOKEN']}:x-oauth-basic@github.com/mharris717/#{name}.git\", branch: :master\nend",
"def gemspec?; end",
"def stable_gem_versions(http_response)\n http_response.blank? ? [] : http_response.select { |val| val['prerelease'] == false }\nend",
"def gem_spec\n if @gem_spec.nil?\n unless @gem_spec = Micro::Source.gem_spec(@name, @version_requirements.version)\n raise Micro::GemSpecMissingError, \"Unable to locate Gem::Specification for Gem::Dependency `#{self}'\"\n end\n end\n \n @gem_spec\n end",
"def version\n @gemspec.version || @version_helper.to_s\n end",
"def gemspec\n @gemspec ||= (\n require 'rubygems'\n ::Gem::Specification.load(gemspec_file)\n )\n end",
"def available_versions\n return unless @version\n the_gem_line = gem_remote_list_output.scan(/^#{name}\\s.*$/).first\n the_gem_line.scan /\\d+\\.\\d+\\.\\d+/\n end",
"def get_version(gem)\n lockfile_specs.find { |s| s.name == gem }&.version\n end",
"def find_gem(name, version)\n spec = source_index.find_name(name, version).last\n unless spec and (spec.installation_path rescue nil)\n alert_error \"Could not find gem #{name} (#{version})\"\n raise Gem::GemNotFoundException, \"Could not find gem #{name}, (#{version})\"\n end\n\n return spec\n end",
"def get_release_info(author, repository, options)\n url = Kernel.format(\n 'https://api.github.com/repos/%{author}/%{repository}/releases/%{tag}%{release}',\n author: author,\n repository: repository,\n tag: (options[:is_tag]) ? 'tags/' : '',\n release: options[:release],\n )\n\n release_info_json = fetch_from_url(\n url,\n options[:username],\n options[:password],\n options[:use_auth],\n options[:use_oauth],\n )\n\n return nil unless release_info_json\n\n # Read in release info from JSON file\n\n Puppet.debug('Parsing release info')\n\n # noinspection RubyResolve\n PSON.load(release_info_json)\nend",
"def versions(name) # :nodoc:\n if @data.key?(name)\n return @data[name]\n end\n\n uri = @dep_uri + name\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n lines(str).each do |ver|\n number, platform, dependencies, requirements = parse_gem(ver)\n\n platform ||= \"ruby\"\n dependencies = dependencies.map {|dep_name, reqs| [dep_name, reqs.join(\", \")] }\n requirements = requirements.map {|req_name, reqs| [req_name.to_sym, reqs] }.to_h\n\n @data[name] << { name: name, number: number, platform: platform, dependencies: dependencies, requirements: requirements }\n end\n\n @data[name]\n end",
"def git_describe_version\n return nil unless is_git_repo and raw = run_git_describe_internal\n # reprocess that into a nice set of output data\n # The elements we select potentially change if this is an rc\n # For an rc with added commits our string will be something like '0.7.0-rc1-63-g51ccc51'\n # and our return will be [0.7.0, rc1, 63, <dirty>]\n # For a final with added commits, it will look like '0.7.0-63-g51ccc51'\n # and our return will be [0.7.0, 64, <dirty>]\n info = raw.chomp.sub(/^v/, '').split('-')\n if git_ref_type == \"tag\"\n version_string = info.compact\n elsif info[1].to_s.match('^[\\d]+')\n version_string = info.values_at(0, 1, 3).compact\n else\n version_string = info.values_at(0, 1, 2, 4).compact\n end\n version_string\n end",
"def gems; end",
"def gems; end",
"def gems; end",
"def add_gem_facts\n unless @path.directory?\n @result.is_gem = false\n return\n end\n \n path = gemspec_path\n \n if path.nil?\n @result.is_gem = false\n return\n end\n \n @result.is_gem = true\n @result.package.types << 'gem'\n \n gem = @result.gem = Result.new\n \n gem.gemspec_path = gemspec_path.to_s\n \n spec = Gem::Specification::load(gemspec_path.to_s)\n gem.name = spec.name\n gem.version = QB::Package::Version.from_gem_version spec.version\n end",
"def from_rubygems(name, version)\n download_gem name, version\n from_gem downloaded_gem_path(name, version)\n end",
"def requirements_for_gem(gem_name)\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem_name == gem_name }\n end",
"def installed_gems\n gems = []\n\n cmd = [attributes.gem_binary, 'list', '-l']\n cmd << '--prerelease' if attributes.prerelease\n\n run_command(cmd).stdout.each_line do |line|\n next unless /\\A([^ ]+) \\(([^\\)]+)\\)\\z/ =~ line.strip\n\n name = $1\n versions = $2.split(', ')\n gems << { name: name, versions: versions }\n end\n gems\n rescue Backend::CommandExecutionError\n []\n end",
"def available_versions\n the_gem_line = gem_remote_list_output.scan(/^#{name}\\s.*$/).first\n the_gem_line.scan /\\d+\\.\\d+\\.\\d+/\n end",
"def get_module_info(mod)\n pull_url = \"https://api.github.com/repos/puppetlabs/puppetlabs-#{mod.name}/issues?state=open&access_token=AUTHTOKEN\"\n response = HTTParty.get pull_url#, :headers=>{\"Authorization\"=>\"Token token=\\\"AUTHTOKEN\\\"\", \"User-Agent\"=>\"craig.gomes\"}\n\n\n json = JSON.parse(response.body)\n ticket_count = get_ticket_count_for_module(mod.name)\n component_count = get_component_count_for_module(mod.name)\n p mod.name\n return [\"#{mod.name}\", \"#{json.length}\",\"#{ticket_count}\",\"#{component_count}\",\"#{mod.supported}\", \"#{mod.homepage_url}\"]\n \nend",
"def build_gem; end",
"def gemspec(platform = 'ruby')\n Gem::Specification.load(File.expand_path('../../redcloth.gemspec', __FILE__))\nend",
"def fetch_gems_data\n puts \"Fetching data for...\"\n # slice 100 to avoid too many requests on RubyGems and GitHub APIs\n gems.each_slice(100) do |batch|\n each_concurrently(batch) do |gem|\n begin\n retries ||= 0\n # set verbose to true to stdout the gem name\n gem.prepare_data(verbose: true)\n # rescue SocketError, Faraday::ConnectionFailed...\n rescue StandardError\n (retries += 1) <= RETRIES ? retry : nil\n end\n end\n end\n end",
"def load_versioning\n if @project_root and Pkg::Util::Git.describe\n @ref = Pkg::Util::Git.sha_or_tag\n @short_ref = Pkg::Util::Git.sha_or_tag(7)\n @version = Pkg::Util::Version.dash_version\n @gemversion = Pkg::Util::Version.dot_version\n @debversion = Pkg::Util::Version.debversion\n @origversion = Pkg::Util::Version.origversion\n @rpmversion = Pkg::Util::Version.rpmversion\n @rpmrelease = Pkg::Util::Version.rpmrelease\n else\n puts \"Skipping determination of version via git describe, Pkg::Config.project_root is not set to the path of a tagged git repo.\"\n end\n end",
"def latest\n client = XMLRPC::Client.new2(\"http://pypi.python.org/pypi\")\n client.http_header_extra = {\"Content-Type\" => \"text/xml\"}\n client.timeout = 10\n result = client.call(\"package_releases\", @resource[:name])\n result.first\n rescue Timeout::Error => detail\n raise Puppet::Error, \"Timeout while contacting pypi.python.org: #{detail}\";\n end",
"def latest\n client = XMLRPC::Client.new2(\"http://pypi.python.org/pypi\")\n client.http_header_extra = {\"Content-Type\" => \"text/xml\"}\n client.timeout = 10\n result = client.call(\"package_releases\", @resource[:name])\n result.first\n rescue Timeout::Error => detail\n raise Puppet::Error, \"Timeout while contacting pypi.python.org: #{detail}\";\n end",
"def get_tools_version_info\n timestamp, sha1 = `git log -1 --pretty='%at,%h'`.strip.split(',')\n\n [ Time.at(timestamp.to_i), sha1 ]\nend",
"def cb_local_lookup(cb_name)\n full_path = File.expand_path(\"#{$opts[:repo]}/#{cb_name}\")\n if File.exists?(\"#{full_path}/metadata.rb\")\n version = (`grep '^version' #{full_path}/metadata.rb`)\n else\n return -1\n end\n version.split(' ').last.gsub('\"','').gsub('\\'','').chomp\nend",
"def version_info\n return @children['version-info'][:value]\n end",
"def find_metadata\n versions.each do |v|\n m = v.metadata\n if m.exist?\n return m\n end\n end\n nil\n end",
"def gems\n provisioner, version = @impl.split('-')\n get_gem_list(provisioner, version)\n end",
"def gem(*args)\n options = args.extract_options!\n name, *versions = args\n\n # Set the message to be shown in logs. Uses the git repo if one is given,\n # otherwise use name (version).\n parts, message = [ quote(name) ], name.dup\n\n if versions = versions.any? ? versions : options.delete(:version)\n _versions = Array(versions)\n _versions.each do |version|\n parts << quote(version)\n end\n message << \" (#{_versions.join(\", \")})\"\n end\n message = options[:git] if options[:git]\n\n log :gemfile, message\n\n parts << quote(options) unless options.empty?\n\n in_root do\n str = \"gem #{parts.join(\", \")}\"\n str = indentation + str\n str = \"\\n\" + str\n append_file \"Gemfile\", str, verbose: false\n end\n end",
"def gem_spec\n Gem::Specification.new do |s|\n s.name = package_name\n s.version = version\n s.platform = Gem::Platform::RUBY\n s.summary = summary\n s.description = description || summary\n s.author = author_name\n s.email = author_email\n s.homepage = project_url\n s.require_path = lib_dir\n s.files = package_files\n s.test_files = tests\n s.bindir = bin_dir\n s.executables = programs.map{|p| File.basename(p)}\n s.extensions = FileList['ext/**/extconf.rb']\n s.has_rdoc = true\n s.extra_rdoc_files = rdoc_files\n s.rdoc_options.concat(rdoc_options)\n s.test_files = tests\n s.rubyforge_project = rubyforge_project\n dependencies.each { |args| s.add_dependency(*args) }\n @package_configurator.call(s) if @package_configurator\n end\n end",
"def set_package_info\n download_and_extract_package\n parse_package_description\n @package_hash = filter_into_package @package_desc\n @version_hash = filter_into_version @package_desc\n @author_hash = filter_into_author @package_desc[\"Author\"]\n @maintainer_hash = filter_into_author @package_desc[\"Maintainer\"]\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 path = File.join(SERVER_ROOT, 'public', 'version_info.json')\n JSON.load File.read(path)\nend",
"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 yardoc_file_for_gem(gem, ver_require = T.unsafe(nil), for_writing = T.unsafe(nil)); end",
"def find_gems\n @gems = RubygemsApi.call :all\n end",
"def to_ruby\n%{Gem::Specification.new do |s|\n s.name = \"#{@gem_spec.name}\"\n s.version = \"#{@gem_spec.version}\"\n\n s.specification_version = #{ ivar_get(:specification_version) || 2 } if s.respond_to? :specification_version=\n s.required_rubygems_version = Gem::Requirement.new(\"#{ivar_get(:required_rubygems_version) || '>= 0'}\") if s.respond_to? :required_rubygems_version=\n\n#{gem_spec_variables.map { |k,v| \" s.#{k} = #{v.inspect}\" }.join(\"\\n\") }\n\n#{@gem_spec.dependencies.map { |dep| \" s.add_dependency(\\\"#{dep.name}\\\", [\\\"#{dep.version_requirements.to_s}\\\"])\" }.join(\"\\n\") }\nend}\n end",
"def spec # :nodoc:\n @spec ||=\n begin\n tuple = Gem::NameTuple.new @name, @version, @platform\n source.fetch_spec tuple\n rescue Gem::RemoteFetcher::FetchError\n raise if @original_platform == @platform\n\n tuple = Gem::NameTuple.new @name, @version, @original_platform\n source.fetch_spec tuple\n end\n end",
"def get_version(script)\n file_array = IO.readlines script\n version = file_array.grep(/^# Version/)[0].split(\":\")[1].gsub(/^\\s+/,'').chomp\n packager = file_array.grep(/^# Packager/)[0].split(\":\")[1].gsub(/^\\s+/,'').chomp\n name = file_array.grep(/^# Name/)[0].split(\":\")[1].gsub(/^\\s+/,'').chomp\n return version,packager,name\nend"
] |
[
"0.71865034",
"0.7092944",
"0.70280266",
"0.6797405",
"0.6755265",
"0.66122746",
"0.65205914",
"0.6501583",
"0.64017546",
"0.6397741",
"0.6397741",
"0.6397741",
"0.6397741",
"0.6397741",
"0.6397741",
"0.6392963",
"0.6392963",
"0.6373492",
"0.6294051",
"0.626325",
"0.62624896",
"0.6246305",
"0.62368864",
"0.62231153",
"0.6207192",
"0.619511",
"0.61858034",
"0.6183968",
"0.6183968",
"0.6183968",
"0.6183968",
"0.6183968",
"0.6183968",
"0.6183968",
"0.6183968",
"0.61783373",
"0.6174172",
"0.6157631",
"0.6143377",
"0.6138736",
"0.61260074",
"0.6116513",
"0.60644233",
"0.6048202",
"0.60390675",
"0.6031879",
"0.6026973",
"0.60210675",
"0.6016333",
"0.598194",
"0.5979331",
"0.59737146",
"0.597207",
"0.5964485",
"0.59495395",
"0.5926571",
"0.59183",
"0.59170187",
"0.5915193",
"0.58964425",
"0.58921653",
"0.5891084",
"0.58873814",
"0.5883612",
"0.58822095",
"0.5840844",
"0.58404535",
"0.5838514",
"0.58331865",
"0.58314556",
"0.58314556",
"0.58314556",
"0.58301854",
"0.58264905",
"0.58159244",
"0.58145565",
"0.5808314",
"0.5805118",
"0.58046114",
"0.5804093",
"0.5802979",
"0.57930547",
"0.57822937",
"0.57822937",
"0.5774266",
"0.57679754",
"0.57623994",
"0.57423466",
"0.5738819",
"0.57375497",
"0.57372564",
"0.57338446",
"0.57251894",
"0.5723546",
"0.5714662",
"0.57009256",
"0.56883967",
"0.5687595",
"0.56793565",
"0.5665235"
] |
0.6815901
|
3
|
Retrieve gem metadata and contents from rubygems.org
|
def retrieve(name, version=nil)
version.nil? ? retrieve_latest(name) : retrieve_version(name, version)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def gem_info(gem, client)\n gem_data = {}\n uri = (\n Gems.info(gem)['source_code_uri'] || Gems.info(gem)['homepage_uri']).sub!(%r{http.*com/}, '')\n repo = repository(uri, client)\n contributors_count = contributors(uri).css('span.num.text-emphasized').children[2].text.to_i\n used_by_count = dependents(uri).css('.btn-link')[1].text.delete('^0-9').to_i\n gem_data[gem.to_sym] = gem_properties(repo, contributors_count, used_by_count)\n end",
"def fetch_gem(name, version)\n http_get(host + \"/gems/#{name}-#{version}.gem\").body\n end",
"def retrieve_latest(name)\n client.url = \"https://rubygems.org/api/v1/gems/#{name}.json\"\n client.http_get\n spec = client.body_str\n gem = parse spec\n gem\n end",
"def describe gem, source = { rubygems: true }\n if source[:rubygems]\n Gems.info(gem).fetch \"info\"\n else\n info = GemspecInfo.new gem, source\n info.summary\n end\n end",
"def parse_gemfile\n ParserUtil.gemfile(data[\"Gemfile\"])\n end",
"def find_gems\n @gems = RubygemsApi.call :all\n end",
"def gemspecs; end",
"def sources\n unless @sources\n\trequire_gem(\"sources\")\n\t@sources = Gem.sources\n end\n @sources\n end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def download_gem\n self.class.download_gem @name, @version\n end",
"def get_gem_names\n fetcher = Gem::SpecFetcher.fetcher\n\n list, = fetcher.available_specs(:complete)\n\n tuples = list.values.first\n\n tuples.map do |tuple,|\n tuple = tuple.to_a\n case tuple.last\n when Gem::Platform::RUBY then\n tuple[0, 2]\n else\n tuple\n end.join '-'\n end\n end",
"def name; @gem_data[\"name\"]; end",
"def installed_gems\n gems = []\n\n cmd = [attributes.gem_binary, 'list', '-l']\n cmd << '--prerelease' if attributes.prerelease\n\n run_command(cmd).stdout.each_line do |line|\n next unless /\\A([^ ]+) \\(([^\\)]+)\\)\\z/ =~ line.strip\n\n name = $1\n versions = $2.split(', ')\n gems << { name: name, versions: versions }\n end\n gems\n rescue Backend::CommandExecutionError\n []\n end",
"def gem_spec\n require 'rubygems/specification'\n spec_fields = %w(\n name author email has_rdoc rubyforge_project summary\n version description required_ruby_version homepage\n )\n Gem::Specification.new do | spec |\n for field in spec_fields\n value = self.send( field )\n spec.send( \"#{field}=\", value )\n end\n \n spec.files = package.files.to_a + %w( Rakefile Manifest.txt )\n spec.test_files = unit_tests.to_a + functional_tests.to_a\n \n spec.executables.push( *executables )\n spec.requirements.push( *requirements )\n end\n end",
"def main\n last_good_root = from_file($cache_dir + '/root.txt') ||\n from_file('config/root.txt') ||\n raise(\"Can't find root.txt\")\n\n repository = Gem::TUF::Repository.new(\n root: JSON.parse(last_good_root),\n bucket: FileCachingBucket.new(HttpBucket.new($host))\n )\n\n gem_name = ARGV.shift\n\n specs = repository.target('latest_specs.4.8.gz')\n raise \"could not find latest_specs.4.8.gz\" unless specs\n specs = unmarshal_gz specs\n gem = specs.detect {|x| x[0] == gem_name } || raise(\"Can't find gem #{gem}\")\n\n gem_with_version = \"#{gem[0]}-#{gem[1]}\"\n gem_path = \"gems/#{gem_with_version}.gem\"\n gemspec_path = \"quick/Marshal.4.8/#{gem_with_version}.gemspec.rz\"\n\n repository.target(gemspec_path)\n repository.target(gem_path)\n\n puts \"Downloaded #{gem_path} and #{gemspec_path}\"\nend",
"def gems; end",
"def gems; end",
"def gems; end",
"def fetch_gems_data\n puts \"Fetching data for...\"\n # slice 100 to avoid too many requests on RubyGems and GitHub APIs\n gems.each_slice(100) do |batch|\n each_concurrently(batch) do |gem|\n begin\n retries ||= 0\n # set verbose to true to stdout the gem name\n gem.prepare_data(verbose: true)\n # rescue SocketError, Faraday::ConnectionFailed...\n rescue StandardError\n (retries += 1) <= RETRIES ? retry : nil\n end\n end\n end\n end",
"def read_source_parts\n @source_parts ||= begin\n chunked_source = ChunkedSource.new(@source_path.open(\"r\"))\n metadata_extractor = TinyGem::MetadataExtractor.new(chunked_source, 'name' => gem_name)\n {spec: metadata_extractor.as_gemspec, library: chunked_source.library,\n readme: chunked_source.readme, executable: metadata_extractor.executable_code}\n end\n end",
"def download_gem\n self.class.download_gem @name, @version\n end",
"def memcached_gem_info\n @memcached_gem_info ||= Rails.cache.read_multi(*@gem_information.values)\n end",
"def util_read_spec(filename)\n unless Gem::VERSION >= \"2.0.0\"\n io = File.open(filename, \"rb\")\n Gem::Package.open(io, \"r\") { |x| x.metadata }\n else\n Gem::Package.new(filename).spec\n end\n end",
"def util_read_spec(filename)\n unless Gem::VERSION >= \"2.0.0\"\n io = File.open(filename, \"rb\")\n Gem::Package.open(io, \"r\") { |x| x.metadata }\n else\n Gem::Package.new(filename).spec\n end\n end",
"def add_gem_facts\n unless @path.directory?\n @result.is_gem = false\n return\n end\n \n path = gemspec_path\n \n if path.nil?\n @result.is_gem = false\n return\n end\n \n @result.is_gem = true\n @result.package.types << 'gem'\n \n gem = @result.gem = Result.new\n \n gem.gemspec_path = gemspec_path.to_s\n \n spec = Gem::Specification::load(gemspec_path.to_s)\n gem.name = spec.name\n gem.version = QB::Package::Version.from_gem_version spec.version\n end",
"def show_gems name, prerelease\n req = Gem::Requirement.default\n # TODO: deprecate for real\n dep = Gem::Deprecate.skip_during { Gem::Dependency.new name, req }\n dep.prerelease = prerelease\n\n if local? then\n if prerelease and not both? then\n alert_warning \"prereleases are always shown locally\"\n end\n\n display_header 'LOCAL'\n\n specs = Gem::Specification.find_all { |s|\n s.name =~ name and req =~ s.version\n }\n\n spec_tuples = specs.map do |spec|\n [spec.name_tuple, spec]\n end\n\n output_query_results spec_tuples\n end\n\n if remote? then\n display_header 'REMOTE'\n\n fetcher = Gem::SpecFetcher.fetcher\n\n type = if options[:all]\n if options[:prerelease]\n :complete\n else\n :released\n end\n elsif options[:prerelease]\n :prerelease\n else\n :latest\n end\n\n if name.source.empty?\n spec_tuples = fetcher.detect(type) { true }\n else\n spec_tuples = fetcher.detect(type) do |name_tuple|\n name === name_tuple.name\n end\n end\n\n output_query_results spec_tuples\n end\n end",
"def gemspec\n @gemspec ||= (\n require 'rubygems'\n ::Gem::Specification.load(gemspec_file)\n )\n end",
"def info\n fetcher = Gem::SpecFetcher.new\n\n [[\"about\", MiniReadline::DESCRIPTION],\n [\"version\", MiniReadline::VERSION],\n [\"installed\", Gem::Specification.find_all_by_name(\"mini_readline\")\n .map{|s| s.version.to_s}\n .join(\", \")],\n [\"latest\", insouciant {latest_version_for(\"mini_readline\", fetcher).to_s}],\n [\"about\", MiniTerm::DESCRIPTION],\n [\"version\", MiniTerm::VERSION],\n [\"installed\", Gem::Specification.find_all_by_name(\"mini_term\")\n .map{|s| s.version.to_s}\n .join(\", \")],\n [\"latest\", insouciant {latest_version_for(\"mini_term\", fetcher).to_s}],\n [\"platform\", MiniTerm::TERM_PLATFORM.inspect],\n [\"term type\", MiniTerm::TERM_TYPE.inspect],\n [\"columns\", MiniTerm.width.to_s],\n [\"rows\", MiniTerm.height.to_s],\n [\"code page\", if MiniTerm.windows?; (`chcp`); end],\n [\"term\", ENV['TERM']],\n [\"disp\", ENV['DISPLAY']],\n [\"edit\", ENV['EDITOR']]\n ]\n end",
"def gem(name, version)\n version = version.to_s\n\n begin\n json = open(\"https://rubygems.org/api/v1/versions/#{name}.json\") {|f| f.read}\n gems = JSON.parse(json)\n\n gem = gems.detect do |g|\n g[\"number\"] == version && g[\"platform\"] == \"ruby\"\n end\n\n if gem && gem[\"sha\"]\n # Rubygems.org was _supposed_ to provide base64 encoded SHA-256 hashes,\n # but as of now the hashes are base16 encoded...\n base16 = gem[\"sha\"]\n base32 = exec(\"nix-hash --type sha256 --to-base32 #{base16.shellescape}\")\n assert_length!(base32, 52)\n assert_format!(base32, /^[a-z0-9]+$/)\n\n base32\n end\n rescue Exception => ex\n #puts ex.message\n #puts ex.backtrace\n nil\n end\n end",
"def gems\n provisioner, version = @impl.split('-')\n get_gem_list(provisioner, version)\n end",
"def load_gemspec\n\n text = File.read(gemspec_file)\n if text =~ /\\A---/ \n require 'yaml'\n spec = YAML.load(text)\n else\n #spec = eval(text) #, gemspec_file)\n spec = ::Gem::Specification.load(gemspec_file)\n end\n\n data = {}\n data[:name] = spec.name\n data[:version] = spec.version.to_s\n data[:date] = spec.date\n\n data[:paths] = {\n 'load' => spec.require_paths \n }\n\n data[:requirements] = []\n\n spec.runtime_dependencies.each do |dep|\n req = { \n 'name' => dep.name,\n 'version' => dep.requirement.to_s\n }\n data[:requirements] << req\n end\n\n spec.development_dependencies.each do |dep|\n req = { \n 'name' => dep.name,\n 'version' => dep.requirement.to_s,\n 'development' => true\n }\n data[:requirements] << req\n end\n\n update(data)\n end",
"def to_gemspec(options={})\n require_rubygems\n\n if metadata.resources\n homepage = metadata.resources.homepage\n else\n homepage = nil\n end\n\n if homepage && md = /(\\w+).rubyforge.org/.match(homepage)\n rubyforge_project = md[1]\n else\n # b/c it has to be something according to Eric Hodel.\n rubyforge_project = metadata.name.to_s\n end\n\n #TODO: may be able to get this from project method\n if news = Dir[root + 'NEWS{,.txt}'].first\n install_message = File.read(news)\n end\n\n ::Gem::Specification.new do |spec|\n spec.name = self.name.to_s\n spec.version = self.version.to_s\n spec.require_paths = self.loadpath.to_a\n\n spec.summary = metadata.summary.to_s\n spec.description = metadata.description.to_s\n spec.authors = metadata.authors.to_a\n spec.email = metadata.email.to_s\n spec.licenses = metadata.licenses.to_a\n\n spec.homepage = metadata.homepage.to_s\n\n # -- platform --\n\n # TODO: how to handle multiple platforms?\n spec.platform = options[:platform] #|| verfile.platform #'ruby' ???\n #if metadata.platform != 'ruby'\n # spec.require_paths.concat(spec.require_paths.collect{ |d| File.join(d, platform) })\n #end\n\n # -- rubyforge project --\n\n spec.rubyforge_project = rubyforge_project\n\n # -- compiled extensions --\n\n spec.extensions = options[:extensions] || self.extensions\n\n # -- dependencies --\n\n case options[:gemfile]\n #when String\n # gemfile = root.glob(options[:gemfile]).first # TODO: Alternate gemfile\n when nil, true\n gemfile = root.glob('Gemfile').first\n else\n gemfile = nil\n end\n\n if gemfile\n require 'bundler'\n spec.add_bundler_dependencies\n else\n metadata.requirements.each do |dep|\n if dep.development?\n spec.add_development_dependency( *[dep.name, dep.constraint].compact )\n else\n next if dep.optional?\n spec.add_runtime_dependency( *[dep.name, dep.constraint].compact )\n end\n end\n end\n\n # TODO: considerations?\n #spec.requirements = options[:requirements] || package.consider\n\n # -- executables --\n\n # TODO: bin/ is a POM convention, is there are reason to do otherwise?\n spec.bindir = options[:bindir] || \"bin\"\n spec.executables = options[:executables] || self.executables\n\n # -- rdocs (argh!) --\n\n readme = root.glob_relative('README{,.*}', File::FNM_CASEFOLD).first\n extra = options[:extra_rdoc_files] || []\n\n rdocfiles = []\n rdocfiles << readme.to_s if readme\n rdocfiles.concat(extra)\n rdocfiles.uniq!\n\n rdoc_options = [] #['--inline-source']\n rdoc_options.concat [\"--title\", \"#{metadata.title} API\"] #if metadata.title\n rdoc_options.concat [\"--main\", readme.to_s] if readme\n\n spec.extra_rdoc_files = rdocfiles\n spec.rdoc_options = rdoc_options\n\n # -- distributed files --\n\n if manifest.exist?\n filelist = manifest.select{ |f| File.file?(f) }\n spec.files = filelist\n else\n spec.files = root.glob_relative(\"**/*\").map{ |f| f.to_s } # metadata.distribute ?\n end\n\n # DEPRECATED: -- test files --\n #spec.test_files = manifest.select do |f|\n # File.basename(f) =~ /test\\// && File.extname(f) == '.rb'\n #end\n\n if install_message\n spec.post_install_message = install_message\n end\n end\n\n end",
"def require_gems; end",
"def ruby_gems_fetcher\n return @ruby_gems_fetcher if defined?(@ruby_gems_fetcher)\n\n @ruby_gems_fetcher = GemsBond::Fetchers::RubyGems.new(name).tap(&:start)\n end",
"def packages\n manifest.each_with_object({}) do |(src, package_name), hsh|\n next if src.nil? || src.empty?\n hsh[package_name] ||= []\n hsh[package_name] << File.join(Licensed::Git.repository_root, src)\n end\n end",
"def load_minimal_gems\r\n end",
"def query_rubygems\n make_api_request(\"https://rubygems.org/api/v1/versions/alchemy_cms.json\")\n end",
"def download_and_extract_package\n @fetcher.get_package_file(@package_name, @version)\n Gem::Package::TarReader.new( Zlib::GzipReader.open @fetcher.temp_package_file_path ) do |tar|\n tar.each do |entry|\n next unless entry.file? and entry.full_name.match(\"DESCRIPTION\")\n @package_desc = entry.read\n end\n end\n FileUtils.rm_rf @fetcher.temp_package_file_path\n end",
"def gem_spec\n Gem::Specification.new do |s|\n s.name = package_name\n s.version = version\n s.platform = Gem::Platform::RUBY\n s.summary = summary\n s.description = description || summary\n s.author = author_name\n s.email = author_email\n s.homepage = project_url\n s.require_path = lib_dir\n s.files = package_files\n s.test_files = tests\n s.bindir = bin_dir\n s.executables = programs.map{|p| File.basename(p)}\n s.extensions = FileList['ext/**/extconf.rb']\n s.has_rdoc = true\n s.extra_rdoc_files = rdoc_files\n s.rdoc_options.concat(rdoc_options)\n s.test_files = tests\n s.rubyforge_project = rubyforge_project\n dependencies.each { |args| s.add_dependency(*args) }\n @package_configurator.call(s) if @package_configurator\n end\n end",
"def gemspec(path)\n installed_gemspec(path) || local_gemspec(path)\n end",
"def required_gem_list\n Mack::Utils::GemManager.instance.required_gem_list\n end",
"def gem(*args)\n options = args.extract_options!\n name, version = args\n\n # Set the message to be shown in logs. Uses the git repo if one is given,\n # otherwise use name (version).\n parts, message = [ name.inspect ], name\n if version ||= options.delete(:version)\n parts << version.inspect\n message << \" (#{version})\"\n end\n message = options[:git] if options[:git]\n\n log :gemfile, message\n\n parts_without_group = parts.clone\n options.each do |option, value|\n str = \"#{option}: #{value.inspect}\"\n parts << str\n parts_without_group << str unless option == :group\n end\n\n in_root do\n if options.key?(:group)\n # remove brackets if any and prepend colon if missing\n group = options[:group].inspect.scan(/[[^\\[\\]]]/).join.to_sym\n\n group_definition = \"group #{group} do\"\n str = \"gem #{parts_without_group.join(\", \")}\"\n return if append_to_gem_group(group_definition, str.gsub(/\\\"/, '\\''))\n end\n\n str = \"gem #{parts.join(\", \")}\"\n str = \" \" + str if @in_group\n str = \"\\n\" + str\n append_file \"Gemfile\", str.gsub(/\\\"/, '\\'')\n end\nend",
"def build_gem; end",
"def get_gem gem_instance_id\n check_validity\n response = api_get gem_instance_id\n if response != nil and response.key?\"gem\"\n return gem_to_note response[\"gem\"]\n else\n return nil\n end\n end",
"def latest_gemspec(rubygem)\n ::Gem.source_index.gems.values.select {|e| e.name == rubygem }.sort_by {|e| e.version }[-1]\n end",
"def private_gem(name)\n gem name, '0.3.0', git: \"https://#{ENV['GITHUB_TOKEN']}:x-oauth-basic@github.com/mharris717/#{name}.git\", branch: :master\nend",
"def gemspec(platform = 'ruby')\n Gem::Specification.load(File.expand_path('../../redcloth.gemspec', __FILE__))\nend",
"def download_gem(name, version)\n cached = GemCache.get(name, version)\n return cached unless cached.nil?\n\n client.url = \"https://rubygems.org/gems/#{name}-#{version}.gem\"\n client.follow_location = true\n client.http_get\n gemf = client.body_str\n\n GemCache.set(name, version, gemf)\n gemf\n end",
"def gemspec?; end",
"def requirements_for_gem(gem_name)\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem_name == gem_name }\n end",
"def install_gem; end",
"def load_gems(an_array_of_strings)\n\n print \"Installing gems as necessary ... \" if $debug\n gemfile do\n source 'https://rubygems.org'\n Array(an_array_of_strings).each do |gem_name|\n print gem_name + ' ' if $debug\n gem gem_name\n end\n end\n\n puts 'done' if $debug\n\nend",
"def remote_dependencies(gem_name, _version)\n conn = Faraday.new(url: 'https://rubygems.org') do |h|\n h.headers[:content_type] = 'application/x-www-form-urlencoded'\n h.request :url_encoded\n h.adapter :excon\n end\n response = conn.get(\"/api/v1/gems/#{gem_name}.json\")\n dep_list = MultiJson.load(response.body)\n dep_list['dependencies'].values.flatten.map do |j|\n Gem::Dependency.new(\n j['name'],\n Gem::Requirement.new(j['requirements'].split(','))\n )\n end\n end",
"def try_local(gem_name)\n if ENV['USE_LOCAL_GEMS']\n gem gem_name, path: \"../#{gem_name}\"\n else\n gem gem_name, github: \"omniscrapper/#{gem_name}\"\n end\nend",
"def gems\n gem_data = (project['gems'] ||= Gems::List.new)\n return gem_data if gem_data.kind_of? Gems::List\n if gem_data.kind_of? Hash\n project['gems'] = Gems::List.new(gem_data)\n save_config\n return gems\n end\n new_gems = Gems::List.new\n gem_data.each do |gem_ary|\n new_gems[gem_ary[0]] = gem_ary[1]\n end\n project['gems'] = new_gems\n save_config\n return gems\n end",
"def retrieve_version(name, version)\n path = downloaded_gem_path name, version\n parse :gem => path\n end",
"def fetch_specification(name, version)\n url = host + \"/quick/#{Configuration.marshal_identifier}\" \\\n \"/#{name}-#{version}.gemspec.rz\"\n\n http_get(url).body\n end",
"def source # :nodoc:\n Gem::Source::Installed.new\n end",
"def gems_uri\n raise NotImplementedError, not_implemented_msg(:gems_uri)\n end",
"def dependencies(gemfile)\n dependencies = { }\n\n File.open(gemfile) do |f|\n f.each do |line|\n if (line.match(/\\Agem\\s+['\"]bundler['\"]\\s*,\\s*['\"]([^'\"]+)['\"]/))\n dependencies[:bundler] = $1\n elsif (line.match(/\\A\\#\\s*rubygems\\s+(\\S+)/))\n dependencies[:rubygems] = $1\n end\n end\n end\n\n dependencies\nend",
"def build_gems; end",
"def retrieve\n return if retrieved_at && retrieved_at.utc > DateTime.now.utc - 1.hour\n \n rubygems_info = Gems.info name\n new_attributes = {\n name: rubygems_info['name'], \n version: rubygems_info['version'], \n info: rubygems_info['info'],\n retrieved_at: DateTime.now\n }\n update_attributes(new_attributes, as: :internal)\n end",
"def write_gemspec; end",
"def source\n @source ||= Gem::Source::Installed.new\n end",
"def path; Gem.ruby; end",
"def gemfile; end",
"def gemfile; end",
"def gemfile; end",
"def gemfile; end",
"def gemfile; end",
"def gemfile; end",
"def load_gem_plugins; end",
"def main\n # TODO: Check for expiry across all metadata files.\n\n last_good_root = from_file('root.txt') || get_metadata('root.txt')\n\n timestamp = get_metadata 'timestamp.txt'\n verify! timestamp, extract_keys(last_good_root, 'timestamp')\n\n release = get_hashed_metadata(\"release.txt\", timestamp['signed']['meta'])\n verify! release, extract_keys(last_good_root, 'release')\n\n # TODO: If our release hasn't changed from last known good, don't need to\n # refetch root.txt and targets.txt\n\n root = get_hashed_metadata(\"root.txt\", release['signed']['meta'])\n verify! root, extract_keys(last_good_root, \"root\")\n\n store_file 'root.txt', root\n last_good_root = root\n\n targets = get_hashed_metadata(\"targets.txt\", release['signed']['meta'])\n verify! targets, extract_keys(last_good_root, \"targets\")\n\n gem_name = ARGV[0]\n\n specs = unmarshal_gz(get_hashed_target(\"latest_specs.4.8.gz\", targets['signed']['targets']))\n\n gem = specs.detect {|x| x[0] == gem_name } || raise(\"Can't find gem #{gem}\")\n\n gem_with_version = \"#{gem[0]}-#{gem[1]}\"\n gem_path = \"gems/#{gem_with_version}.gem\"\n gemspec_path = \"quick/Marshal.4.8/#{gem_with_version}.gemspec.rz\"\n\n get_target(gemspec_path, targets['signed']['targets'])\n get_target(gem_path, targets['signed']['targets'])\n\n puts \"Downloaded #{gem_path} and #{gemspec_path}\"\nend",
"def gem_signature(gem_full_name); end",
"def set_package_info\n download_and_extract_package\n parse_package_description\n @package_hash = filter_into_package @package_desc\n @version_hash = filter_into_version @package_desc\n @author_hash = filter_into_author @package_desc[\"Author\"]\n @maintainer_hash = filter_into_author @package_desc[\"Maintainer\"]\n end",
"def yardoc_file_for_gem(gem, ver_require = T.unsafe(nil), for_writing = T.unsafe(nil)); end",
"def fetch_dependencies()\n\t\"berks vendor cookbooks #{(@debug ? '-v' : '-q')}\"\n end",
"def get_module_info(mod)\n pull_url = \"https://api.github.com/repos/puppetlabs/puppetlabs-#{mod.name}/issues?state=open&access_token=AUTHTOKEN\"\n response = HTTParty.get pull_url#, :headers=>{\"Authorization\"=>\"Token token=\\\"AUTHTOKEN\\\"\", \"User-Agent\"=>\"craig.gomes\"}\n\n\n json = JSON.parse(response.body)\n ticket_count = get_ticket_count_for_module(mod.name)\n component_count = get_component_count_for_module(mod.name)\n p mod.name\n return [\"#{mod.name}\", \"#{json.length}\",\"#{ticket_count}\",\"#{component_count}\",\"#{mod.supported}\", \"#{mod.homepage_url}\"]\n \nend",
"def gem(name, options={})\n puts \"vendoring gem #{name}\"\n if options[:git]\n in_root(\"vendor/gems\") do\n Git.clone(options[:git], options[:branch])\n end\n elsif options[:svn]\n in_root(\"vendor/gems\") do\n Svn.checkout(options[:svn], options[:branch])\n end\n else \n # TODO: Gem dependencies. Split output on \\n, iterate lines looking for Downloaded...\n in_root(\"vendor/gems\") do\n # Filename may be different than gem name\n filename = (`gem fetch #{name}`).chomp.gsub(/Downloaded /, '')\n\n `gem unpack #{filename}.gem`\n File.delete(\"#{filename}.gem\")\n end\n end\n end",
"def gem_spec\n if @gem_spec.nil?\n unless @gem_spec = Micro::Source.gem_spec(@name, @version_requirements.version)\n raise Micro::GemSpecMissingError, \"Unable to locate Gem::Specification for Gem::Dependency `#{self}'\"\n end\n end\n \n @gem_spec\n end",
"def run\n process_args\n announcements\n results = get_gem_list_info.map {|gem| gem.join(\",\")}.join(\"\\n\")\n IO.write(@output, results)\n end",
"def latest_version(name)\n return JSON.parse(open(\"http://rubygems.org/api/v1/gems/#{name}.json\").read)['version']\n end",
"def download_prog(repo_hash)\n if (repo_hash[:source] == \"github\")\n clone_repo(repo_hash)\n elsif (repo_hash[:source] == \"rubygems\")\n puts \"Unpacking gem #{repo_hash[:name]}...\"\n system \"gem unpack #{repo_hash[:name]} --version #{repo_hash[:version]}\"\n else\n raise \"Unexpected source of repo #{repo_hash[:name]}: #{repo_hash[:source]}\"\n end\nend",
"def gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem? }\n end",
"def gem_dependencies(rubygem)\n (latest = latest_gemspec(rubygem)) ?\n latest.dependencies.select {|e| e.type == :runtime }.map {|e| e.name} : []\n end",
"def fetch_spec(spec)\n spec = spec - [nil, 'ruby', '']\n spec_file_name = \"#{spec.join '-'}.gemspec.rz\"\n\n uri = URI.parse(\"#{@remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}\")\n\n spec_rz = (uri.scheme == \"file\") ? Gem.read_binary(uri.path) : fetch(uri)\n Marshal.load Gem.inflate(spec_rz)\n end",
"def get_repo_info path=\".\", shell=nil\n defaults = {:type => @scm, :url => @url, :path => path}\n\n defaults.merge self.class.get_info(path, shell)\n end",
"def import_gemspec(gemspec=nil)\n gemspec = gemspec || self.gemspec\n\n profile.name = gemspec.name\n profile.version = gemspec.version.to_s\n profile.path = gemspec.require_paths\n #metadata.engines = gemspec.platform\n\n profile.title = gemspec.name.capitalize\n profile.summary = gemspec.summary\n profile.description = gemspec.description\n profile.authors = gemspec.authors\n profile.contact = gemspec.email\n\n profile.resources.homepage = gemspec.homepage\n\n #metadata.extensions = gemspec.extensions\n\n gemspec.dependencies.each do |d|\n next unless d.type == :runtime\n requires << \"#{d.name} #{d.version_requirements}\"\n end\n end",
"def rpm_package_information\n super\n end",
"def info\n return nil unless installed?\n\n # note that if the library isn't found, we're going to do a lot of cache attempts...\n if @info_cache.nil?\n @info_cache = @backend.installed_libraries.find do |l|\n lib_info = l[\"library\"]\n Pathname.new(lib_info[\"install_dir\"]).realpath == path.realpath\n end\n end\n\n @info_cache\n end",
"def gemspec\n @gemspec ||= begin\n raise Error.new(\"Unable to automatically determine gem name from specs in #{base}. Please set the gem name via #{self.class.name}.install_tasks(gem_name: 'name')\") unless gem_name\n g = Bundler.load_gemspec(File.join(base, gem_name+'.gemspec'))\n # This is returning the path it would be in if installed normally,\n # override so we get the local path. Also for reasons that are entirely\n # beyond me, #tap makes Gem::Specification flip out so do it old-school.\n g.full_gem_path = base\n g\n end\n end",
"def initialize dep_uri = 'https://rubygems.org/api/v1/dependencies'\n super()\n\n dep_uri = URI dep_uri unless URI === dep_uri # for ruby 1.8\n\n @dep_uri = dep_uri\n @uri = dep_uri + '../..'\n\n @data = Hash.new { |h,k| h[k] = [] }\n @source = Gem::Source.new @uri\n end",
"def package_info(package_name)\n # return the package hash if it's in the brew info hash\n return brew_info[package_name] if brew_info[package_name]\n\n # check each item in the hash to see if we were passed an alias\n brew_info.each_value do |p|\n return p if p[\"full_name\"] == package_name || p[\"aliases\"].include?(package_name)\n end\n\n {}\n end",
"def gemspec_helper; end"
] |
[
"0.7005347",
"0.6759509",
"0.6674162",
"0.6654798",
"0.64056635",
"0.6361099",
"0.6296212",
"0.6260598",
"0.6250646",
"0.6250646",
"0.6250646",
"0.6250646",
"0.6250646",
"0.6250646",
"0.6250646",
"0.6250646",
"0.6243775",
"0.62309426",
"0.6191825",
"0.6189159",
"0.6166987",
"0.61512005",
"0.61400485",
"0.61400485",
"0.61400485",
"0.6125118",
"0.6086373",
"0.60846055",
"0.606888",
"0.604345",
"0.604345",
"0.60419637",
"0.6033059",
"0.60325915",
"0.60208",
"0.6005376",
"0.59897614",
"0.59781593",
"0.5936514",
"0.5924858",
"0.5910458",
"0.58844364",
"0.5873437",
"0.5869587",
"0.58679265",
"0.58626544",
"0.5847878",
"0.58469355",
"0.5841877",
"0.5824866",
"0.5824401",
"0.5817816",
"0.5814305",
"0.58116317",
"0.58065754",
"0.58048403",
"0.5799602",
"0.578551",
"0.5778658",
"0.5776374",
"0.5740457",
"0.5722218",
"0.57100385",
"0.570406",
"0.5697658",
"0.56975394",
"0.5690873",
"0.5683046",
"0.5674366",
"0.56717813",
"0.56716436",
"0.56626934",
"0.5659013",
"0.5659013",
"0.5659013",
"0.5659013",
"0.5659013",
"0.5659013",
"0.56513184",
"0.5649749",
"0.56453687",
"0.5639537",
"0.5634184",
"0.5633121",
"0.56231475",
"0.562053",
"0.5617984",
"0.5614689",
"0.56143284",
"0.5597034",
"0.5583937",
"0.5582263",
"0.55726403",
"0.5572353",
"0.55309415",
"0.5529148",
"0.5521416",
"0.55190337",
"0.55188906",
"0.5496858",
"0.5491435"
] |
0.0
|
-1
|
Retrieve latest version of gem matching dep
|
def latest_matching(dep)
version = latest_version_matching(dep)
raise RuntimeError, "no version found" if version.nil?
retrieve dep.name, version
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def latest_version_matching(dep)\n version = versions_matching(dep).collect { |v| ::Gem::Version.new v }.max\n version.nil? ? nil : version.to_s\n end",
"def latest_version(gem_name, pre: false)\n return versions(gem_name).first if pre\n versions(gem_name).find { |version| !version.prerelease? }\n end",
"def latest_version(name)\n return JSON.parse(open(\"http://rubygems.org/api/v1/gems/#{name}.json\").read)['version']\n end",
"def latest_version(module_name)\n versions(module_name).last\n end",
"def retrieve_latest(name)\n client.url = \"https://rubygems.org/api/v1/gems/#{name}.json\"\n client.http_get\n spec = client.body_str\n gem = parse spec\n gem\n end",
"def latest_gemspec(rubygem)\n ::Gem.source_index.gems.values.select {|e| e.name == rubygem }.sort_by {|e| e.version }[-1]\n end",
"def latest_version_of(name)\n remote_versions_for(name).collect { |v| ::Gem::Version.new v }.max.to_s\n end",
"def earliest_version_matching(dep)\n version = versions_matching(dep).collect { |v| ::Gem::Version.new v }.min\n version.nil? ? nil : version.to_s\n end",
"def find_latest_gem(gem_name)\n the_gem = Dir.glob(\"#{Gem.dir}/gems/#{gem_name}-*\")\n\n the_gem.empty? ? nil : the_gem.sort.last\n end",
"def earliest_matching(dep)\n version = earliest_version_matching(dep)\n raise RuntimeError, \"no version found\" if version.nil?\n retrieve dep.name, version\n end",
"def latest\n version = nil\n pkg(:list, \"-Ha\", @resource[:name]).each_line do |line|\n v = self.class.parse_line(line.chomp)[:status]\n case v\n when \"known\"\n return v\n when \"installed\"\n version = v\n when \"i--\"\n version = self.class.parse_line(line.chomp)[:version]\n else\n Puppet.warn \"unknown package state for #{@resource[:name]}: #{v}\"\n end\n end\n version\n end",
"def latest\n version = nil\n pkg(:list, \"-Ha\", @resource[:name]).each_line do |line|\n v = parse_line(line.chomp)[:status]\n case v\n when \"known\"\n return v\n when \"installed\"\n version = v\n else\n Puppet.warn \"unknown package state for #{@resource[:name]}: #{v}\"\n end\n end\n version\n end",
"def latest\n #rug can only get a list of *all* available packages?\n output = rug \"list-updates\"\n\n if output =~ /#{Regexp.escape @resource[:name]}\\s*\\|\\s*([^\\s\\|]+)/\n return $1\n else\n # rug didn't find updates, pretend the current\n # version is the latest\n return @property_hash[:ensure]\n end\n end",
"def get_latest_stable_version_details(http_response)\n versions = stable_gem_versions(http_response)\n sorted_versions = sorted_versions(versions)\n last_version_number = last_version(sorted_versions)\n find_version(versions, last_version_number)\nend",
"def latest\n output = aurget \"-Si\", @resource[:name]\n\n if output =~ /Version\\s+:\\s+(\\S+)$/\n return $1\n else\n self.err \"Could not find latest version\"\n return nil\n end\n end",
"def get_version(gem)\n lockfile_specs.find { |s| s.name == gem }&.version\n end",
"def latest\n ## make hcmbcs jump through hoops to give us latest pkg version\n begin\n output = hcmbcs \"--search\", \"--xml\", \"--package=#{self.name}\"\n rescue Puppet::ExecutionFailure\n raise Puppet::Error, \"failed hcmbcs --search\"\n end\n\n ## scan with group gives array of arrays\n version = output.scan(/<hcm_release_fq_hcm_pn>#{self.name}-([^<]+)<\\/hcm_release_fq_hcm_pn>/).last.first\n self.debug version\n\n return version\n end",
"def retrieve_version(name, version)\n path = downloaded_gem_path name, version\n parse :gem => path\n end",
"def fetch_gem(name, version)\n http_get(host + \"/gems/#{name}-#{version}.gem\").body\n end",
"def version_matching_target(dep, target)\n version = versions_in_target(dep.name, target).select { |v| dep.match? dep.name, v }\n .collect { |v| ::Gem::Version.new v }.max\n version.nil? ? nil : version.to_s\n end",
"def latest\n # Refresh package metadata before looking for latest versions\n pkg(:refresh)\n\n lines = pkg(:list, \"-Hvn\", @resource[:name]).split(\"\\n\")\n\n # remove certificate expiration warnings from the output, but report them\n cert_warnings = lines.select { |line| line =~ /^Certificate/ }\n unless cert_warnings.empty?\n Puppet.warning(_(\"pkg warning: %{warnings}\") % { warnings: cert_warnings.join(', ') })\n end\n\n lst = lines.select { |line| line !~ /^Certificate/ }.map { |line| self.class.parse_line(line) }\n\n # Now we know there is a newer version. But is that installable? (i.e are there any constraints?)\n # return the first known we find. The only way that is currently available is to do a dry run of\n # pkg update and see if could get installed (`pkg update -n res`).\n known = lst.find { |p| p[:status] == 'known' }\n if known\n options = ['-n']\n options.concat(join_options(@resource[:install_options])) if @resource[:install_options]\n return known[:ensure] if exec_cmd(command(:pkg), 'update', *options, @resource[:name])[:exit].zero?\n end\n\n # If not, then return the installed, else nil\n (lst.find {|p| p[:status] == 'installed' } || {})[:ensure]\n end",
"def get_latest_stable_version_details(http_response)\n versions = stable_gem_versions(http_response)\n sorted_versions = sorted_versions(versions)\n last_version_number = last_version(sorted_versions)\n find_version(versions, last_version_number)\n end",
"def latest_version\n self.class::Versions.max {|a, b| Ajaxlibs::VersionsTools.compare a, b}\n end",
"def latest\n url = \"https://pypi.python.org/pypi/#{URI.encode(@resource[:name])}/json\"\n result = self.open_jsonurl(url)\n result['info']['version'] if result != nil\n rescue Timeout::Error => detail\n raise Puppet::Error, \"Error in contacting pypi.python.org: #{detail}\"\n end",
"def latest\n client = XMLRPC::Client.new2(\"http://pypi.python.org/pypi\")\n client.http_header_extra = {\"Content-Type\" => \"text/xml\"}\n client.timeout = 10\n result = client.call(\"package_releases\", @resource[:name])\n result.first\n rescue Timeout::Error => detail\n raise Puppet::Error, \"Timeout while contacting pypi.python.org: #{detail}\";\n end",
"def latest\n client = XMLRPC::Client.new2(\"http://pypi.python.org/pypi\")\n client.http_header_extra = {\"Content-Type\" => \"text/xml\"}\n client.timeout = 10\n result = client.call(\"package_releases\", @resource[:name])\n result.first\n rescue Timeout::Error => detail\n raise Puppet::Error, \"Timeout while contacting pypi.python.org: #{detail}\";\n end",
"def latest\n upd = latest_info\n unless upd.nil?\n # FIXME: there could be more than one update for a package\n # because of multiarch\n return \"#{upd[:epoch]}:#{upd[:version]}-#{upd[:release]}\"\n else\n # Yum didn't find updates, pretend the current\n # version is the latest\n raise Puppet::DevError, \"Tried to get latest on a missing package\" if properties[:ensure] == :absent\n return properties[:ensure]\n end\n end",
"def latest\n upd = latest_info\n unless upd.nil?\n # FIXME: there could be more than one update for a package\n # because of multiarch\n return \"#{upd[:epoch]}:#{upd[:version]}-#{upd[:release]}\"\n else\n # Yum didn't find updates, pretend the current\n # version is the latest\n raise Puppet::DevError, \"Tried to get latest on a missing package\" if properties[:ensure] == :absent\n return properties[:ensure]\n end\n end",
"def latest\n output = npm_exec \"view #{@resource[:name]} versions\"\n output.split(/[^\\d\\.]+/).last\n end",
"def latest_version\n self.versions.order(\"revision_date DESC\").first\n end",
"def latest\n #zypper can only get a list of *all* available packages?\n output = zypper \"list-updates\"\n\n if output =~ /#{Regexp.escape @resource[:name]}\\s*\\|.*?\\|\\s*([^\\s\\|]+)/\n return $1\n else\n # zypper didn't find updates, pretend the current\n # version is the latest\n return @property_hash[:ensure]\n end\n end",
"def lastest_package_release\n self.packages.where(:latest => 1).order(:release_date => :desc).first\n end",
"def version_from_gem_lock_file\n shell_return = run_shell(\"grep -A 1 RUBY Gemfile.lock\")\n shell_return.nil? ? nil : shell_return.stdout.split(\"\\n\")[1].strip.split(\" \")[1]\n end",
"def latest_version_in_target(name, target)\n versions_in_target(name, target).collect { |v| ::Gem::Version.new v }.max\n end",
"def get_version_req(dep)\n req = get_key_or_sym(dep, :version_requirement)\n req ||= get_key_or_sym(dep, :version_range)\n req\n end",
"def latest\n args = %w{search --canonical}\n\n env, package = parse_env(@resource[:name])\n if env != nil\n args << \"-n\"\n args << \"#{env}\"\n end\n\n if @resource[:source].to_s != ''\n args << \"--channel\"\n args << @resource[:source].to_s\n args << \"--override-channels\"\n end\n\n args << \"^#{package}$\"\n\n versions = []\n command = \"#{self.class.get_conda_cmd} #{args.join(' ')}\"\n execpipe command do |process|\n process.collect do |line|\n next unless options= parse_search(line, \"py27\")\n versions << options\n end\n end\n\n return nil if versions.empty?\n # return highest version\n versions.map {|v| Gem::Version.new v}.max.to_s\n end",
"def remote_version\n rubygem_api = JSON.parse open(\"https://rubygems.org/api/v1/versions/osa.json\").read\n rubygem_api.first[\"number\"]\n rescue Exception => e\n puts \"[!] \".yellow + \" Couldn't check the latest version, please check internet connectivity.\"\n exit!\n end",
"def latest_extension_version\n versions = remove_non_semvar_versions\n versions = remove_pre_release_versions(versions)\n if versions.blank?\n # include pre-release versions\n versions = remove_non_semvar_versions\n end\n if versions.blank?\n # use the non-compliant versions as last resort\n versions = sorted_extension_versions\n end\n versions.first\n end",
"def version\n @dependency.requirement\n end",
"def latest_version\n versions.reverse_each.detect do | version|\n version_dir = SERVER_TOP_DIR + \"r#{version}\"\n path = Pathname.new(\"bin.tools\") + @s.p4ruby.basename\n if remote_file_exists?(version_dir, path)\n puts \"Found latest version: #{version}\"\n return version\n end\n end\n LAST_VALID_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 latest\n @latest ||= begin\n available = available_assets.keys.map { |key| key[/selenium-server-(\\d+\\.\\d+\\.\\d+)\\.jar/, 1] }\n available.map { |asset| Gem::Version.new(asset) }.max.to_s\n end\n end",
"def latest\n command = resource_or_provider_command\n self.class.validate_command(command)\n\n command_version = self.class.pip_version(command)\n if self.class.compare_pip_versions(command_version, '1.5.4') == -1\n available_versions_with_old_pip.last\n else\n available_versions_with_new_pip(command_version).last\n end\n end",
"def latest_version\n\t\treturn versions.order(\"number DESC\").last\n\tend",
"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 latest_version\n (Release.where(:manifest_id => manifest_id).max(:version) || 0)\n end",
"def dependency\n @dependency ||= Bundler.load.gems.find { |dep| dep.name == @name }\n end",
"def get_latest_release(project, bin)\n api_url = \"https://api.github.com/repos/#{project}/releases/latest\"\n data = URI.parse(api_url).read\n obj = JSON.parse(data)\n version = obj[\"name\"]\n sha_url = \"https://github.com/#{project}/releases/download/#{version}/#{bin}.sha256\"\n sha = URI.parse(sha_url).read\n url = \"https://github.com/#{project}/releases/download/#{version}/#{bin}\"\n sha256 = sha.split(\" \").first\n\n return url, sha256, version\nend",
"def version(gem)\n Dir.chdir(@path)\n lockfile = Bundler::LockfileParser.new(\n Bundler.read_file('Gemfile.lock')\n )\n\n lockfile.specs.each do |s|\n if s.name == gem\n return s.version\n end\n end\n raise \"Gem #{gem} not found in #{@path}\"\n end",
"def get_last_release\n r = api_get(\"/releases\")\n\n return r[0]['tag_name']\nend",
"def latest\n output = aptcache :policy, @resource[:name]\n\n if output =~ /Candidate:\\s+(\\S+)\\s/\n return $1\n else\n self.err \"Could not find latest version\"\n return nil\n end\n end",
"def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend",
"def get_latest_version(opts)\n raise NotImplementedError\n end",
"def latest_tag\n releases_url = 'https://github.com/david942j/one_gadget/releases/latest'\n @latest_tag ||= url_request(releases_url).split('/').last\n end",
"def get_gem gem_instance_id\n check_validity\n response = api_get gem_instance_id\n if response != nil and response.key?\"gem\"\n return gem_to_note response[\"gem\"]\n else\n return nil\n end\n end",
"def latest\n hash = self.class.pkglist(:justme => @resource[:name])\n hash[:avail] if hash\n end",
"def find_recommended_require_version(package)\n version = package.version\n unless package.is_dev?\n return transform_version(version, package.pretty_version, package.stability)\n end\n\n loader = ::Composer::Package::Loader::HashLoader.new(parser)\n dumper = ::Composer::Package::Dumper::HashDumper.new\n\n extra = loader.get_branch_alias(dumper.dump(package))\n if extra =~ /^(\\d+\\.\\d+\\.\\d+)(\\.9999999)-dev$/\n extra = \"#{$1}.0\"\n extra.gsub!('.9999999', '.0')\n return transform_version(extra, extra, 'dev')\n end\n\n package.pretty_version\n end",
"def find_last_repository_version(product, repository_key)\n all_available_repo = find_available_repo(product, repository_key)\n repo = all_available_repo.last[1]\n all_available_repo.delete_if { |elem| elem[1]['version'].include?('debug') }\n repo = all_available_repo.last[1] unless all_available_repo.nil?\n repo\n end",
"def bower_version(library)\n BOWER[\"dependencies\"][library] || BOWER[\"devDependencies\"][library]\nend",
"def get_latest_release_tag\n\trooturl = get_svn_repo_root()\n\treleaseurl = rooturl + \"/#{SVN_RELEASES_DIR}\"\n\t\n\ttags = svn_ls( releaseurl ).grep( RELEASE_VERSION_PATTERN ).sort_by do |tag|\n\t\ttag[RELEASE_VERSION_PATTERN].split('.').collect {|i| Integer(i) }\n\tend\n\treturn nil if tags.empty?\n\n\treturn releaseurl + '/' + tags.last\nend",
"def installed_version(i)\n p_data = package_info(i)\n\n if p_data[\"keg_only\"]\n if p_data[\"installed\"].empty?\n nil\n else\n p_data[\"installed\"].last[\"version\"]\n end\n else\n p_data[\"linked_keg\"]\n end\n end",
"def gem_version\n ::Gem::Version.new(VERSION::STRING)\n end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def updated_gemfile_requirement(req)\n return req unless latest_resolvable_version\n return req if existing_version && no_change_in_version?\n return req if !existing_version && new_version_satisfies?(req)\n\n requirements =\n req[:requirement].split(\",\").map { |r| Gem::Requirement.new(r) }\n\n new_req =\n if requirements.any?(&:exact?)\n \"= #{latest_resolvable_version}\"\n elsif requirements.any? { |r| r.to_s.start_with?(\"~>\") }\n tw_req = requirements.find { |r| r.to_s.start_with?(\"~>\") }\n update_twiddle_version(tw_req, latest_resolvable_version).to_s\n else\n update_gemfile_range(requirements).map(&:to_s).join(\", \")\n end\n\n req.merge(requirement: new_req)\n end",
"def latest_version?\n @requirement.none?\n end",
"def latest_version?\n @requirement.none?\n end",
"def find_last_repository_by_major_version(product, repository_key)\n version = SemVersionParser.parse_sem_version(product['version'])\n return nil if version.nil?\n\n find_available_repo(product, repository_key).select do |repo|\n repo[1]['sem_version'] = SemVersionParser.parse_sem_version(repo[1]['version'])\n next false if repo[1]['sem_version'].nil?\n version.each_with_index.all? { |version_part, index| version_part == repo[1]['sem_version'][index] }\n end.max do |a, b|\n a[1]['sem_version'] <=> b[1]['sem_version']\n end&.fetch(1, nil)\n end",
"def upstream_gem\n @gem ||= Polisher::Gem.from_rubygems gem_name, version\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 find_gem(name, version)\n spec = source_index.find_name(name, version).last\n unless spec and (spec.installation_path rescue nil)\n alert_error \"Could not find gem #{name} (#{version})\"\n raise Gem::GemNotFoundException, \"Could not find gem #{name}, (#{version})\"\n end\n\n return spec\n end",
"def latest_in_target(name, target)\n version = latest_version_in_target(name, target)\n raise RuntimeError, \"no matching version\" if version.nil?\n retrieve name, version\n end",
"def matching_target(dep, target)\n version = version_matching_target(dep, target)\n raise RuntimeError, \"no matching version\" if version.nil?\n retrieve dep.name, version\n end",
"def latest_version\n files.last && files.last.versionnumber\n end",
"def stable_gem_versions(http_response)\n http_response.blank? ? [] : http_response.select { |val| val['prerelease'] == false }\nend",
"def latest_version?\n if (res = _latest_version?)\n Gem.unversioned(@name)\n end\n res\n end",
"def extract_latest_version (xml)\n doc = REXML::Document.new(xml)\n\n latest = nil\n REXML::XPath.each(doc, \"/metadata/versioning/versions/version\") do |el|\n if latest.nil?\n latest = el.text\n elsif gt(latest, el.text)\n latest = el.text\n end\n end\n\n unless latest.nil? then\n latest\n else\n raise LatestVersionNotDefinedError\n end\n end",
"def latest_tag\n unless (fact_from_file = fetch_fact_from_file(__method__)).nil?\n return fact_from_file\n end\n\n `git -c versionsort.prereleaseSuffix=rc tag -l '#{Info.tag_match_pattern}' --sort=-v:refname | head -1`.chomp\n end",
"def versions name\n if @data.key?(name)\n return @data[name]\n end\n\n uri = @dep_uri + \"?gems=#{name}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n Marshal.load(str).each do |ver|\n @data[ver[:name]] << ver\n end\n\n @data[name]\n end",
"def get_version!(version)\n version.gsub!('_', '.')\n\n if version == 'latest'\n latest_extension_version\n else\n extension_versions.find_by!(version: version)\n end\n end",
"def latest_in_unit\n package_branch.latest\n end",
"def get_version!(version)\n version.gsub!(/_/, '.')\n\n if version == 'latest'\n cookbook_versions.first!\n else\n cookbook_versions.find_by!(version: version)\n end\n end",
"def available_version(i)\n p_data = package_info(i)\n\n # nothing is available\n return nil if p_data.empty?\n\n p_data[\"versions\"][\"stable\"]\n end",
"def latest\n # setting cpanm_bin_path here seems to fix the undefined local variable error\n dist_re = %r{(.*?)(\\w+-?)+((\\d+\\.?)+)\\.(\\w+\\.?)+}\n latest_dist = %x{cpanm --info #{@resource[:name]}}\n if latest_dist =~ dist_re\n $3\n else\n nil\n end\n end",
"def latest_version\n quietly {\n uri = rest.get_rest(name)['latest_version']\n\n [ version_from_uri(uri), uri ]\n }\n rescue Net::HTTPServerException => e\n if e.response.code == \"404\"\n raise CookbookNotFound, \"Cookbook '#{name}' not found at site: '#{api_uri}'\"\n else\n raise\n end\n end",
"def latest_terms_version\n TERMS_OF_SERVICE_VERSIONS.last\n end",
"def getLatestTag\n tagged_commits = @gop.tags\n harray = Array.new(tagged_commits)\n all_array = []\n harray.each do |item|\n all_array = all_array.push(@gop.describe(item, :abbrev => 0, :tags => true).slice!(1..-1))\n end\n\n all_array = all_array.sort_by(&Gem::Version.method(:new))\n\n return \"v#{all_array[-1]}\"\n end",
"def most_recent_ruby_version\n node[:rbenv][:rubies].map do |version|\n Gem::Version.new(version)\n end.sort.map(&:to_s).last\nend",
"def get_current_version(version)\n # 0 would be if we are looking for latest\n if version.to_s.eql?('0')\n Chef::Log.debug(\n 'No version filtering. Grabbing the highest version from disk',\n )\n # Current_resource.version is string.\n return Gem::Version.new(current_resource.version.max)\n else\n Chef::Log.debug(\"Grabbing the highest version of v#{version} from disk.\")\n # Grab the highest version that meets the major, minor, build given\n list = current_resource.version.map { |v| Gem::Version.new(v) }\n Chef::Log.debug(\"Installed versions found: #{list.join(', ')}\")\n\n # Reducing by version can result in nil array.\n max = reduce_by_version(list, version).max\n return max.nil? ? Gem::Version.new(0) : max\n end\n end",
"def gem_version\n Gem::Version.new VERSION\n end",
"def reverse_dependencies(rubygem)\n ::Gem.source_index.gems.values.select {|e| e.dependencies.any? {|e| e.name == rubygem && e.type == :runtime}}.\n map {|e| \"#{e.name}-#{e.version}\" }\n end",
"def latest_or_version(version_id)\n version = Version.where(id: version_id).first || self.latest_version\n end",
"def latest_version?\n if (rval = super)\n Gem.unversioned(@name)\n end\n rval\n end",
"def get_locked_dep_versions(curr_deps, gem)\n all_deps = []\n curr_specs = Bundler::LockfileParser.new(Bundler.read_file(Bundler.default_lockfile)).specs rescue []\n curr_deps.each do |curr_dep|\n found_spec = curr_specs.detect {|spec| spec.name.to_s == curr_dep.name.to_s}\n dep_to_push = OpenStruct.new\n #scope = []\n if found_spec\n dep_to_push.name = found_spec.name\n dep_to_push.version = found_spec.version\n else\n dep_to_push.name = curr_dep.name\n dep_to_push.version = curr_dep.version\n end\n dep_to_push.path = curr_dep.path\n #scope = curr_dep.groups if curr_dep.groups\n #dep_to_push.scope = scope\n\n all_deps.push(dep_to_push)\n end\n #return all_deps.map {|dep| {:name => dep.name, :version => dep.version, :scope => dep.scope}}.sort{|a, b| a[:name] <=> b[:name]}\n return all_deps.map {|dep| {:name => dep.name, :version => dep.version, :path => dep.path}}.sort{|a, b| a[:name] <=> b[:name]}\n end",
"def gem_version gem\n gem.gsub(/[^ ]* \\(([0-9.]*),?.*\\)/, \"\\\\1\")\n end",
"def stable_gem_versions(http_response)\n http_response.blank? ? [] : http_response.select { |val| val['prerelease'] == false }\n end"
] |
[
"0.8244557",
"0.7792762",
"0.76194817",
"0.7469064",
"0.74484146",
"0.73296195",
"0.7291352",
"0.71392804",
"0.70718825",
"0.70357835",
"0.70006084",
"0.6985557",
"0.6905778",
"0.6897987",
"0.68828255",
"0.6881632",
"0.6877673",
"0.68730646",
"0.6867428",
"0.6809918",
"0.6798816",
"0.67859185",
"0.67441636",
"0.6734556",
"0.6727129",
"0.6727129",
"0.6715446",
"0.6715446",
"0.6714457",
"0.67121905",
"0.67086047",
"0.6671474",
"0.6654162",
"0.6633832",
"0.6633023",
"0.6632092",
"0.6621089",
"0.66100276",
"0.6601359",
"0.65435565",
"0.65217704",
"0.6508728",
"0.65072536",
"0.6502256",
"0.6431758",
"0.6427622",
"0.6412252",
"0.63820624",
"0.6370704",
"0.6359664",
"0.63594437",
"0.63456154",
"0.6341252",
"0.6338022",
"0.63366103",
"0.6334639",
"0.6301408",
"0.62982535",
"0.6294882",
"0.6291749",
"0.62820345",
"0.6278953",
"0.62785035",
"0.62785035",
"0.62785035",
"0.62785035",
"0.62785035",
"0.62785035",
"0.6272515",
"0.6271153",
"0.6271153",
"0.6260228",
"0.62462616",
"0.6243103",
"0.62357134",
"0.62305695",
"0.6227171",
"0.61925787",
"0.61739045",
"0.6168459",
"0.61434513",
"0.61284864",
"0.6125942",
"0.61164826",
"0.61112505",
"0.61048514",
"0.60917187",
"0.6087822",
"0.60840255",
"0.60795134",
"0.60714775",
"0.606575",
"0.60624045",
"0.60623294",
"0.6054333",
"0.60516477",
"0.6050201",
"0.60455304",
"0.6043783",
"0.6034052"
] |
0.8405214
|
0
|
Retrieve earliest version of gem matching dep
|
def earliest_matching(dep)
version = earliest_version_matching(dep)
raise RuntimeError, "no version found" if version.nil?
retrieve dep.name, version
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def earliest_version_matching(dep)\n version = versions_matching(dep).collect { |v| ::Gem::Version.new v }.min\n version.nil? ? nil : version.to_s\n end",
"def latest_version_matching(dep)\n version = versions_matching(dep).collect { |v| ::Gem::Version.new v }.max\n version.nil? ? nil : version.to_s\n end",
"def latest_version(gem_name, pre: false)\n return versions(gem_name).first if pre\n versions(gem_name).find { |version| !version.prerelease? }\n end",
"def latest_matching(dep)\n version = latest_version_matching(dep)\n raise RuntimeError, \"no version found\" if version.nil?\n retrieve dep.name, version\n end",
"def get_version_req(dep)\n req = get_key_or_sym(dep, :version_requirement)\n req ||= get_key_or_sym(dep, :version_range)\n req\n end",
"def version_from_gem_lock_file\n shell_return = run_shell(\"grep -A 1 RUBY Gemfile.lock\")\n shell_return.nil? ? nil : shell_return.stdout.split(\"\\n\")[1].strip.split(\" \")[1]\n end",
"def find_recommended_require_version(package)\n version = package.version\n unless package.is_dev?\n return transform_version(version, package.pretty_version, package.stability)\n end\n\n loader = ::Composer::Package::Loader::HashLoader.new(parser)\n dumper = ::Composer::Package::Dumper::HashDumper.new\n\n extra = loader.get_branch_alias(dumper.dump(package))\n if extra =~ /^(\\d+\\.\\d+\\.\\d+)(\\.9999999)-dev$/\n extra = \"#{$1}.0\"\n extra.gsub!('.9999999', '.0')\n return transform_version(extra, extra, 'dev')\n end\n\n package.pretty_version\n end",
"def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend",
"def latest_gemspec(rubygem)\n ::Gem.source_index.gems.values.select {|e| e.name == rubygem }.sort_by {|e| e.version }[-1]\n end",
"def get_version(gem)\n lockfile_specs.find { |s| s.name == gem }&.version\n end",
"def version\n @dependency.requirement\n end",
"def latest_version(name)\n return JSON.parse(open(\"http://rubygems.org/api/v1/gems/#{name}.json\").read)['version']\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 required_rubygems_version\n spec.required_rubygems_version || Gem::Requirement.default\n end",
"def version_matching_target(dep, target)\n version = versions_in_target(dep.name, target).select { |v| dep.match? dep.name, v }\n .collect { |v| ::Gem::Version.new v }.max\n version.nil? ? nil : version.to_s\n end",
"def retrieve_latest(name)\n client.url = \"https://rubygems.org/api/v1/gems/#{name}.json\"\n client.http_get\n spec = client.body_str\n gem = parse spec\n gem\n end",
"def required_rubygems_version\n spec.required_rubygems_version\n end",
"def find_latest_gem(gem_name)\n the_gem = Dir.glob(\"#{Gem.dir}/gems/#{gem_name}-*\")\n\n the_gem.empty? ? nil : the_gem.sort.last\n end",
"def find_gem(name, version)\n spec = source_index.find_name(name, version).last\n unless spec and (spec.installation_path rescue nil)\n alert_error \"Could not find gem #{name} (#{version})\"\n raise Gem::GemNotFoundException, \"Could not find gem #{name}, (#{version})\"\n end\n\n return spec\n end",
"def required_version\n versions.find { |v| dependency.match?(name, v) } ||\n raise(Informative, \"Required version (#{dependency}) not found for `#{name}'.\\nAvailable versions: #{versions.join(', ')}\")\n end",
"def latest_extension_version\n versions = remove_non_semvar_versions\n versions = remove_pre_release_versions(versions)\n if versions.blank?\n # include pre-release versions\n versions = remove_non_semvar_versions\n end\n if versions.blank?\n # use the non-compliant versions as last resort\n versions = sorted_extension_versions\n end\n versions.first\n end",
"def upstream_gem\n @gem ||= Polisher::Gem.from_rubygems gem_name, version\n end",
"def requirement\n Gem::Requirement.new('~>' + pharos_version.segments.first(2).join('.') + (pharos_version.prerelease? ? '.0-a' : '.0'))\n end",
"def dependency\n @dependency ||= Bundler.load.gems.find { |dep| dep.name == @name }\n end",
"def get_requirement_version(package_name)\n requirement = File.read(\"requirements/#{package_name}.txt\").strip\n requirement.delete_prefix(\"#{package_name}==\")\nend",
"def updated_gemfile_requirement(req)\n return req unless latest_resolvable_version\n return req if existing_version && no_change_in_version?\n return req if !existing_version && new_version_satisfies?(req)\n\n requirements =\n req[:requirement].split(\",\").map { |r| Gem::Requirement.new(r) }\n\n new_req =\n if requirements.any?(&:exact?)\n \"= #{latest_resolvable_version}\"\n elsif requirements.any? { |r| r.to_s.start_with?(\"~>\") }\n tw_req = requirements.find { |r| r.to_s.start_with?(\"~>\") }\n update_twiddle_version(tw_req, latest_resolvable_version).to_s\n else\n update_gemfile_range(requirements).map(&:to_s).join(\", \")\n end\n\n req.merge(requirement: new_req)\n end",
"def depend_on( name, version = nil )\n spec = Gem.source_index.find_name(name).last\n version = spec.version.to_s if version.nil? and !spec.nil?\n\n PROJ.gem.dependencies << case version\n when nil; [name]\n when %r/^\\d/; [name, \">= #{version}\"]\n else [name, version] end\nend",
"def latest_version(module_name)\n versions(module_name).last\n end",
"def installed_by_version # :nodoc:\n @installed_by_version ||= Gem::Version.new(0)\n end",
"def get_latest_stable_version_details(http_response)\n versions = stable_gem_versions(http_response)\n sorted_versions = sorted_versions(versions)\n last_version_number = last_version(sorted_versions)\n find_version(versions, last_version_number)\nend",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def installed_version(i)\n p_data = package_info(i)\n\n if p_data[\"keg_only\"]\n if p_data[\"installed\"].empty?\n nil\n else\n p_data[\"installed\"].last[\"version\"]\n end\n else\n p_data[\"linked_keg\"]\n end\n end",
"def stable_gem_versions(http_response)\n http_response.blank? ? [] : http_response.select { |val| val['prerelease'] == false }\nend",
"def version(gem)\n Dir.chdir(@path)\n lockfile = Bundler::LockfileParser.new(\n Bundler.read_file('Gemfile.lock')\n )\n\n lockfile.specs.each do |s|\n if s.name == gem\n return s.version\n end\n end\n raise \"Gem #{gem} not found in #{@path}\"\n end",
"def latest_version_of(name)\n remote_versions_for(name).collect { |v| ::Gem::Version.new v }.max.to_s\n end",
"def depend_on( name, version = nil )\n spec = Gem::Specification.find_by_name(name)\n version = spec.version.to_s if version.nil? and !spec.nil?\n\n PROJ.gem.dependencies << case version\n when nil; [name]\n when %r/^\\d/; [name, \">= #{version}\"]\n else [name, version] end\nend",
"def spec(name)\n specs = if Gem::Specification.respond_to?(:each)\n Gem::Specification.find_all_by_name(name)\n else\n Gem.source_index.find_name(name)\n end\n\n spec = specs.sort_by{ |spec| Gem::Version.new(spec.version) }.first\n\n spec or raise CommandError, \"Gem `#{name}` not found\"\n end",
"def version_constraint(gem_name); end",
"def min_version\n @min_version ||= nil\n end",
"def get_latest_stable_version_details(http_response)\n versions = stable_gem_versions(http_response)\n sorted_versions = sorted_versions(versions)\n last_version_number = last_version(sorted_versions)\n find_version(versions, last_version_number)\n end",
"def find_name(gem_name, version_requirement=Version::Requirement.new(\">= 0\"))\n search(/^#{gem_name}$/, version_requirement)\n end",
"def find_name(gem_name, version_requirement=Version::Requirement.new(\">= 0\"))\n search(/^#{gem_name}$/, version_requirement)\n end",
"def stable_gem_versions(http_response)\n http_response.blank? ? [] : http_response.select { |val| val['prerelease'] == false }\n end",
"def latest\n ## make hcmbcs jump through hoops to give us latest pkg version\n begin\n output = hcmbcs \"--search\", \"--xml\", \"--package=#{self.name}\"\n rescue Puppet::ExecutionFailure\n raise Puppet::Error, \"failed hcmbcs --search\"\n end\n\n ## scan with group gives array of arrays\n version = output.scan(/<hcm_release_fq_hcm_pn>#{self.name}-([^<]+)<\\/hcm_release_fq_hcm_pn>/).last.first\n self.debug version\n\n return version\n end",
"def stable_version_file\n return sorted_files.first unless @stable_version\n\n sorted_files.select { |f| file_to_semver(f) <= SemVersion.new(@stable_version) }.first\n end",
"def oldest(bundles)\n bundles.sort {|a, b| a.version <=> b.version}.first\n end",
"def version_dependency\n source_options[:from_dependency]\n end",
"def gem_spec\n if @gem_spec.nil?\n unless @gem_spec = Micro::Source.gem_spec(@name, @version_requirements.version)\n raise Micro::GemSpecMissingError, \"Unable to locate Gem::Specification for Gem::Dependency `#{self}'\"\n end\n end\n \n @gem_spec\n end",
"def required_ruby_version\n spec.required_ruby_version || Gem::Requirement.default\n end",
"def fetch_gem(name, version)\n http_get(host + \"/gems/#{name}-#{version}.gem\").body\n end",
"def gem_version\n ::Gem::Version.new(VERSION::STRING)\n end",
"def retrieve_version(name, version)\n path = downloaded_gem_path name, version\n parse :gem => path\n end",
"def gem_if_necessary(gem)\n grep = args = nil\n if gem =~ /(.*)-(\\d+\\.\\d+\\.\\d+)$/\n gem, version = $1, $2\n grep = \"^#{gem}.*#{version}\"\n args = \" --version #{version}\"\n else\n grep = \"^#{gem}\"\n end\n if fails?(\"gem list #{gem} | grep '#{grep}'\")\n banner \"#{gem}...\"\n run \"gem install #{gem} #{args} --no-rdoc --no-ri\"\n return true\n end\n false\n end",
"def gem_version gem\n gem.gsub(/[^ ]* \\(([0-9.]*),?.*\\)/, \"\\\\1\")\n end",
"def latest\n version = nil\n pkg(:list, \"-Ha\", @resource[:name]).each_line do |line|\n v = parse_line(line.chomp)[:status]\n case v\n when \"known\"\n return v\n when \"installed\"\n version = v\n else\n Puppet.warn \"unknown package state for #{@resource[:name]}: #{v}\"\n end\n end\n version\n end",
"def specification\n Gem::Specification.find_by_name(name, requirement)\n rescue Gem::LoadError\n nil\n end",
"def latest\n # Refresh package metadata before looking for latest versions\n pkg(:refresh)\n\n lines = pkg(:list, \"-Hvn\", @resource[:name]).split(\"\\n\")\n\n # remove certificate expiration warnings from the output, but report them\n cert_warnings = lines.select { |line| line =~ /^Certificate/ }\n unless cert_warnings.empty?\n Puppet.warning(_(\"pkg warning: %{warnings}\") % { warnings: cert_warnings.join(', ') })\n end\n\n lst = lines.select { |line| line !~ /^Certificate/ }.map { |line| self.class.parse_line(line) }\n\n # Now we know there is a newer version. But is that installable? (i.e are there any constraints?)\n # return the first known we find. The only way that is currently available is to do a dry run of\n # pkg update and see if could get installed (`pkg update -n res`).\n known = lst.find { |p| p[:status] == 'known' }\n if known\n options = ['-n']\n options.concat(join_options(@resource[:install_options])) if @resource[:install_options]\n return known[:ensure] if exec_cmd(command(:pkg), 'update', *options, @resource[:name])[:exit].zero?\n end\n\n # If not, then return the installed, else nil\n (lst.find {|p| p[:status] == 'installed' } || {})[:ensure]\n end",
"def gemfile_requirement(name)\n @original_gemfile ||= IO.read('Gemfile')\n req = @original_gemfile[/gem\\s+['\"]#{name}['\"]\\s*(,[><~= \\t\\d\\.\\w'\"]*)?.*$/, 1]\n req && req.tr(\"'\", %(\")).strip.sub(/^,\\s*\"/, ', \"')\nend",
"def latest\n version = nil\n pkg(:list, \"-Ha\", @resource[:name]).each_line do |line|\n v = self.class.parse_line(line.chomp)[:status]\n case v\n when \"known\"\n return v\n when \"installed\"\n version = v\n when \"i--\"\n version = self.class.parse_line(line.chomp)[:version]\n else\n Puppet.warn \"unknown package state for #{@resource[:name]}: #{v}\"\n end\n end\n version\n end",
"def latest_stable_tag\n tags = `git tag`.strip.split(\"\\n\").map do |v|\n begin\n Semantic::Version.new(v)\n rescue ArgumentError\n nil\n end\n end.compact.sort.reverse\n (tags.find {|t| !t.pre} || tags.first).to_s\n end",
"def first_version\n find( :first, :order => 'number ASC' )\n end",
"def full_version\n return nil unless exact\n\n \"~> \".concat(version)\n end",
"def gemfile_requirement(name)\n @original_gemfile ||= IO.read('Gemfile')\n req = @original_gemfile[/gem\\s+['\"]#{name}['\"]\\s*(,[><~= \\t\\d\\.\\w'\"]*)?.*$/, 1]\n req && req.gsub(\"'\", %(\")).strip.sub(/^,\\s*\"/, ', \"')\nend",
"def bower_version(library)\n BOWER[\"dependencies\"][library] || BOWER[\"devDependencies\"][library]\nend",
"def version\n @gemspec.version || @version_helper.to_s\n end",
"def best_version(should_range)\n included_available_versions = []\n available_versions.each do |version|\n version = PIP_VERSION.parse(version)\n included_available_versions.push(version) if should_range.include?(version)\n end\n\n included_available_versions.sort!\n return included_available_versions.last unless included_available_versions.empty?\n\n Puppet.debug(\"No available version for package #{@resource[:name]} is included in range #{should_range}\")\n should_range\n end",
"def get_locked_dep_versions(curr_deps, gem)\n all_deps = []\n curr_specs = Bundler::LockfileParser.new(Bundler.read_file(Bundler.default_lockfile)).specs rescue []\n curr_deps.each do |curr_dep|\n found_spec = curr_specs.detect {|spec| spec.name.to_s == curr_dep.name.to_s}\n dep_to_push = OpenStruct.new\n #scope = []\n if found_spec\n dep_to_push.name = found_spec.name\n dep_to_push.version = found_spec.version\n else\n dep_to_push.name = curr_dep.name\n dep_to_push.version = curr_dep.version\n end\n dep_to_push.path = curr_dep.path\n #scope = curr_dep.groups if curr_dep.groups\n #dep_to_push.scope = scope\n\n all_deps.push(dep_to_push)\n end\n #return all_deps.map {|dep| {:name => dep.name, :version => dep.version, :scope => dep.scope}}.sort{|a, b| a[:name] <=> b[:name]}\n return all_deps.map {|dep| {:name => dep.name, :version => dep.version, :path => dep.path}}.sort{|a, b| a[:name] <=> b[:name]}\n end",
"def current_version\n versions.first\n end",
"def get_version!(version)\n version.gsub!(/_/, '.')\n\n if version == 'latest'\n cookbook_versions.first!\n else\n cookbook_versions.find_by!(version: version)\n end\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 get_version!(version)\n version.gsub!('_', '.')\n\n if version == 'latest'\n latest_extension_version\n else\n extension_versions.find_by!(version: version)\n end\n end",
"def get_prior_version_tag(item)\n ds = item.datastreams['versionMetadata']\n prior_version_id = (Integer(ds.current_version_id) - 1).to_s\n Dor::VersionTag.parse(ds.tag_for_version(prior_version_id))\n end",
"def find_name(gem_name, requirement = T.unsafe(nil)); end",
"def gem_version_more?(name, version)\n Gem.loaded_specs[name].version >= Gem::Version.new(version)\n end",
"def latest\n args = %w{search --canonical}\n\n env, package = parse_env(@resource[:name])\n if env != nil\n args << \"-n\"\n args << \"#{env}\"\n end\n\n if @resource[:source].to_s != ''\n args << \"--channel\"\n args << @resource[:source].to_s\n args << \"--override-channels\"\n end\n\n args << \"^#{package}$\"\n\n versions = []\n command = \"#{self.class.get_conda_cmd} #{args.join(' ')}\"\n execpipe command do |process|\n process.collect do |line|\n next unless options= parse_search(line, \"py27\")\n versions << options\n end\n end\n\n return nil if versions.empty?\n # return highest version\n versions.map {|v| Gem::Version.new v}.max.to_s\n end",
"def available_version(i)\n p_data = package_info(i)\n\n # nothing is available\n return nil if p_data.empty?\n\n p_data[\"versions\"][\"stable\"]\n end",
"def gem_installed?(gem)\n begin\n old_stderr, $stderr = $stderr, StringIO.new\n if defined?(::Gem::Specification) && ::Gem::Specification.respond_to?(:find_by_name)\n gem_spec = ::Gem::Specification.find_by_name(gem)\n else\n gem_spec = ::Gem::GemPathSearcher.new.find(gem)\n end\n gem_spec.nil? ? nil : gem_spec.version.to_s\n rescue LoadError\n nil\n ensure\n $stderr = old_stderr\n end\n end",
"def gem_version\n Gem::Version.new VERSION\n end",
"def require_gem(gem)\n dep = fetch(:required_gems)\n dep ||= []\n if gem.respond_to?(:each)\n dep += gem\n else\n dep << gem\n end\n set(:required_gems, dep)\n end",
"def local_or_remote_gem(name, options = Hash.new)\n local_path = File.expand_path(\"../vendor/#{name}\", __FILE__)\n if File.exist?(local_path)\n gem name, options.merge(:path => local_path).delete_if { |key, _| [:git, :branch].include?(key) }\n else\n gem name, options\n end\nend",
"def pkg_version_less(a, b)\n a < b\n end",
"def bower_resolve(modspec)\n mod, verspec = if modspec.kind_of?(Array)\n modspec\n else\n [modspec, '>=0.0.0']\n end\n raise DashboardException.new(\"Missing Asset Module #{mod} version #{verspec}\") if bower_packages[mod].nil?\n bower_packages[mod] # FIXME: must check for version match too!!!\n end",
"def latest_version?\n @requirement.none?\n end",
"def latest_version?\n @requirement.none?\n end",
"def latest_version\n self.class::Versions.max {|a, b| Ajaxlibs::VersionsTools.compare a, b}\n end",
"def find_last_repository_by_major_version(product, repository_key)\n version = SemVersionParser.parse_sem_version(product['version'])\n return nil if version.nil?\n\n find_available_repo(product, repository_key).select do |repo|\n repo[1]['sem_version'] = SemVersionParser.parse_sem_version(repo[1]['version'])\n next false if repo[1]['sem_version'].nil?\n version.each_with_index.all? { |version_part, index| version_part == repo[1]['sem_version'][index] }\n end.max do |a, b|\n a[1]['sem_version'] <=> b[1]['sem_version']\n end&.fetch(1, nil)\n end",
"def major_version(full_version)\n full_version.match(/^(\\d+\\.\\d+\\.\\d+)\\.\\d+$/)[1]\n end",
"def find_version\n\t\tversion_file = self.version_from\n\n\t\tunless version_file.readable?\n\t\t\tself.prompt.warn \"Version could not be read from %s\" % [ version_file ]\n\t\t\treturn nil\n\t\tend\n\n\t\tversion_line = version_file.readlines.find {|l| l =~ VERSION_PATTERN } or\n\t\t\tabort \"Can't read the VERSION from #{version_file}!\"\n\t\tversion = version_line[ VERSION_PATTERN, :version ] or\n\t\t\tabort \"Couldn't find a semantic version in %p\" % [ version_line ]\n\n\t\treturn Gem::Version.new( version )\n\tend",
"def get_path(gemname, version_req)\n return gemname if gemname =~ /\\.gem$/i\n specs = SourceIndex.from_installed_gems.search(gemname, version_req)\n selected = specs.sort_by { |s| s.version }.last\n return nil if selected.nil?\n # We expect to find (basename).gem in the 'cache' directory.\n # Furthermore, the name match must be exact (ignoring case).\n if gemname =~ /^#{selected.name}$/i\n filename = selected.full_name + '.gem'\n return File.join(Gem.dir, 'cache', filename)\n else\n return nil\n end\n end",
"def latest\n output = aurget \"-Si\", @resource[:name]\n\n if output =~ /Version\\s+:\\s+(\\S+)$/\n return $1\n else\n self.err \"Could not find latest version\"\n return nil\n end\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 spec(name, version)\n specs.select { |spec| spec[0] == name && (version.any? || spec[1] == version) }.last\n end",
"def find_gem_name(base)\n spec = Dir[File.join(base, '*.gemspec')].first\n File.basename(spec, '.gemspec') if spec\n end",
"def find(version_requirement)\n if version_requirement =~ VersionNumber::VERSION_NUMBER_REGEX\n return versions[VersionNumber.new(version_requirement)]\n end\n\n return nil unless version_requirement =~ Versions::COMPARISON_REGEX\n\n # Break the comparator (relational operator) out from the version requrement\n comparator, version_requirement = $1, VersionNumber.new($2)\n comparator = '==' if comparator == '=' # stick that in your pipe and smoke it.\n comparator = comparator.to_sym\n\n match = (versions.keys + [latest_version_number]).select do |v|\n v.send comparator, version_requirement\n end.max\n\n versions[match]\n end",
"def gem\n if dependency\n GemsBond::Gem.new(dependency)\n else\n unknown_dependency = Bundler::Dependency.new(@name, nil)\n GemsBond::Gem.new(unknown_dependency, unknown: true)\n end\n end"
] |
[
"0.88362706",
"0.7383093",
"0.72318274",
"0.6998485",
"0.69249725",
"0.6920941",
"0.6867914",
"0.67370117",
"0.6648179",
"0.6630547",
"0.6561474",
"0.64380574",
"0.6429268",
"0.6398479",
"0.63848245",
"0.6306309",
"0.6301754",
"0.6299568",
"0.62795097",
"0.62770534",
"0.62758696",
"0.62602735",
"0.6256917",
"0.62560445",
"0.62540585",
"0.6223355",
"0.6187438",
"0.617687",
"0.6168853",
"0.6166612",
"0.6151111",
"0.6151111",
"0.6151111",
"0.6151111",
"0.6151111",
"0.6151111",
"0.6136371",
"0.61289805",
"0.6112012",
"0.6098653",
"0.6094155",
"0.60902244",
"0.6072815",
"0.60698235",
"0.6069595",
"0.60662633",
"0.60662633",
"0.60580206",
"0.60530376",
"0.604373",
"0.6026763",
"0.6022184",
"0.60154015",
"0.59981",
"0.59975296",
"0.5977238",
"0.5966798",
"0.5956976",
"0.5947551",
"0.593221",
"0.5928786",
"0.5918326",
"0.5917087",
"0.5894789",
"0.58900577",
"0.5888804",
"0.58702374",
"0.58668154",
"0.5849687",
"0.58466065",
"0.58357155",
"0.5825368",
"0.5824032",
"0.5815751",
"0.5815175",
"0.58067584",
"0.5806632",
"0.58059937",
"0.5774763",
"0.57679266",
"0.57675815",
"0.5758418",
"0.57541054",
"0.57526463",
"0.5751302",
"0.57493186",
"0.57404476",
"0.57256633",
"0.57256633",
"0.57164186",
"0.5703613",
"0.5695394",
"0.5689044",
"0.5683648",
"0.568141",
"0.5670027",
"0.56699055",
"0.56697184",
"0.56641936",
"0.56541383"
] |
0.84916043
|
1
|
Retrieve gem version matching target
|
def matching_target(dep, target)
version = version_matching_target(dep, target)
raise RuntimeError, "no matching version" if version.nil?
retrieve dep.name, version
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def version_matching_target(dep, target)\n version = versions_in_target(dep.name, target).select { |v| dep.match? dep.name, v }\n .collect { |v| ::Gem::Version.new v }.max\n version.nil? ? nil : version.to_s\n end",
"def latest_version_in_target(name, target)\n versions_in_target(name, target).collect { |v| ::Gem::Version.new v }.max\n end",
"def latest_in_target(name, target)\n version = latest_version_in_target(name, target)\n raise RuntimeError, \"no matching version\" if version.nil?\n retrieve name, version\n end",
"def target_version\n if target && target.respond_to?(:root_spec)\n version = target.root_spec.version\n [version.major, version.minor, version.patch].join('.')\n else\n '1.0.0'\n end\n end",
"def target_version\n if target && target.respond_to?(:root_spec)\n version = target.root_spec.version\n [version.major, version.minor, version.patch].join('.')\n else\n '1.0.0'\n end\n end",
"def versions_in_target(name, target)\n require 'polisher/targets'\n Polisher.target(target).versions_for(name)\n end",
"def target_version\n if version_constraint\n solution = self.class.solve_for_constraint(version_constraint, versions)\n \n unless solution\n raise NoSolution, \"No cookbook version of '#{name}' found at #{self} that would satisfy constraint (#{version_constraint}).\"\n end\n\n solution\n else\n latest_version\n end\n end",
"def latest_version_matching(dep)\n version = versions_matching(dep).collect { |v| ::Gem::Version.new v }.max\n version.nil? ? nil : version.to_s\n end",
"def product_version\n options = extensions[:Middlemac].options\n options.Targets[options.Target][:ProductVersion]\n end",
"def version(target = nil)\n raw \"VERSION #{target}\".strip << \"\\r\\n\"\n end",
"def get_version(gem)\n lockfile_specs.find { |s| s.name == gem }&.version\n end",
"def version_from_gem_lock_file\n shell_return = run_shell(\"grep -A 1 RUBY Gemfile.lock\")\n shell_return.nil? ? nil : shell_return.stdout.split(\"\\n\")[1].strip.split(\" \")[1]\n end",
"def latest_version(gem_name, pre: false)\n return versions(gem_name).first if pre\n versions(gem_name).find { |version| !version.prerelease? }\n end",
"def latest_matching(dep)\n version = latest_version_matching(dep)\n raise RuntimeError, \"no version found\" if version.nil?\n retrieve dep.name, version\n end",
"def find_gem(name, version)\n spec = source_index.find_name(name, version).last\n unless spec and (spec.installation_path rescue nil)\n alert_error \"Could not find gem #{name} (#{version})\"\n raise Gem::GemNotFoundException, \"Could not find gem #{name}, (#{version})\"\n end\n\n return spec\n end",
"def target_version; end",
"def get_latest_stable_version_details(http_response)\n versions = stable_gem_versions(http_response)\n sorted_versions = sorted_versions(versions)\n last_version_number = last_version(sorted_versions)\n find_version(versions, last_version_number)\nend",
"def retrieve_version(name, version)\n path = downloaded_gem_path name, version\n parse :gem => path\n end",
"def version\n @dependency.requirement\n end",
"def remote_version\n rubygem_api = JSON.parse open(\"https://rubygems.org/api/v1/versions/osa.json\").read\n rubygem_api.first[\"number\"]\n rescue Exception => e\n puts \"[!] \".yellow + \" Couldn't check the latest version, please check internet connectivity.\"\n exit!\n end",
"def target_version=(_arg0); end",
"def get_latest_stable_version_details(http_response)\n versions = stable_gem_versions(http_response)\n sorted_versions = sorted_versions(versions)\n last_version_number = last_version(sorted_versions)\n find_version(versions, last_version_number)\n end",
"def latest_version_of(name)\n remote_versions_for(name).collect { |v| ::Gem::Version.new v }.max.to_s\n end",
"def latest_version(name)\n return JSON.parse(open(\"http://rubygems.org/api/v1/gems/#{name}.json\").read)['version']\n end",
"def latest_version(module_name)\n versions(module_name).last\n end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def 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 find_best_candidate(_package_name, _target_pkg_version = nil, _target_php_version = nil, _preferred_stability = 'stable')\n\n raise NotImplementedError\n\n # constraint = target_pkg_version ? parser.parse_constraints(target_pkg_version) : nil\n # candidates = @pool.what_provides(package_name.downcase, constraint, true)\n #\n # if target_php_version\n # php_constraint = ::Composer::Semver::Constraint::Constraint.new('==', parser.normalize(target_php_version))\n # candidates = candidates.select do |pkg|\n # requires = pkg.requires\n # return ! requires['php'].nil? || requires['php'].constraint.matches(php_constraint)\n # end\n # end\n #\n # return false unless candidates\n #\n # # select highest version if we have many\n # package = reset(candidates)\n # min_priority = ::Composer::Package::Package::stabilities[preferred_stability]\n # candidates.each do |candidate|\n # candidate_priority = candidate.stability_priority\n # current_priority = package.stability_priority\n #\n # # candidate is less stable than our preferred stability, and we have a package that is more stable than it, so we skip it\n # if min_priority < candidate_priority && current_priority < candidate_priority\n # continue\n # end\n # # candidate is more stable than our preferred stability, and current package is less stable than preferred stability, then we select the candidate always\n # if min_priority >= candidate_priority && min_priority < current_priority\n # package = candidate\n # continue\n # end\n #\n # # select highest version of the two\n # if version_compare(package.version, candidate.version, '<')\n # package = candidate\n # end\n # end\n #\n # package\n end",
"def version_dependency\n source_options[:from_dependency]\n end",
"def version_specified_gem?(node); end",
"def versions_for_targets\n versions_for_targets = []\n target_version_array.each_with_index do |target_version, i|\n if !target_version.nil?\n versions_for_targets.push(target_version)\n else\n versions_for_targets.push(nil) if allow_nils?\n end\n end\n multipackage? ? versions_for_targets : versions_for_targets[0]\n end",
"def latest_version\n versions.reverse_each.detect do | version|\n version_dir = SERVER_TOP_DIR + \"r#{version}\"\n path = Pathname.new(\"bin.tools\") + @s.p4ruby.basename\n if remote_file_exists?(version_dir, path)\n puts \"Found latest version: #{version}\"\n return version\n end\n end\n LAST_VALID_VERSION\n end",
"def latest\n args = %w{search --canonical}\n\n env, package = parse_env(@resource[:name])\n if env != nil\n args << \"-n\"\n args << \"#{env}\"\n end\n\n if @resource[:source].to_s != ''\n args << \"--channel\"\n args << @resource[:source].to_s\n args << \"--override-channels\"\n end\n\n args << \"^#{package}$\"\n\n versions = []\n command = \"#{self.class.get_conda_cmd} #{args.join(' ')}\"\n execpipe command do |process|\n process.collect do |line|\n next unless options= parse_search(line, \"py27\")\n versions << options\n end\n end\n\n return nil if versions.empty?\n # return highest version\n versions.map {|v| Gem::Version.new v}.max.to_s\n end",
"def available_versions\n the_gem_line = gem_remote_list_output.scan(/^#{name}\\s.*$/).first\n the_gem_line.scan /\\d+\\.\\d+\\.\\d+/\n end",
"def latest\n ## make hcmbcs jump through hoops to give us latest pkg version\n begin\n output = hcmbcs \"--search\", \"--xml\", \"--package=#{self.name}\"\n rescue Puppet::ExecutionFailure\n raise Puppet::Error, \"failed hcmbcs --search\"\n end\n\n ## scan with group gives array of arrays\n version = output.scan(/<hcm_release_fq_hcm_pn>#{self.name}-([^<]+)<\\/hcm_release_fq_hcm_pn>/).last.first\n self.debug version\n\n return version\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 fetch_gem(name, version)\n http_get(host + \"/gems/#{name}-#{version}.gem\").body\n end",
"def stable_gem_versions(http_response)\n http_response.blank? ? [] : http_response.select { |val| val['prerelease'] == false }\nend",
"def source_version\n Rails.cache.fetch(\"source_version_for_#{name}\", expires_in: 10.minutes) do\n begin\n p = Xmlhash.parse(ActiveXML::backend.direct_http \"/source/#{name}/#{SOURCE_VERSION_FILE}?expand=1\")\n p.get('products').get('product').get('version')\n rescue ActiveXML::Transport::NotFoundError\n nil\n end\n end\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 target_version\n config[:target_version] || Chef::VERSION\n end",
"def available_versions\n return unless @version\n the_gem_line = gem_remote_list_output.scan(/^#{name}\\s.*$/).first\n the_gem_line.scan /\\d+\\.\\d+\\.\\d+/\n end",
"def earliest_version_matching(dep)\n version = versions_matching(dep).collect { |v| ::Gem::Version.new v }.min\n version.nil? ? nil : version.to_s\n end",
"def source_version\n Rails.cache.fetch(\"source_version_for_#{name}\", expires_in: 10.minutes) do\n begin\n p = Xmlhash.parse(ActiveXML::backend.direct_http \"/source/#{name}/#{SOURCE_VERSION_FILE}\")\n p.get('products').get('product').get('version')\n rescue ActiveXML::Transport::NotFoundError\n nil\n end\n end\n end",
"def restrictive_version_specified_gem?(node); end",
"def get_gem gem_instance_id\n check_validity\n response = api_get gem_instance_id\n if response != nil and response.key?\"gem\"\n return gem_to_note response[\"gem\"]\n else\n return nil\n end\n end",
"def get_version(project)\n branch = get_release(project)\n build_file = get_github_file(project, branch, \"build-dkan.make\")\n version = build_file.scan(/\\[tag\\] = (.+)/)\n if version.to_a.length == 0\n version = build_file.scan(/\\[branch\\] = (.+)/)\n end\n version\n end",
"def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend",
"def latest\n output = aurget \"-Si\", @resource[:name]\n\n if output =~ /Version\\s+:\\s+(\\S+)$/\n return $1\n else\n self.err \"Could not find latest version\"\n return nil\n end\n end",
"def latest\n version = nil\n pkg(:list, \"-Ha\", @resource[:name]).each_line do |line|\n v = parse_line(line.chomp)[:status]\n case v\n when \"known\"\n return v\n when \"installed\"\n version = v\n else\n Puppet.warn \"unknown package state for #{@resource[:name]}: #{v}\"\n end\n end\n version\n end",
"def latest\n version = nil\n pkg(:list, \"-Ha\", @resource[:name]).each_line do |line|\n v = self.class.parse_line(line.chomp)[:status]\n case v\n when \"known\"\n return v\n when \"installed\"\n version = v\n when \"i--\"\n version = self.class.parse_line(line.chomp)[:version]\n else\n Puppet.warn \"unknown package state for #{@resource[:name]}: #{v}\"\n end\n end\n version\n end",
"def get_version_req(dep)\n req = get_key_or_sym(dep, :version_requirement)\n req ||= get_key_or_sym(dep, :version_range)\n req\n end",
"def version\n @gemspec.version || @version_helper.to_s\n end",
"def find(version_requirement)\n if version_requirement =~ VersionNumber::VERSION_NUMBER_REGEX\n return versions[VersionNumber.new(version_requirement)]\n end\n\n return nil unless version_requirement =~ Versions::COMPARISON_REGEX\n\n # Break the comparator (relational operator) out from the version requrement\n comparator, version_requirement = $1, VersionNumber.new($2)\n comparator = '==' if comparator == '=' # stick that in your pipe and smoke it.\n comparator = comparator.to_sym\n\n match = (versions.keys + [latest_version_number]).select do |v|\n v.send comparator, version_requirement\n end.max\n\n versions[match]\n end",
"def stable_gem_versions(http_response)\n http_response.blank? ? [] : http_response.select { |val| val['prerelease'] == false }\n end",
"def required_rubygems_version\n spec.required_rubygems_version\n end",
"def gem_version\n ::Gem::Version.new(VERSION::STRING)\n end",
"def latest_version\n self.class::Versions.max {|a, b| Ajaxlibs::VersionsTools.compare a, b}\n end",
"def best_version(should_range)\n included_available_versions = []\n available_versions.each do |version|\n version = PIP_VERSION.parse(version)\n included_available_versions.push(version) if should_range.include?(version)\n end\n\n included_available_versions.sort!\n return included_available_versions.last unless included_available_versions.empty?\n\n Puppet.debug(\"No available version for package #{@resource[:name]} is included in range #{should_range}\")\n should_range\n end",
"def find_recommended_require_version(package)\n version = package.version\n unless package.is_dev?\n return transform_version(version, package.pretty_version, package.stability)\n end\n\n loader = ::Composer::Package::Loader::HashLoader.new(parser)\n dumper = ::Composer::Package::Dumper::HashDumper.new\n\n extra = loader.get_branch_alias(dumper.dump(package))\n if extra =~ /^(\\d+\\.\\d+\\.\\d+)(\\.9999999)-dev$/\n extra = \"#{$1}.0\"\n extra.gsub!('.9999999', '.0')\n return transform_version(extra, extra, 'dev')\n end\n\n package.pretty_version\n end",
"def retrieve_latest(name)\n client.url = \"https://rubygems.org/api/v1/gems/#{name}.json\"\n client.http_get\n spec = client.body_str\n gem = parse spec\n gem\n end",
"def target_version_array\n @target_version_array ||=\n begin\n target_version_array = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n case action\n when :upgrade\n if version_equals?(current_version, new_version)\n # This is a short-circuit (mostly for the rubygems provider) to avoid needing to\n # expensively query the candidate_version which must come later. This only checks\n # exact matching, the check for fuzzy matching is later.\n logger.trace(\"#{new_resource} #{package_name} #{new_version} is already installed\")\n target_version_array.push(nil)\n elsif current_version.nil?\n # This is a simple check to see if we have any currently installed version at all, this is\n # safe to do before the allow_downgrade check so we check this before.\n logger.trace(\"#{new_resource} has no existing installed version. Installing install #{candidate_version}\")\n target_version_array.push(candidate_version)\n elsif !allow_downgrade && version_compare(current_version, candidate_version) == 1\n # This check for downgrading when allow_downgrade is false uses the current_version rather\n # than the magic_version since we never want to downgrade even if the constraints are not met\n # if the version is higher. This check does use the candidate_version and unlazies this so\n # there will a perf hit on idempotent use when allow_downgrade is false which is unavoidable.\n logger.trace(\"#{new_resource} #{package_name} has installed version #{current_version}, which is newer than available version #{candidate_version}. Skipping...)\")\n target_version_array.push(nil)\n elsif magic_version.nil?\n # This is the check for fuzzy matching of the installed_version, where if the installed version\n # does not match the desired version constraints (but is not an exact match) then we need to\n # install the candidate_version (this must come after the allow_downgrade check)\n logger.trace(\"#{new_resource} has an installed version that does not match the version constraint. Installing install #{candidate_version}\")\n target_version_array.push(candidate_version)\n elsif candidate_version.nil?\n # This check necessarily unlazies the candidate_version and may be expensive (connecting to\n # rubygems.org or whatever). It comes as late as possible.\n logger.trace(\"#{new_resource} #{package_name} has no candidate_version to upgrade to\")\n target_version_array.push(nil)\n elsif version_equals?(current_version, candidate_version)\n # This check sees if the candidate_version is already installed or if we should upgrade/update the\n # package. This is the normal idempotent behavior of :upgrade and is inherently expensive due to\n # unlazying the candidate_version. To prevent the perf hit the version may be specified with a full\n # version constraint. Then the cookbook can roll the version forward and use :upgrade to force version\n # pinning.\n logger.trace(\"#{new_resource} #{package_name} #{candidate_version} is already installed\")\n target_version_array.push(nil)\n else\n logger.trace(\"#{new_resource} #{package_name} is out of date, will update to #{candidate_version}\")\n target_version_array.push(candidate_version)\n end\n\n when :install\n if current_version && new_version && !allow_downgrade && version_compare(current_version, new_version) == 1\n # This is the idempotency guard for downgrades when downgrades are not allowed. This should perhaps raise\n # an exception since we were told to install an exact package version but we are silently refusing to do so\n # because a higher version is already installed. Maybe we need a flag for users to apply their preferred\n # declarative philosophy? This has to come early and outside of the two code paths below.\n logger.warn(\"#{new_resource} #{package_name} has installed version #{current_version}, which is newer than available version #{new_version}. Skipping...)\")\n target_version_array.push(nil)\n elsif new_version && !use_magic_version?\n # This is for \"non magic version using\" subclasses to do comparisons between the current_version and the\n # desired new_version. XXX: If we converted this to current_version_requirement_satisfied? and made it specific\n # to the current version check and then eliminated the magic_version, we might be able to eliminate separate codepaths\n # here, and eliminate the semantic confusion around the magic_version?\n if version_requirement_satisfied?(current_version, new_version)\n logger.trace(\"#{new_resource} #{package_name} #{current_version} satisfies #{new_version} requirement\")\n target_version_array.push(nil)\n else\n # XXX: some subclasses seem to depend on this behavior where the new_version can be different from the\n # candidate_version and we install the new_version, it seems like the candidate_version should be fixed to\n # be resolved correctly to the new_version for those providers. although it may just be unit test bugs.\n # it would be more correct to use the candidate_version here, but then it needs to be the correctly resolved\n # candidate_version against the new_version constraint.\n logger.trace(\"#{new_resource} #{package_name} #{current_version} needs updating to #{new_version}\")\n target_version_array.push(new_version)\n end\n elsif magic_version.nil?\n # This is for when we have a \"magic version using\" subclass and where the installed version does not match the\n # constraint specified in the new_version, so we need to upgrade to the candidate_version. This is the only\n # codepath in the :install branch which references the candidate_version so it is slow, but it is the path where\n # we need to do work anyway. XXX: should we check for candidate_version.nil? somewhere around here?\n logger.trace(\"#{new_resource} #{package_name} not installed, installing #{candidate_version}\")\n target_version_array.push(candidate_version)\n else\n logger.trace(\"#{new_resource} #{package_name} #{current_version} already installed\")\n target_version_array.push(nil)\n end\n\n else\n # in specs please test the public interface provider.run_action(:install) instead of provider.action_install\n raise \"internal error - target_version_array in package provider does not understand this action\"\n end\n end\n\n target_version_array\n end\n end",
"def target(version)\n exclude_unknown_version(\n AssUpdater::AssVersion.convert_array self[version]['target']\n )\n end",
"def version(engine)\n spec = bundler_specs_by_path[engine.root.realpath.to_s]\n\n case spec&.source\n when Bundler::Source::Git\n [\n spec.source.branch || spec.source.options[\"tag\"],\n spec.source.revision.presence[0, 8]\n ].compact.join(\"@\").presence\n when Bundler::Source::Path\n if engine.root.join(\".git\").exist?\n branch = sha = nil\n Dir.chdir(engine.root) do\n branch = `git rev-parse --abbrev-ref HEAD 2>/dev/null`.strip.presence\n branch = nil if branch == \"HEAD\"\n branch ||= `git describe --tags --exact-match HEAD 2>/dev/null`.strip.presence\n\n sha = `git rev-parse HEAD 2>/dev/null`.strip[0, 8].presence\n end\n\n [branch, sha].compact.join(\"@\").presence\n end\n when Bundler::Source::Rubygems\n spec.version\n end\n end",
"def find_version\n\t\tversion_file = self.version_from\n\n\t\tunless version_file.readable?\n\t\t\tself.prompt.warn \"Version could not be read from %s\" % [ version_file ]\n\t\t\treturn nil\n\t\tend\n\n\t\tversion_line = version_file.readlines.find {|l| l =~ VERSION_PATTERN } or\n\t\t\tabort \"Can't read the VERSION from #{version_file}!\"\n\t\tversion = version_line[ VERSION_PATTERN, :version ] or\n\t\t\tabort \"Couldn't find a semantic version in %p\" % [ version_line ]\n\n\t\treturn Gem::Version.new( version )\n\tend",
"def latest_gemspec(rubygem)\n ::Gem.source_index.gems.values.select {|e| e.name == rubygem }.sort_by {|e| e.version }[-1]\n end",
"def required_rubygems_version\n spec.required_rubygems_version || Gem::Requirement.default\n end",
"def gem(name, version)\n version = version.to_s\n\n begin\n json = open(\"https://rubygems.org/api/v1/versions/#{name}.json\") {|f| f.read}\n gems = JSON.parse(json)\n\n gem = gems.detect do |g|\n g[\"number\"] == version && g[\"platform\"] == \"ruby\"\n end\n\n if gem && gem[\"sha\"]\n # Rubygems.org was _supposed_ to provide base64 encoded SHA-256 hashes,\n # but as of now the hashes are base16 encoded...\n base16 = gem[\"sha\"]\n base32 = exec(\"nix-hash --type sha256 --to-base32 #{base16.shellescape}\")\n assert_length!(base32, 52)\n assert_format!(base32, /^[a-z0-9]+$/)\n\n base32\n end\n rescue Exception => ex\n #puts ex.message\n #puts ex.backtrace\n nil\n end\n end",
"def active_version(resource)\n work_link = %W(#{@workdir} #{resource}).join('/')\n return nil unless File.symlink? work_link\n\n target = File.readlink(work_link)\n target.split('/')[-2]\n end",
"def get_ai_repo_version(options)\n options = get_ai_publisherurl(options)\n if options['test'] == true || options['host-os-name'].to_s.match(/Darwin/)\n version = \"0.175.1\"\n else\n message = \"Information:\\tDetermining if available repository version from \"+options['publisherurl']\n command = \"pkg info -g #{options['publisherurl']} entire |grep Branch |awk \\\"{print \\\\\\$2}\\\"\"\n version = execute_command(options,message,command)\n version = version.chomp\n version = version.split(/\\./)[0..2].join(\".\")\n end\n return version\nend",
"def package_version(package)\n # use module version if it exists\n go_mod = package[\"Module\"]\n return go_mod[\"Version\"] if go_mod\n\n package_directory = package[\"Dir\"]\n return unless package_directory && File.exist?(package_directory)\n\n # find most recent git SHA for a package, or nil if SHA is\n # not available\n Dir.chdir package_directory do\n contents_version(*contents_version_arguments)\n end\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 version(gem)\n Dir.chdir(@path)\n lockfile = Bundler::LockfileParser.new(\n Bundler.read_file('Gemfile.lock')\n )\n\n lockfile.specs.each do |s|\n if s.name == gem\n return s.version\n end\n end\n raise \"Gem #{gem} not found in #{@path}\"\n end",
"def current_version\n versions.first\n end",
"def satisfies?(target)\n target = Version.coerce(target)\n\n return false if !version.zero? && greedy_match?(target)\n\n compare(target)\n end",
"def installed_version(i)\n p_data = package_info(i)\n\n if p_data[\"keg_only\"]\n if p_data[\"installed\"].empty?\n nil\n else\n p_data[\"installed\"].last[\"version\"]\n end\n else\n p_data[\"linked_keg\"]\n end\n end",
"def available_version(i)\n p_data = package_info(i)\n\n # nothing is available\n return nil if p_data.empty?\n\n p_data[\"versions\"][\"stable\"]\n end",
"def latest_pre_version(pe_family)\n open(\"http://getpe.delivery.puppetlabs.net/latest/#{pe_family}\").read\nend",
"def installed_version\n logger.trace(\"#{new_resource} checking package version\")\n current_installed_version\n end",
"def gem_version_more?(name, version)\n Gem.loaded_specs[name].version >= Gem::Version.new(version)\n end",
"def gem_version\n Gem::Version.new VERSION\n end",
"def version_with_support(feature)\n case feature.to_sym\n when :oidc\n Gem::Version.new('0.16.19')\n else\n Gem::Version.new('0.0.0')\n end\n end",
"def version_constraint(gem_name); end",
"def get_version_build\n version = self.peers_version\n if version[\"success\"]\n return version[\"build\"]\n else\n return nil\n end\n end",
"def get_latest_version(opts)\n raise NotImplementedError\n end",
"def requirement\n Gem::Requirement.new('~>' + pharos_version.segments.first(2).join('.') + (pharos_version.prerelease? ? '.0-a' : '.0'))\n end",
"def rpm_family_and_version\n if Pkg::Config.vanagon_project\n Pkg::Config.rpm_targets.split(' ').map do |target|\n rpm_el_family, rpm_el_version, = target.split('-')\n \"#{rpm_el_family}-#{rpm_el_version}\"\n end\n else\n Pkg::Config.final_mocks.split.map { |mock| \"#{mock_el_family(mock)}-#{mock_el_ver(mock)}\" }\n end\nend",
"def get_current_version(version)\n # 0 would be if we are looking for latest\n if version.to_s.eql?('0')\n Chef::Log.debug(\n 'No version filtering. Grabbing the highest version from disk',\n )\n # Current_resource.version is string.\n return Gem::Version.new(current_resource.version.max)\n else\n Chef::Log.debug(\"Grabbing the highest version of v#{version} from disk.\")\n # Grab the highest version that meets the major, minor, build given\n list = current_resource.version.map { |v| Gem::Version.new(v) }\n Chef::Log.debug(\"Installed versions found: #{list.join(', ')}\")\n\n # Reducing by version can result in nil array.\n max = reduce_by_version(list, version).max\n return max.nil? ? Gem::Version.new(0) : max\n end\n end",
"def spec(name, version)\n specs.select { |spec| spec[0] == name && (version.any? || spec[1] == version) }.last\n end",
"def earliest_matching(dep)\n version = earliest_version_matching(dep)\n raise RuntimeError, \"no version found\" if version.nil?\n retrieve dep.name, version\n end",
"def get_latest_release(project, bin)\n api_url = \"https://api.github.com/repos/#{project}/releases/latest\"\n data = URI.parse(api_url).read\n obj = JSON.parse(data)\n version = obj[\"name\"]\n sha_url = \"https://github.com/#{project}/releases/download/#{version}/#{bin}.sha256\"\n sha = URI.parse(sha_url).read\n url = \"https://github.com/#{project}/releases/download/#{version}/#{bin}\"\n sha256 = sha.split(\" \").first\n\n return url, sha256, version\nend",
"def get_version!(version)\n version.gsub!(/_/, '.')\n\n if version == 'latest'\n cookbook_versions.first!\n else\n cookbook_versions.find_by!(version: version)\n end\n end",
"def latest_version?\n @requirement.none?\n end",
"def latest_version?\n @requirement.none?\n end",
"def depend_on( name, version = nil )\n spec = Gem.source_index.find_name(name).last\n version = spec.version.to_s if version.nil? and !spec.nil?\n\n PROJ.gem.dependencies << case version\n when nil; [name]\n when %r/^\\d/; [name, \">= #{version}\"]\n else [name, version] end\nend"
] |
[
"0.77710587",
"0.7648248",
"0.72615856",
"0.7225043",
"0.7225043",
"0.6770758",
"0.67486954",
"0.64922297",
"0.64316857",
"0.63674563",
"0.63640505",
"0.6348724",
"0.63398993",
"0.63303256",
"0.6328526",
"0.63195586",
"0.631123",
"0.6306422",
"0.6300118",
"0.62801117",
"0.61833465",
"0.6169889",
"0.61423993",
"0.61335444",
"0.61327755",
"0.6109224",
"0.6109224",
"0.6109224",
"0.6109224",
"0.6109224",
"0.6109224",
"0.6072874",
"0.6045383",
"0.6044935",
"0.6042566",
"0.6022823",
"0.60170275",
"0.60066885",
"0.5997846",
"0.5994234",
"0.59738576",
"0.5972484",
"0.59651774",
"0.5963224",
"0.5955724",
"0.59532475",
"0.59527",
"0.5944532",
"0.59260386",
"0.5899859",
"0.5891258",
"0.5891069",
"0.5890748",
"0.5887189",
"0.5879666",
"0.5869656",
"0.5860953",
"0.5854353",
"0.5838005",
"0.58335775",
"0.58245873",
"0.5797142",
"0.57961917",
"0.5790906",
"0.5790861",
"0.5780872",
"0.57794577",
"0.5762464",
"0.5754803",
"0.57538253",
"0.5750423",
"0.5748811",
"0.57402766",
"0.5727247",
"0.5724859",
"0.57228297",
"0.57158595",
"0.5709788",
"0.570703",
"0.5704088",
"0.5701437",
"0.569792",
"0.5684617",
"0.5677962",
"0.5654354",
"0.565157",
"0.5647639",
"0.56418014",
"0.56402266",
"0.5640116",
"0.563531",
"0.56256557",
"0.5623776",
"0.5622329",
"0.56210333",
"0.56156063",
"0.5613354",
"0.5612892",
"0.5612892",
"0.5608636"
] |
0.7471806
|
2
|
Retrieve version of gem matching dep and specifier
|
def matching(dep, specifier)
case specifier
when LATEST_SPECIFIER
latest_matching(dep)
when EARLIEST_SPECIFIER
earliest_matching(dep)
else
matching_target(dep, specifier)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def latest_version_matching(dep)\n version = versions_matching(dep).collect { |v| ::Gem::Version.new v }.max\n version.nil? ? nil : version.to_s\n end",
"def get_version_req(dep)\n req = get_key_or_sym(dep, :version_requirement)\n req ||= get_key_or_sym(dep, :version_range)\n req\n end",
"def latest_matching(dep)\n version = latest_version_matching(dep)\n raise RuntimeError, \"no version found\" if version.nil?\n retrieve dep.name, version\n end",
"def get_version(gem)\n lockfile_specs.find { |s| s.name == gem }&.version\n end",
"def earliest_version_matching(dep)\n version = versions_matching(dep).collect { |v| ::Gem::Version.new v }.min\n version.nil? ? nil : version.to_s\n end",
"def retrieve_version(name, version)\n path = downloaded_gem_path name, version\n parse :gem => path\n end",
"def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend",
"def version\n @dependency.requirement\n end",
"def fetch_gem(name, version)\n http_get(host + \"/gems/#{name}-#{version}.gem\").body\n end",
"def latest_version(gem_name, pre: false)\n return versions(gem_name).first if pre\n versions(gem_name).find { |version| !version.prerelease? }\n end",
"def find_name(gem_name, version_requirement=Version::Requirement.new(\">= 0\"))\n search(/^#{gem_name}$/, version_requirement)\n end",
"def find_name(gem_name, version_requirement=Version::Requirement.new(\">= 0\"))\n search(/^#{gem_name}$/, version_requirement)\n end",
"def version_matching_target(dep, target)\n version = versions_in_target(dep.name, target).select { |v| dep.match? dep.name, v }\n .collect { |v| ::Gem::Version.new v }.max\n version.nil? ? nil : version.to_s\n end",
"def earliest_matching(dep)\n version = earliest_version_matching(dep)\n raise RuntimeError, \"no version found\" if version.nil?\n retrieve dep.name, version\n end",
"def version\n @gemspec.version || @version_helper.to_s\n end",
"def version_from_gem_lock_file\n shell_return = run_shell(\"grep -A 1 RUBY Gemfile.lock\")\n shell_return.nil? ? nil : shell_return.stdout.split(\"\\n\")[1].strip.split(\" \")[1]\n end",
"def latest_version(name)\n return JSON.parse(open(\"http://rubygems.org/api/v1/gems/#{name}.json\").read)['version']\n end",
"def find_recommended_require_version(package)\n version = package.version\n unless package.is_dev?\n return transform_version(version, package.pretty_version, package.stability)\n end\n\n loader = ::Composer::Package::Loader::HashLoader.new(parser)\n dumper = ::Composer::Package::Dumper::HashDumper.new\n\n extra = loader.get_branch_alias(dumper.dump(package))\n if extra =~ /^(\\d+\\.\\d+\\.\\d+)(\\.9999999)-dev$/\n extra = \"#{$1}.0\"\n extra.gsub!('.9999999', '.0')\n return transform_version(extra, extra, 'dev')\n end\n\n package.pretty_version\n end",
"def gem_spec\n if @gem_spec.nil?\n unless @gem_spec = Micro::Source.gem_spec(@name, @version_requirements.version)\n raise Micro::GemSpecMissingError, \"Unable to locate Gem::Specification for Gem::Dependency `#{self}'\"\n end\n end\n \n @gem_spec\n end",
"def find_gem(name, version)\n spec = source_index.find_name(name, version).last\n unless spec and (spec.installation_path rescue nil)\n alert_error \"Could not find gem #{name} (#{version})\"\n raise Gem::GemNotFoundException, \"Could not find gem #{name}, (#{version})\"\n end\n\n return spec\n end",
"def version(gem)\n Dir.chdir(@path)\n lockfile = Bundler::LockfileParser.new(\n Bundler.read_file('Gemfile.lock')\n )\n\n lockfile.specs.each do |s|\n if s.name == gem\n return s.version\n end\n end\n raise \"Gem #{gem} not found in #{@path}\"\n end",
"def gem_version\n ::Gem::Version.new(VERSION::STRING)\n end",
"def gem_version gem\n gem.gsub(/[^ ]* \\(([0-9.]*),?.*\\)/, \"\\\\1\")\n end",
"def depend_on( name, version = nil )\n spec = Gem::Specification.find_by_name(name)\n version = spec.version.to_s if version.nil? and !spec.nil?\n\n PROJ.gem.dependencies << case version\n when nil; [name]\n when %r/^\\d/; [name, \">= #{version}\"]\n else [name, version] end\nend",
"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 spec(name)\n specs = if Gem::Specification.respond_to?(:each)\n Gem::Specification.find_all_by_name(name)\n else\n Gem.source_index.find_name(name)\n end\n\n spec = specs.sort_by{ |spec| Gem::Version.new(spec.version) }.first\n\n spec or raise CommandError, \"Gem `#{name}` not found\"\n end",
"def get_latest_stable_version_details(http_response)\n versions = stable_gem_versions(http_response)\n sorted_versions = sorted_versions(versions)\n last_version_number = last_version(sorted_versions)\n find_version(versions, last_version_number)\nend",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def retrieve_latest(name)\n client.url = \"https://rubygems.org/api/v1/gems/#{name}.json\"\n client.http_get\n spec = client.body_str\n gem = parse spec\n gem\n end",
"def specification\n Gem::Specification.find_by_name(name, requirement)\n rescue Gem::LoadError\n nil\n end",
"def latest_gemspec(rubygem)\n ::Gem.source_index.gems.values.select {|e| e.name == rubygem }.sort_by {|e| e.version }[-1]\n end",
"def component_version(cmp)\n component_cmake_vars(cmp)['PACKAGE_VERSION']\nend",
"def spec(name, version)\n specs.select { |spec| spec[0] == name && (version.any? || spec[1] == version) }.last\n end",
"def required_rubygems_version\n spec.required_rubygems_version\n end",
"def versions name\n if @data.key?(name)\n return @data[name]\n end\n\n uri = @dep_uri + \"?gems=#{name}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n Marshal.load(str).each do |ver|\n @data[ver[:name]] << ver\n end\n\n @data[name]\n end",
"def dependency\n @dependency ||= Bundler.load.gems.find { |dep| dep.name == @name }\n end",
"def depend_on( name, version = nil )\n spec = Gem.source_index.find_name(name).last\n version = spec.version.to_s if version.nil? and !spec.nil?\n\n PROJ.gem.dependencies << case version\n when nil; [name]\n when %r/^\\d/; [name, \">= #{version}\"]\n else [name, version] end\nend",
"def find_name(gem_name, requirement = T.unsafe(nil)); end",
"def bower_resolve(modspec)\n mod, verspec = if modspec.kind_of?(Array)\n modspec\n else\n [modspec, '>=0.0.0']\n end\n raise DashboardException.new(\"Missing Asset Module #{mod} version #{verspec}\") if bower_packages[mod].nil?\n bower_packages[mod] # FIXME: must check for version match too!!!\n end",
"def required_rubygems_version\n spec.required_rubygems_version || Gem::Requirement.default\n end",
"def version_constraint(gem_name); end",
"def bower_version(library)\n BOWER[\"dependencies\"][library] || BOWER[\"devDependencies\"][library]\nend",
"def requirement\n Gem::Requirement.new('~>' + pharos_version.segments.first(2).join('.') + (pharos_version.prerelease? ? '.0-a' : '.0'))\n end",
"def matching_target(dep, target)\n version = version_matching_target(dep, target)\n raise RuntimeError, \"no matching version\" if version.nil?\n retrieve dep.name, version\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 get_gem gem_instance_id\n check_validity\n response = api_get gem_instance_id\n if response != nil and response.key?\"gem\"\n return gem_to_note response[\"gem\"]\n else\n return nil\n end\n end",
"def versions name # :nodoc:\n if @data.key?(name)\n return @data[name]\n end\n\n uri = @dep_uri + \"?gems=#{name}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n Marshal.load(str).each do |ver|\n @data[ver[:name]] << ver\n end\n\n @data[name]\n end",
"def gem_spec(name, version)\n if spec = spec(name, version)\n BareSpecification.new(self, name, spec[1]).gem_spec\n end\n end",
"def get_latest_stable_version_details(http_response)\n versions = stable_gem_versions(http_response)\n sorted_versions = sorted_versions(versions)\n last_version_number = last_version(sorted_versions)\n find_version(versions, last_version_number)\n end",
"def show_gems name, prerelease\n req = Gem::Requirement.default\n # TODO: deprecate for real\n dep = Gem::Deprecate.skip_during { Gem::Dependency.new name, req }\n dep.prerelease = prerelease\n\n if local? then\n if prerelease and not both? then\n alert_warning \"prereleases are always shown locally\"\n end\n\n display_header 'LOCAL'\n\n specs = Gem::Specification.find_all { |s|\n s.name =~ name and req =~ s.version\n }\n\n spec_tuples = specs.map do |spec|\n [spec.name_tuple, spec]\n end\n\n output_query_results spec_tuples\n end\n\n if remote? then\n display_header 'REMOTE'\n\n fetcher = Gem::SpecFetcher.fetcher\n\n type = if options[:all]\n if options[:prerelease]\n :complete\n else\n :released\n end\n elsif options[:prerelease]\n :prerelease\n else\n :latest\n end\n\n if name.source.empty?\n spec_tuples = fetcher.detect(type) { true }\n else\n spec_tuples = fetcher.detect(type) do |name_tuple|\n name === name_tuple.name\n end\n end\n\n output_query_results spec_tuples\n end\n end",
"def fetch_specification(name, version)\n url = host + \"/quick/#{Configuration.marshal_identifier}\" \\\n \"/#{name}-#{version}.gemspec.rz\"\n\n http_get(url).body\n end",
"def available_versions\n the_gem_line = gem_remote_list_output.scan(/^#{name}\\s.*$/).first\n the_gem_line.scan /\\d+\\.\\d+\\.\\d+/\n end",
"def gem_version_more?(name, version)\n Gem.loaded_specs[name].version >= Gem::Version.new(version)\n end",
"def get_requirement_version(package_name)\n requirement = File.read(\"requirements/#{package_name}.txt\").strip\n requirement.delete_prefix(\"#{package_name}==\")\nend",
"def available_version(i)\n p_data = package_info(i)\n\n # nothing is available\n return nil if p_data.empty?\n\n p_data[\"versions\"][\"stable\"]\n end",
"def parse_gem_version(gem_version)\n return if gem_version.blank? || gem_version == 'stable'\n Versionomy.parse(gem_version)\nrescue Versionomy::Errors::ParseError\n return nil\nend",
"def gem_installed?(gem)\n begin\n old_stderr, $stderr = $stderr, StringIO.new\n if defined?(::Gem::Specification) && ::Gem::Specification.respond_to?(:find_by_name)\n gem_spec = ::Gem::Specification.find_by_name(gem)\n else\n gem_spec = ::Gem::GemPathSearcher.new.find(gem)\n end\n gem_spec.nil? ? nil : gem_spec.version.to_s\n rescue LoadError\n nil\n ensure\n $stderr = old_stderr\n end\n end",
"def gem(name, version)\n version = version.to_s\n\n begin\n json = open(\"https://rubygems.org/api/v1/versions/#{name}.json\") {|f| f.read}\n gems = JSON.parse(json)\n\n gem = gems.detect do |g|\n g[\"number\"] == version && g[\"platform\"] == \"ruby\"\n end\n\n if gem && gem[\"sha\"]\n # Rubygems.org was _supposed_ to provide base64 encoded SHA-256 hashes,\n # but as of now the hashes are base16 encoded...\n base16 = gem[\"sha\"]\n base32 = exec(\"nix-hash --type sha256 --to-base32 #{base16.shellescape}\")\n assert_length!(base32, 52)\n assert_format!(base32, /^[a-z0-9]+$/)\n\n base32\n end\n rescue Exception => ex\n #puts ex.message\n #puts ex.backtrace\n nil\n end\n end",
"def puppet_gem_version\n Gem::Version.create(puppet_version.split(' ').first.strip.gsub('-', '.'))\n end",
"def parse_gem_version(gem_version)\n return if gem_version.blank? || gem_version == 'stable'\n Versionomy.parse(gem_version)\n rescue Versionomy::Errors::ParseError\n nil\n end",
"def gem_if_necessary(gem)\n grep = args = nil\n if gem =~ /(.*)-(\\d+\\.\\d+\\.\\d+)$/\n gem, version = $1, $2\n grep = \"^#{gem}.*#{version}\"\n args = \" --version #{version}\"\n else\n grep = \"^#{gem}\"\n end\n if fails?(\"gem list #{gem} | grep '#{grep}'\")\n banner \"#{gem}...\"\n run \"gem install #{gem} #{args} --no-rdoc --no-ri\"\n return true\n end\n false\n end",
"def gem_version\n Gem::Version.new VERSION\n end",
"def version_specified_gem?(node); 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 versions_for(gem)\n versions_hash[gem].map { |version| version[1] }\n end",
"def gem_name\n @specification.name\n end",
"def available_versions\n return unless @version\n the_gem_line = gem_remote_list_output.scan(/^#{name}\\s.*$/).first\n the_gem_line.scan /\\d+\\.\\d+\\.\\d+/\n end",
"def required_version\n versions.find { |v| dependency.match?(name, v) } ||\n raise(Informative, \"Required version (#{dependency}) not found for `#{name}'.\\nAvailable versions: #{versions.join(', ')}\")\n end",
"def component_versions(cmp)\n component_build_vars(cmp)['PACKAGE_VERSIONS']\nend",
"def latest_version(module_name)\n versions(module_name).last\n end",
"def get_version!(version)\n version.gsub!('_', '.')\n\n if version == 'latest'\n latest_extension_version\n else\n extension_versions.find_by!(version: version)\n end\n end",
"def stable_gem_versions(http_response)\n http_response.blank? ? [] : http_response.select { |val| val['prerelease'] == false }\nend",
"def latest_version_of(name)\n remote_versions_for(name).collect { |v| ::Gem::Version.new v }.max.to_s\n end",
"def spec\n @spec ||= Gem::Specification.find do |spec|\n spec.name == @name and spec.version == @version\n end\n\n @spec ||= Gem::Specification.new do |s|\n s.name = @name\n s.version = @version\n s.platform = @platform\n\n s.dependencies.concat @dependencies\n end\n end",
"def get_version!(version)\n version.gsub!(/_/, '.')\n\n if version == 'latest'\n cookbook_versions.first!\n else\n cookbook_versions.find_by!(version: version)\n end\n end",
"def load_spec(name, version, platform, source) # :nodoc:\n dep = Gem::Dependency.new name, version\n\n found = @specs.find do |spec|\n dep.matches_spec? spec and spec.platform == platform\n end\n\n tuple = Gem::NameTuple.new found.name, found.version, found.platform\n\n found.source.fetch_spec tuple\n end",
"def installed_version(i)\n p_data = package_info(i)\n\n if p_data[\"keg_only\"]\n if p_data[\"installed\"].empty?\n nil\n else\n p_data[\"installed\"].last[\"version\"]\n end\n else\n p_data[\"linked_keg\"]\n end\n end",
"def gem_version_str(gem)\n return '' unless gem.version\n\n # \"#{gem.version ? \", '#{gem.version}'\" : ''}\"\n \", '#{gem.version}'\"\nend",
"def remote_version\n rubygem_api = JSON.parse open(\"https://rubygems.org/api/v1/versions/osa.json\").read\n rubygem_api.first[\"number\"]\n rescue Exception => e\n puts \"[!] \".yellow + \" Couldn't check the latest version, please check internet connectivity.\"\n exit!\n end",
"def restrictive_version_specified_gem?(node); end",
"def updated_gemfile_requirement(req)\n return req unless latest_resolvable_version\n return req if existing_version && no_change_in_version?\n return req if !existing_version && new_version_satisfies?(req)\n\n requirements =\n req[:requirement].split(\",\").map { |r| Gem::Requirement.new(r) }\n\n new_req =\n if requirements.any?(&:exact?)\n \"= #{latest_resolvable_version}\"\n elsif requirements.any? { |r| r.to_s.start_with?(\"~>\") }\n tw_req = requirements.find { |r| r.to_s.start_with?(\"~>\") }\n update_twiddle_version(tw_req, latest_resolvable_version).to_s\n else\n update_gemfile_range(requirements).map(&:to_s).join(\", \")\n end\n\n req.merge(requirement: new_req)\n end",
"def latest\n ## make hcmbcs jump through hoops to give us latest pkg version\n begin\n output = hcmbcs \"--search\", \"--xml\", \"--package=#{self.name}\"\n rescue Puppet::ExecutionFailure\n raise Puppet::Error, \"failed hcmbcs --search\"\n end\n\n ## scan with group gives array of arrays\n version = output.scan(/<hcm_release_fq_hcm_pn>#{self.name}-([^<]+)<\\/hcm_release_fq_hcm_pn>/).last.first\n self.debug version\n\n return version\n end",
"def gem\n if dependency\n GemsBond::Gem.new(dependency)\n else\n unknown_dependency = Bundler::Dependency.new(@name, nil)\n GemsBond::Gem.new(unknown_dependency, unknown: true)\n end\n end",
"def gem_dep_matches?(what, version, *deps)\n # always match if we have no chef_version at all\n return true unless deps.length > 0\n\n # match if we match any of the chef_version lines\n deps.any? { |dep| dep.match?(what, version) }\n end",
"def find(version_requirement)\n if version_requirement =~ VersionNumber::VERSION_NUMBER_REGEX\n return versions[VersionNumber.new(version_requirement)]\n end\n\n return nil unless version_requirement =~ Versions::COMPARISON_REGEX\n\n # Break the comparator (relational operator) out from the version requrement\n comparator, version_requirement = $1, VersionNumber.new($2)\n comparator = '==' if comparator == '=' # stick that in your pipe and smoke it.\n comparator = comparator.to_sym\n\n match = (versions.keys + [latest_version_number]).select do |v|\n v.send comparator, version_requirement\n end.max\n\n versions[match]\n end",
"def find_dependency_versions(dependency)\n versions = []\n specs = Dir[File.join(gem_dir, 'specifications', \"#{dependency.name}-*.gemspec\")]\n unless specs.empty?\n specs.inject(versions) do |versions, gemspec_path|\n versions << gemspec_path[/-([\\d\\.]+)\\.gemspec$/, 1]\n end\n end\n versions.sort.reverse\n end",
"def version_with_support(feature)\n case feature.to_sym\n when :oidc\n Gem::Version.new('0.16.19')\n else\n Gem::Version.new('0.0.0')\n end\n end",
"def gem(name, version = Gem::Requirement.default)\n @gems ||= {}\n @gems[name] = version\n end",
"def find_version\n\t\tversion_file = self.version_from\n\n\t\tunless version_file.readable?\n\t\t\tself.prompt.warn \"Version could not be read from %s\" % [ version_file ]\n\t\t\treturn nil\n\t\tend\n\n\t\tversion_line = version_file.readlines.find {|l| l =~ VERSION_PATTERN } or\n\t\t\tabort \"Can't read the VERSION from #{version_file}!\"\n\t\tversion = version_line[ VERSION_PATTERN, :version ] or\n\t\t\tabort \"Couldn't find a semantic version in %p\" % [ version_line ]\n\n\t\treturn Gem::Version.new( version )\n\tend",
"def v string\n Gem::Version.create string\n end",
"def v string\n Gem::Version.create string\n end",
"def version_dependency\n source_options[:from_dependency]\n end",
"def stable_gem_versions(http_response)\n http_response.blank? ? [] : http_response.select { |val| val['prerelease'] == false }\n end",
"def latest\n version = nil\n pkg(:list, \"-Ha\", @resource[:name]).each_line do |line|\n v = self.class.parse_line(line.chomp)[:status]\n case v\n when \"known\"\n return v\n when \"installed\"\n version = v\n when \"i--\"\n version = self.class.parse_line(line.chomp)[:version]\n else\n Puppet.warn \"unknown package state for #{@resource[:name]}: #{v}\"\n end\n end\n version\n end",
"def available_version(package_name, arch = nil)\n version(package_name, arch, true, false)\n end",
"def version_string(dependency, is_purl_version = false)\n # If the dependency is specified in a unlocked dependency file and an absolute version\n # is needed for the purl return empty\n if dependency[:dependency_file] == self.class::UNLOCKED_DEPENDENCY_FILE && is_purl_version\n return \"\"\n end\n\n dependency[:version]\n end"
] |
[
"0.73891175",
"0.7324341",
"0.7212548",
"0.7115163",
"0.7008669",
"0.70082515",
"0.69223344",
"0.68237895",
"0.6801502",
"0.67808264",
"0.6700113",
"0.6700113",
"0.6687725",
"0.6654289",
"0.66480625",
"0.66310465",
"0.6622294",
"0.66155773",
"0.6593339",
"0.65726244",
"0.6545284",
"0.65273625",
"0.6509717",
"0.64650774",
"0.6433588",
"0.6423149",
"0.6385819",
"0.63857824",
"0.63857824",
"0.63857824",
"0.63857824",
"0.63857824",
"0.63857824",
"0.6384523",
"0.6374994",
"0.63719845",
"0.63508457",
"0.6342928",
"0.63393265",
"0.6333963",
"0.6329207",
"0.631591",
"0.6312118",
"0.6308466",
"0.6296801",
"0.62892",
"0.62752223",
"0.62393665",
"0.6229934",
"0.62279576",
"0.62255454",
"0.6222548",
"0.62218034",
"0.6202405",
"0.6189719",
"0.6164779",
"0.61543137",
"0.6138359",
"0.6137285",
"0.61283267",
"0.61228704",
"0.6111455",
"0.61102766",
"0.608857",
"0.6087323",
"0.6084837",
"0.6082555",
"0.6073223",
"0.6056578",
"0.6054495",
"0.60449237",
"0.60386574",
"0.60311836",
"0.60288286",
"0.6027825",
"0.60150445",
"0.6013708",
"0.6007145",
"0.5992561",
"0.5983743",
"0.5962266",
"0.5960225",
"0.59598124",
"0.59477144",
"0.5942744",
"0.5935822",
"0.5926888",
"0.591516",
"0.5897951",
"0.5892139",
"0.5858736",
"0.5854306",
"0.5852875",
"0.5843885",
"0.58435845",
"0.58435845",
"0.5839631",
"0.58371985",
"0.58285177",
"0.5821414",
"0.5818185"
] |
0.0
|
-1
|
Retrieve latest version of gem in target
|
def latest_in_target(name, target)
version = latest_version_in_target(name, target)
raise RuntimeError, "no matching version" if version.nil?
retrieve name, version
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def latest_version_in_target(name, target)\n versions_in_target(name, target).collect { |v| ::Gem::Version.new v }.max\n end",
"def latest_version(module_name)\n versions(module_name).last\n end",
"def latest_version(gem_name, pre: false)\n return versions(gem_name).first if pre\n versions(gem_name).find { |version| !version.prerelease? }\n end",
"def latest_matching(dep)\n version = latest_version_matching(dep)\n raise RuntimeError, \"no version found\" if version.nil?\n retrieve dep.name, version\n end",
"def latest_version(name)\n return JSON.parse(open(\"http://rubygems.org/api/v1/gems/#{name}.json\").read)['version']\n end",
"def latest_version_of(name)\n remote_versions_for(name).collect { |v| ::Gem::Version.new v }.max.to_s\n end",
"def latest_version\n versions.reverse_each.detect do | version|\n version_dir = SERVER_TOP_DIR + \"r#{version}\"\n path = Pathname.new(\"bin.tools\") + @s.p4ruby.basename\n if remote_file_exists?(version_dir, path)\n puts \"Found latest version: #{version}\"\n return version\n end\n end\n LAST_VALID_VERSION\n end",
"def latest_version\n self.class::Versions.max {|a, b| Ajaxlibs::VersionsTools.compare a, b}\n end",
"def latest\n output = aurget \"-Si\", @resource[:name]\n\n if output =~ /Version\\s+:\\s+(\\S+)$/\n return $1\n else\n self.err \"Could not find latest version\"\n return nil\n end\n end",
"def retrieve_latest(name)\n client.url = \"https://rubygems.org/api/v1/gems/#{name}.json\"\n client.http_get\n spec = client.body_str\n gem = parse spec\n gem\n end",
"def latest\n ## make hcmbcs jump through hoops to give us latest pkg version\n begin\n output = hcmbcs \"--search\", \"--xml\", \"--package=#{self.name}\"\n rescue Puppet::ExecutionFailure\n raise Puppet::Error, \"failed hcmbcs --search\"\n end\n\n ## scan with group gives array of arrays\n version = output.scan(/<hcm_release_fq_hcm_pn>#{self.name}-([^<]+)<\\/hcm_release_fq_hcm_pn>/).last.first\n self.debug version\n\n return version\n end",
"def version_matching_target(dep, target)\n version = versions_in_target(dep.name, target).select { |v| dep.match? dep.name, v }\n .collect { |v| ::Gem::Version.new v }.max\n version.nil? ? nil : version.to_s\n end",
"def latest_version_matching(dep)\n version = versions_matching(dep).collect { |v| ::Gem::Version.new v }.max\n version.nil? ? nil : version.to_s\n end",
"def latest_version\n self.versions.order(\"revision_date DESC\").first\n end",
"def latest_gemspec(rubygem)\n ::Gem.source_index.gems.values.select {|e| e.name == rubygem }.sort_by {|e| e.version }[-1]\n end",
"def remote_version\n rubygem_api = JSON.parse open(\"https://rubygems.org/api/v1/versions/osa.json\").read\n rubygem_api.first[\"number\"]\n rescue Exception => e\n puts \"[!] \".yellow + \" Couldn't check the latest version, please check internet connectivity.\"\n exit!\n end",
"def latest\n version = nil\n pkg(:list, \"-Ha\", @resource[:name]).each_line do |line|\n v = self.class.parse_line(line.chomp)[:status]\n case v\n when \"known\"\n return v\n when \"installed\"\n version = v\n when \"i--\"\n version = self.class.parse_line(line.chomp)[:version]\n else\n Puppet.warn \"unknown package state for #{@resource[:name]}: #{v}\"\n end\n end\n version\n end",
"def latest\n url = \"https://pypi.python.org/pypi/#{URI.encode(@resource[:name])}/json\"\n result = self.open_jsonurl(url)\n result['info']['version'] if result != nil\n rescue Timeout::Error => detail\n raise Puppet::Error, \"Error in contacting pypi.python.org: #{detail}\"\n end",
"def latest\n version = nil\n pkg(:list, \"-Ha\", @resource[:name]).each_line do |line|\n v = parse_line(line.chomp)[:status]\n case v\n when \"known\"\n return v\n when \"installed\"\n version = v\n else\n Puppet.warn \"unknown package state for #{@resource[:name]}: #{v}\"\n end\n end\n version\n end",
"def latest\n upd = latest_info\n unless upd.nil?\n # FIXME: there could be more than one update for a package\n # because of multiarch\n return \"#{upd[:epoch]}:#{upd[:version]}-#{upd[:release]}\"\n else\n # Yum didn't find updates, pretend the current\n # version is the latest\n raise Puppet::DevError, \"Tried to get latest on a missing package\" if properties[:ensure] == :absent\n return properties[:ensure]\n end\n end",
"def latest\n upd = latest_info\n unless upd.nil?\n # FIXME: there could be more than one update for a package\n # because of multiarch\n return \"#{upd[:epoch]}:#{upd[:version]}-#{upd[:release]}\"\n else\n # Yum didn't find updates, pretend the current\n # version is the latest\n raise Puppet::DevError, \"Tried to get latest on a missing package\" if properties[:ensure] == :absent\n return properties[:ensure]\n end\n end",
"def latest\n output = npm_exec \"view #{@resource[:name]} versions\"\n output.split(/[^\\d\\.]+/).last\n end",
"def get_latest_version(opts)\n raise NotImplementedError\n end",
"def latest\n #rug can only get a list of *all* available packages?\n output = rug \"list-updates\"\n\n if output =~ /#{Regexp.escape @resource[:name]}\\s*\\|\\s*([^\\s\\|]+)/\n return $1\n else\n # rug didn't find updates, pretend the current\n # version is the latest\n return @property_hash[:ensure]\n end\n end",
"def latest\n @latest ||= begin\n available = available_assets.keys.map { |key| key[/selenium-server-(\\d+\\.\\d+\\.\\d+)\\.jar/, 1] }\n available.map { |asset| Gem::Version.new(asset) }.max.to_s\n end\n end",
"def latest\n client = XMLRPC::Client.new2(\"http://pypi.python.org/pypi\")\n client.http_header_extra = {\"Content-Type\" => \"text/xml\"}\n client.timeout = 10\n result = client.call(\"package_releases\", @resource[:name])\n result.first\n rescue Timeout::Error => detail\n raise Puppet::Error, \"Timeout while contacting pypi.python.org: #{detail}\";\n end",
"def latest\n client = XMLRPC::Client.new2(\"http://pypi.python.org/pypi\")\n client.http_header_extra = {\"Content-Type\" => \"text/xml\"}\n client.timeout = 10\n result = client.call(\"package_releases\", @resource[:name])\n result.first\n rescue Timeout::Error => detail\n raise Puppet::Error, \"Timeout while contacting pypi.python.org: #{detail}\";\n end",
"def target_version\n if target && target.respond_to?(:root_spec)\n version = target.root_spec.version\n [version.major, version.minor, version.patch].join('.')\n else\n '1.0.0'\n end\n end",
"def target_version\n if target && target.respond_to?(:root_spec)\n version = target.root_spec.version\n [version.major, version.minor, version.patch].join('.')\n else\n '1.0.0'\n end\n end",
"def get_latest_stable_version_details(http_response)\n versions = stable_gem_versions(http_response)\n sorted_versions = sorted_versions(versions)\n last_version_number = last_version(sorted_versions)\n find_version(versions, last_version_number)\nend",
"def latest_version\n (Release.where(:manifest_id => manifest_id).max(:version) || 0)\n end",
"def latest\n args = %w{search --canonical}\n\n env, package = parse_env(@resource[:name])\n if env != nil\n args << \"-n\"\n args << \"#{env}\"\n end\n\n if @resource[:source].to_s != ''\n args << \"--channel\"\n args << @resource[:source].to_s\n args << \"--override-channels\"\n end\n\n args << \"^#{package}$\"\n\n versions = []\n command = \"#{self.class.get_conda_cmd} #{args.join(' ')}\"\n execpipe command do |process|\n process.collect do |line|\n next unless options= parse_search(line, \"py27\")\n versions << options\n end\n end\n\n return nil if versions.empty?\n # return highest version\n versions.map {|v| Gem::Version.new v}.max.to_s\n end",
"def latest\n # Refresh package metadata before looking for latest versions\n pkg(:refresh)\n\n lines = pkg(:list, \"-Hvn\", @resource[:name]).split(\"\\n\")\n\n # remove certificate expiration warnings from the output, but report them\n cert_warnings = lines.select { |line| line =~ /^Certificate/ }\n unless cert_warnings.empty?\n Puppet.warning(_(\"pkg warning: %{warnings}\") % { warnings: cert_warnings.join(', ') })\n end\n\n lst = lines.select { |line| line !~ /^Certificate/ }.map { |line| self.class.parse_line(line) }\n\n # Now we know there is a newer version. But is that installable? (i.e are there any constraints?)\n # return the first known we find. The only way that is currently available is to do a dry run of\n # pkg update and see if could get installed (`pkg update -n res`).\n known = lst.find { |p| p[:status] == 'known' }\n if known\n options = ['-n']\n options.concat(join_options(@resource[:install_options])) if @resource[:install_options]\n return known[:ensure] if exec_cmd(command(:pkg), 'update', *options, @resource[:name])[:exit].zero?\n end\n\n # If not, then return the installed, else nil\n (lst.find {|p| p[:status] == 'installed' } || {})[:ensure]\n end",
"def latest\n #zypper can only get a list of *all* available packages?\n output = zypper \"list-updates\"\n\n if output =~ /#{Regexp.escape @resource[:name]}\\s*\\|.*?\\|\\s*([^\\s\\|]+)/\n return $1\n else\n # zypper didn't find updates, pretend the current\n # version is the latest\n return @property_hash[:ensure]\n end\n end",
"def latest_in_unit\n package_branch.latest\n end",
"def get_latest_stable_version_details(http_response)\n versions = stable_gem_versions(http_response)\n sorted_versions = sorted_versions(versions)\n last_version_number = last_version(sorted_versions)\n find_version(versions, last_version_number)\n end",
"def latest\n command = resource_or_provider_command\n self.class.validate_command(command)\n\n command_version = self.class.pip_version(command)\n if self.class.compare_pip_versions(command_version, '1.5.4') == -1\n available_versions_with_old_pip.last\n else\n available_versions_with_new_pip(command_version).last\n end\n end",
"def latest_tag\n releases_url = 'https://github.com/david942j/one_gadget/releases/latest'\n @latest_tag ||= url_request(releases_url).split('/').last\n end",
"def latest_version\n\t\treturn versions.order(\"number DESC\").last\n\tend",
"def lastest_package_release\n self.packages.where(:latest => 1).order(:release_date => :desc).first\n end",
"def retrieve_version(name, version)\n path = downloaded_gem_path name, version\n parse :gem => path\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 latest_version\n @latest_version ||= with_cache(file_name) { normalize_version(Network.get_url(\"#{base_url}/latest\")[/[^v]*$/]) }\n end",
"def get_latest_release(project, bin)\n api_url = \"https://api.github.com/repos/#{project}/releases/latest\"\n data = URI.parse(api_url).read\n obj = JSON.parse(data)\n version = obj[\"name\"]\n sha_url = \"https://github.com/#{project}/releases/download/#{version}/#{bin}.sha256\"\n sha = URI.parse(sha_url).read\n url = \"https://github.com/#{project}/releases/download/#{version}/#{bin}\"\n sha256 = sha.split(\" \").first\n\n return url, sha256, version\nend",
"def matching_target(dep, target)\n version = version_matching_target(dep, target)\n raise RuntimeError, \"no matching version\" if version.nil?\n retrieve dep.name, version\n end",
"def target_version\n if version_constraint\n solution = self.class.solve_for_constraint(version_constraint, versions)\n \n unless solution\n raise NoSolution, \"No cookbook version of '#{name}' found at #{self} that would satisfy constraint (#{version_constraint}).\"\n end\n\n solution\n else\n latest_version\n end\n end",
"def latest_version\n files.last && files.last.versionnumber\n end",
"def latest_version\n link = data.xpath(\"at:link[@rel = 'current-version']/@href\", NS::COMBINED)\n if link.first\n entry = conn.get_atom_entry(link.first.text)\n self_or_new(entry)\n else\n # FIXME: should somehow return the current version even for opencmis\n self\n end\n end",
"def version_from_gem_lock_file\n shell_return = run_shell(\"grep -A 1 RUBY Gemfile.lock\")\n shell_return.nil? ? nil : shell_return.stdout.split(\"\\n\")[1].strip.split(\" \")[1]\n end",
"def get_version(gem)\n lockfile_specs.find { |s| s.name == gem }&.version\n end",
"def latest\n # setting cpanm_bin_path here seems to fix the undefined local variable error\n dist_re = %r{(.*?)(\\w+-?)+((\\d+\\.?)+)\\.(\\w+\\.?)+}\n latest_dist = %x{cpanm --info #{@resource[:name]}}\n if latest_dist =~ dist_re\n $3\n else\n nil\n end\n end",
"def latest_version\n quietly {\n uri = rest.get_rest(name)['latest_version']\n\n [ version_from_uri(uri), uri ]\n }\n rescue Net::HTTPServerException => e\n if e.response.code == \"404\"\n raise CookbookNotFound, \"Cookbook '#{name}' not found at site: '#{api_uri}'\"\n else\n raise\n end\n end",
"def find_latest_gem(gem_name)\n the_gem = Dir.glob(\"#{Gem.dir}/gems/#{gem_name}-*\")\n\n the_gem.empty? ? nil : the_gem.sort.last\n end",
"def get_remote_version\n open(\"#{@@remote_cli}/LATEST\").read.gsub(/.*cli-/, '').gsub(/\\.tar\\.gz/,'').tr(\"\\n\", '')\n end",
"def latest_extension_version\n versions = remove_non_semvar_versions\n versions = remove_pre_release_versions(versions)\n if versions.blank?\n # include pre-release versions\n versions = remove_non_semvar_versions\n end\n if versions.blank?\n # use the non-compliant versions as last resort\n versions = sorted_extension_versions\n end\n versions.first\n end",
"def fetch_gem(name, version)\n http_get(host + \"/gems/#{name}-#{version}.gem\").body\n end",
"def latest\n output = aptcache :policy, @resource[:name]\n\n if output =~ /Candidate:\\s+(\\S+)\\s/\n return $1\n else\n self.err \"Could not find latest version\"\n return nil\n end\n end",
"def get_last_release_versions\n # determine last SIMP release\n last_release = nil\n last_puppetfile = nil\n debug('Determining last SIMP release')\n\n Dir.chdir(\"#{@options[:work_dir]}/simp-core\") do |dir|\n `git fetch -t origin 2>/dev/null`\n tags = `git tag -l`.split(\"\\n\")\n debug(\"Available simp-core tags = #{tags}\")\n last_release = (tags.sort { |a,b| Gem::Version.new(a) <=> Gem::Version.new(b) })[-1]\n `git checkout -q tags/#{last_release}`\n src = File.join(dir, 'Puppetfile.pinned')\n last_puppetfile = File.join(@options[:work_dir], \"Puppetfile.#{last_release}\")\n debug(\"Copying simp-core #{last_release} Puppetfile.pinned into #{last_puppetfile}\")\n FileUtils.cp(src, last_puppetfile)\n `git checkout -q master`\n end\n\n debug(\"Retrieving component versions for SIMP #{last_release} from #{last_puppetfile}\")\n @last_release_versions = {}\n helper = PuppetfileHelper.new(last_puppetfile, @options[:work_dir], false)\n helper.modules.each do |mod|\n @last_release_versions[mod[:name]] = mod[:desired_ref]\n end\n end",
"def get_last_release\n r = api_get(\"/releases\")\n\n return r[0]['tag_name']\nend",
"def latest_pre_version(pe_family)\n open(\"http://getpe.delivery.puppetlabs.net/latest/#{pe_family}\").read\nend",
"def latest_version?\n @requirement.none?\n end",
"def latest_version?\n @requirement.none?\n end",
"def get_latest_release_tag\n\trooturl = get_svn_repo_root()\n\treleaseurl = rooturl + \"/#{SVN_RELEASES_DIR}\"\n\t\n\ttags = svn_ls( releaseurl ).grep( RELEASE_VERSION_PATTERN ).sort_by do |tag|\n\t\ttag[RELEASE_VERSION_PATTERN].split('.').collect {|i| Integer(i) }\n\tend\n\treturn nil if tags.empty?\n\n\treturn releaseurl + '/' + tags.last\nend",
"def upstream_gem\n @gem ||= Polisher::Gem.from_rubygems gem_name, version\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 gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def target_version; end",
"def current_version\n versions.first\n end",
"def get_latest_revision\n raise NotImplementedError\n end",
"def get_latest_version(opts)\n doc = fetch_doc('https://en.cppreference.com/w/Cppreference:Archives', opts)\n link = doc.at_css('a[title^=\"File:\"]')\n date = link.content.scan(/(\\d+)\\./)[0][0]\n DateTime.strptime(date, '%Y%m%d').to_time.to_i\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 last_version_number\n last = versions.first\n last ? last.number : 0\n end",
"def latest_version?\n if (res = _latest_version?)\n Gem.unversioned(@name)\n end\n res\n end",
"def find_last_repository_version(product, repository_key)\n all_available_repo = find_available_repo(product, repository_key)\n repo = all_available_repo.last[1]\n all_available_repo.delete_if { |elem| elem[1]['version'].include?('debug') }\n repo = all_available_repo.last[1] unless all_available_repo.nil?\n repo\n end",
"def latest_version?\n if (rval = super)\n Gem.unversioned(@name)\n end\n rval\n end",
"def latest\n releases.first\n end",
"def current_version\n find( :first, :order => 'number DESC' )\n end",
"def version\n @dependency.requirement\n end",
"def latest_tag\n unless (fact_from_file = fetch_fact_from_file(__method__)).nil?\n return fact_from_file\n end\n\n `git -c versionsort.prereleaseSuffix=rc tag -l '#{Info.tag_match_pattern}' --sort=-v:refname | head -1`.chomp\n end",
"def last_version\n @last_version ||= versions.maximum(:number) || 1\n end",
"def version(target = nil)\n raw \"VERSION #{target}\".strip << \"\\r\\n\"\n end",
"def package_version(package)\n # use module version if it exists\n go_mod = package[\"Module\"]\n return go_mod[\"Version\"] if go_mod\n\n package_directory = package[\"Dir\"]\n return unless package_directory && File.exist?(package_directory)\n\n # find most recent git SHA for a package, or nil if SHA is\n # not available\n Dir.chdir package_directory do\n contents_version(*contents_version_arguments)\n end\n end",
"def last_version\n return 0 if versions.count == 0\n versions.first.version_number\n end",
"def latest_version\n file_to_semver(sorted_files.first)\n end",
"def get_latest_revision\n @current_revision\n end",
"def version\n return last_version if versionable?\n version_number\n end",
"def latest_version_file\n sorted_files.first\n end",
"def latest\n raise Sibit::NotSupportedError, 'latest() doesn\\'t work here'\n end",
"def latest\n source = @resource[:source]\n unless source\n @resource.fail _(\"RPMs must specify a package source\")\n end\n\n cmd = [command(:rpm), \"-q\", \"--qf\", \"#{self.class::NEVRA_FORMAT}\", \"-p\", source]\n h = self.class.nevra_to_multiversion_hash(execute(cmd))\n h[:ensure]\n rescue Puppet::ExecutionFailure => e\n raise Puppet::Error, e.message, e.backtrace\n end",
"def get_last_versions\n @last_release_mods = {}\n helper = PuppetfileHelper.new(@options[:last_release_puppetfile], @options[:root_dir], false)\n helper.modules.each do |mod|\n @last_release_mods[mod[:name]] = mod[:desired_ref]\n end\n end",
"def get_last_versions\n @last_release_mods = {}\n helper = PuppetfileHelper.new(@options[:last_release_puppetfile], @options[:root_dir], false)\n helper.modules.each do |mod|\n @last_release_mods[mod[:name]] = mod[:desired_ref]\n end\n end",
"def latest_production\n Origen::VersionString.new(origen[:latest_version_prod])\n end",
"def find_gem(name, version)\n spec = source_index.find_name(name, version).last\n unless spec and (spec.installation_path rescue nil)\n alert_error \"Could not find gem #{name} (#{version})\"\n raise Gem::GemNotFoundException, \"Could not find gem #{name}, (#{version})\"\n end\n\n return spec\n end",
"def latest_or_version(version_id)\n version = Version.where(id: version_id).first || self.latest_version\n end",
"def most_recent_ruby_version\n node[:rbenv][:rubies].map do |version|\n Gem::Version.new(version)\n end.sort.map(&:to_s).last\nend"
] |
[
"0.7854426",
"0.74819744",
"0.7322488",
"0.72508657",
"0.7245595",
"0.7161212",
"0.7131202",
"0.71140045",
"0.706569",
"0.7040538",
"0.70030904",
"0.69820124",
"0.6968745",
"0.69412816",
"0.69284654",
"0.6922672",
"0.69146144",
"0.69102955",
"0.69070584",
"0.6899313",
"0.6899313",
"0.6859982",
"0.68308014",
"0.6814898",
"0.68021303",
"0.6800161",
"0.6800161",
"0.6770973",
"0.6770973",
"0.67460275",
"0.66810435",
"0.6675268",
"0.667341",
"0.66699535",
"0.66609114",
"0.6653636",
"0.66472554",
"0.66356546",
"0.6626553",
"0.6617112",
"0.65907234",
"0.6558756",
"0.6552517",
"0.6530541",
"0.6524257",
"0.6522572",
"0.6522546",
"0.6517342",
"0.64876616",
"0.6479395",
"0.6458031",
"0.6447339",
"0.6423114",
"0.64084756",
"0.64035183",
"0.6383335",
"0.6373066",
"0.6357001",
"0.6355165",
"0.6349427",
"0.63228464",
"0.63228464",
"0.6308469",
"0.6308041",
"0.6295483",
"0.6291397",
"0.6291397",
"0.6291397",
"0.6291397",
"0.6291397",
"0.6291397",
"0.62681764",
"0.62508166",
"0.62235737",
"0.62194264",
"0.6217538",
"0.62134993",
"0.6208917",
"0.6200466",
"0.6191474",
"0.6183142",
"0.61770135",
"0.6174678",
"0.61739737",
"0.6171011",
"0.61641467",
"0.6158515",
"0.6157706",
"0.61485195",
"0.6143321",
"0.61420083",
"0.61326754",
"0.6132619",
"0.6130261",
"0.61135906",
"0.61135906",
"0.6112617",
"0.6109176",
"0.60996526",
"0.6088413"
] |
0.7759147
|
1
|
module ClassMethods Download the local gem and return it as a string
|
def download_gem
self.class.download_gem @name, @version
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def download_gem\n self.class.download_gem @name, @version\n end",
"def gem_path\n @path || downloaded_gem_path\n end",
"def downloaded_gem_path\n self.class.downloaded_gem_path @name, @version\n end",
"def gem_path\n @path || downloaded_gem_path\n end",
"def downloaded_gem_path\n self.class.downloaded_gem_path @name, @version\n end",
"def package_url\n \"https://github.com/arduino/arduino-cli/releases/download/#{@desired_version}/#{package_file}\"\n end",
"def fetch_gem(name, version)\n http_get(host + \"/gems/#{name}-#{version}.gem\").body\n end",
"def load_library\n\t\t#wget some url\n\tend",
"def download(path)\n Gem.ensure_gem_subdirectories path\n\n if @spec.respond_to? :sources\n exception = nil\n path = @spec.sources.find do |source|\n begin\n source.download full_spec, path\n rescue exception\n end\n end\n return path if path\n raise exception if exception\n\n elsif @spec.respond_to? :source\n source = @spec.source\n source.download full_spec, path\n\n else\n source = Gem.sources.first\n source.download full_spec, path\n end\n end",
"def download_and_extract_package\n @fetcher.get_package_file(@package_name, @version)\n Gem::Package::TarReader.new( Zlib::GzipReader.open @fetcher.temp_package_file_path ) do |tar|\n tar.each do |entry|\n next unless entry.file? and entry.full_name.match(\"DESCRIPTION\")\n @package_desc = entry.read\n end\n end\n FileUtils.rm_rf @fetcher.temp_package_file_path\n end",
"def downloaded_gem_path(name, version)\n # ensure gem is downloaded\n download_gem name, version\n GemCache.path_for(name, version)\n end",
"def download name\n @checked += 1\n gem_name = \"#{name}.gem\"\n\n if gem_exists? gem_name then\n @gem_queue.push name\n\n info \"#{gem_name} exists\"\n\n return\n end\n\n uri = @base_uri + \"#{name}.gem\"\n\n source_etag = nil\n dest_etag = nil\n\n @http.request uri do |source_res|\n break unless etag = source_res['ETag']\n source_etag = etag.delete '\"'\n\n dest_etag = @swift.write_object @gems_container, gem_name do |io|\n source_res.read_body do |chunk|\n io.write chunk\n end\n end\n end\n\n if dest_etag == source_etag then\n @gem_queue.push name\n\n info \"#{gem_name} downloaded\"\n\n @downloaded += 1\n else\n @gem_name_queue.push name\n @swift.delete_object @gems_container, gem_name\n\n info \"#{gem_name} download failed\"\n @failed += 1\n end\n end",
"def download_gem(name, version)\n cached = GemCache.get(name, version)\n return cached unless cached.nil?\n\n client.url = \"https://rubygems.org/gems/#{name}-#{version}.gem\"\n client.follow_location = true\n client.http_get\n gemf = client.body_str\n\n GemCache.set(name, version, gemf)\n gemf\n end",
"def path; Gem.ruby; end",
"def download_prog(repo_hash)\n if (repo_hash[:source] == \"github\")\n clone_repo(repo_hash)\n elsif (repo_hash[:source] == \"rubygems\")\n puts \"Unpacking gem #{repo_hash[:name]}...\"\n system \"gem unpack #{repo_hash[:name]} --version #{repo_hash[:version]}\"\n else\n raise \"Unexpected source of repo #{repo_hash[:name]}: #{repo_hash[:source]}\"\n end\nend",
"def try_local(gem_name)\n if ENV['USE_LOCAL_GEMS']\n gem gem_name, path: \"../#{gem_name}\"\n else\n gem gem_name, github: \"omniscrapper/#{gem_name}\"\n end\nend",
"def project_file\n if fetcher && fetcher.is_a?(NetFetcher)\n log.deprecated(log_key) do\n \"project_file (DSL). This is a property of the NetFetcher and will \" \\\n \"not be publically exposed in the next major release. In general, \" \\\n \"you should not be using this method in your software definitions \" \\\n \"as it is an internal implementation detail of the NetFetcher. If \" \\\n \"you disagree with this statement, you should open an issue on the \" \\\n \"Omnibus repository on GitHub an explain your use case. For now, \" \\\n \"I will return the path to the downloaded file on disk, but please \" \\\n \"rethink the problem you are trying to solve :).\"\n end\n\n fetcher.downloaded_file\n else\n log.warn(log_key) do\n \"Cannot retrieve a `project_file' for software `#{name}'. This \" \\\n \"attribute is actually an internal representation that is unique \" \\\n \"to the NetFetcher class and requires the use of a `source' \" \\\n \"attribute that is declared using a `:url' key. For backwards-\" \\\n \"compatability, I will return `nil', but this is most likely not \" \\\n \"your desired behavior.\"\n end\n\n nil\n end\n end",
"def gem_to_gemfile(gem)\n gem_str = <<~GEM\n #{gem.comment ? \"# #{gem.comment}\" : ''}\n #{(gem.commented_out ? '#' : '')}gem '#{gem.name}'#{gem_version_str(gem)}#{gem_options(gem)}\n GEM\n\n gem_str.strip\nend",
"def retrieve_latest(name)\n client.url = \"https://rubygems.org/api/v1/gems/#{name}.json\"\n client.http_get\n spec = client.body_str\n gem = parse spec\n gem\n end",
"def local_path\n fetch_path(DevTools.gem_root)\n end",
"def download(spec, dir=Dir.pwd)\n fetcher = Gem::RemoteFetcher.fetcher\n fetcher.download spec, uri.to_s, dir\n end",
"def file_name\n \"#{full_name}.gem\"\n end",
"def download_package\n path = download_path\n remote_file path do\n source URL\n action :create\n only_if { !::File.exist?(PATH) }\n end\n end",
"def download(full_spec, path) # :nodoc:\n end",
"def fetch type, version, extension=\"tar.gz\"\n core_url = \"#{@base}/#{type}-#{version}.#{extension}\"\n tmp = Galaxy::Temp.mk_auto_file \"galaxy-download\"\n @log.info \"Fetching #{core_url} into #{tmp}\"\n if @base =~ /^http:/\n begin\n output = Galaxy::HostUtils.system(\"curl -D - #{core_url} -o #{tmp} -s\")\n rescue Galaxy::HostUtils::CommandFailedError => e\n raise \"Failed to download archive #{core_url}: #{e}\"\n end\n status = output.first\n (protocol, response_code, response_message) = status.split\n unless response_code == '200'\n raise \"Failed to download archive #{core_url}: #{status}\"\n end\n else\n open(core_url) do |io|\n File.open(tmp, \"w\") { |f| f.write(io.read) }\n end\n end\n return tmp\n end",
"def libfile\n libfile = Pathname.new(resource[:lib]).absolute? ? resource[:lib] : \"modules/#{resource[:lib]}\"\n end",
"def main\n last_good_root = from_file($cache_dir + '/root.txt') ||\n from_file('config/root.txt') ||\n raise(\"Can't find root.txt\")\n\n repository = Gem::TUF::Repository.new(\n root: JSON.parse(last_good_root),\n bucket: FileCachingBucket.new(HttpBucket.new($host))\n )\n\n gem_name = ARGV.shift\n\n specs = repository.target('latest_specs.4.8.gz')\n raise \"could not find latest_specs.4.8.gz\" unless specs\n specs = unmarshal_gz specs\n gem = specs.detect {|x| x[0] == gem_name } || raise(\"Can't find gem #{gem}\")\n\n gem_with_version = \"#{gem[0]}-#{gem[1]}\"\n gem_path = \"gems/#{gem_with_version}.gem\"\n gemspec_path = \"quick/Marshal.4.8/#{gem_with_version}.gemspec.rz\"\n\n repository.target(gemspec_path)\n repository.target(gem_path)\n\n puts \"Downloaded #{gem_path} and #{gemspec_path}\"\nend",
"def local_or_remote_gem(name, options = Hash.new)\n local_path = File.expand_path(\"../vendor/#{name}\", __FILE__)\n if File.exist?(local_path)\n gem name, options.merge(:path => local_path).delete_if { |key, _| [:git, :branch].include?(key) }\n else\n gem name, options\n end\nend",
"def download(spec, path)\n nil\n end",
"def get_file(url); end",
"def source # :nodoc:\n Gem::Source::Installed.new\n end",
"def download\n # Turned off ssl verification\n # This should be acceptable because it won't happen on a user's machine, just CI\n\n # define a progress-bar printer\n chunk_size = 1024 * 1024 * 1024\n total_size = 0\n dots = 0\n dot_printer = lambda do |size|\n total_size += size\n needed_dots = (total_size / chunk_size).to_i\n unprinted_dots = needed_dots - dots\n @output.print(\".\" * unprinted_dots) if unprinted_dots.positive?\n dots = needed_dots\n end\n\n URI.open(package_url, ssl_verify_mode: 0, progress_proc: dot_printer) do |url|\n File.open(package_file, 'wb') { |file| file.write(url.read) }\n end\n rescue Net::OpenTimeout, Net::ReadTimeout, OpenURI::HTTPError, URI::InvalidURIError => e\n @output.puts \"\\nArduino force-install failed downloading #{package_url}: #{e}\"\n end",
"def retrieve_version(name, version)\n path = downloaded_gem_path name, version\n parse :gem => path\n end",
"def download_resource(loader, src_url)\n # play nice with remote web servers\n sleep(rand / 100) if src_url =~ /^[[:alpha:]]+:/\n begin\n loader.spec_invoke(:data_source, src_url, nil)\n rescue Exception => e\n # FIXME: log\n $stderr.puts \"[NOKOGIRI] Cannot download resource : #{e.message}\"\n $stderr.puts e.backtrace[0,2].join(\"\\n\")\n nil\n end\n end",
"def _download_module(name)\n command = \"puppet module install #{name} \"\n command += @modulepath + Silence\n\n puts \"Calling '#{command}'\" if @options[:debug]\n system(command)\n end",
"def resource(gem_name, path)\n if not loaded? gem_name\n raise PluginNotLoaded.new(\"Plugin #{gem_name} not loaded when getting resource #{path}\")\n end\n\n file = File.join(@gems[gem_name], \"resources\", path)\n\n if File.exist? file\n return file\n else\n return nil\n end\n end",
"def libfile\n Pathname.new(resource[:lib]).absolute? ? resource[:lib] : \"modules/#{resource[:lib]}\"\n end",
"def downloaded_path\n @downloaded_path ||= File.join(install_path, file_name(url))\n return @downloaded_path\n end",
"def download_file(f)\n run(\"curl -O http://github.com/meskyanichi/rails-templates/raw/master/files/#{f}\")\nend",
"def get_download\n\tend",
"def gem(name, options={})\n puts \"vendoring gem #{name}\"\n if options[:git]\n in_root(\"vendor/gems\") do\n Git.clone(options[:git], options[:branch])\n end\n elsif options[:svn]\n in_root(\"vendor/gems\") do\n Svn.checkout(options[:svn], options[:branch])\n end\n else \n # TODO: Gem dependencies. Split output on \\n, iterate lines looking for Downloaded...\n in_root(\"vendor/gems\") do\n # Filename may be different than gem name\n filename = (`gem fetch #{name}`).chomp.gsub(/Downloaded /, '')\n\n `gem unpack #{filename}.gem`\n File.delete(\"#{filename}.gem\")\n end\n end\n end",
"def absolute_gem_binary\n ::File.expand_path(gem_binary, path)\n end",
"def gem(name, version)\n version = version.to_s\n\n begin\n json = open(\"https://rubygems.org/api/v1/versions/#{name}.json\") {|f| f.read}\n gems = JSON.parse(json)\n\n gem = gems.detect do |g|\n g[\"number\"] == version && g[\"platform\"] == \"ruby\"\n end\n\n if gem && gem[\"sha\"]\n # Rubygems.org was _supposed_ to provide base64 encoded SHA-256 hashes,\n # but as of now the hashes are base16 encoded...\n base16 = gem[\"sha\"]\n base32 = exec(\"nix-hash --type sha256 --to-base32 #{base16.shellescape}\")\n assert_length!(base32, 52)\n assert_format!(base32, /^[a-z0-9]+$/)\n\n base32\n end\n rescue Exception => ex\n #puts ex.message\n #puts ex.backtrace\n nil\n end\n end",
"def build_gem; end",
"def download_source\n unless @download_source\n if new_resource.package_url\n res = chase_redirect(new_resource.package_url)\n else\n params = URI.encode_www_form(full: 1,\n plat: node['platform_family'][0..2])\n res = chase_redirect(\"https://www.dropbox.com/download?#{params}\")\n end\n end\n @download_source ||= res\n end",
"def library_for(uri); end",
"def get_file(url)\n get(url).body\n end",
"def source\n @source ||= Gem::Source::Installed.new\n end",
"def local_gem(*args)\n load_local_gem(args[0]) || gem(*args)\n end",
"def retrieve_bundle\n VCR.use_cassette('bundle_download') do\n bundle_resource = RestClient::Request.execute(method: :get,\n url: 'https://cypress.healthit.gov/measure_bundles/fixture-bundle-2020.zip',\n user: ENV.fetch('VSAC_USERNAME', nil),\n password: ENV.fetch('VSAC_PASSWORD', nil),\n raw_response: true,\n headers: { accept: :zip })\n\n return bundle_resource.file\n end\n end",
"def file_from_repo(github_user, repo, sha, filename, to = filename)\n download(\"http://github.com/#{github_user}/#{repo}/raw/#{sha}/#{filename}\", to)\nend",
"def file_from_repo(github_user, repo, sha, filename, to = filename)\n download(\"http://github.com/#{github_user}/#{repo}/raw/#{sha}/#{filename}\", to)\nend",
"def source_package_file\n pkg_file = nil\n pkg_dir = self.source_package_dir\n @source_urls.each do |url|\n poss_pkg_file = File.join(pkg_dir, File.basename(url[0]))\n if File::exists?(poss_pkg_file)\n pkg_file = poss_pkg_file\n break\n end\n end\n pkg_file\n end",
"def source_package_file\n pkg_file = nil\n pkg_dir = self.source_package_dir\n @source_urls.each do |url|\n poss_pkg_file = File.join(pkg_dir, File.basename(url[0]))\n if File::exists?(poss_pkg_file)\n pkg_file = poss_pkg_file\n break\n end\n end\n pkg_file\n end",
"def download_original ; path_download_file(:original).download end",
"def download\n \n @tmpfile = fetch_remote(location)\n \n @fetched_at = Time.new\n \n return @tmpfile\n \n end",
"def dmg_package_source\n if %i(direct repo).include?(new_resource.source)\n return package_metadata[:url]\n end\n path = new_resource.source.to_s\n (path.start_with?('/') ? 'file://' : '') + path\n end",
"def fetch\n if cached_location.exist?\n @local_path = cached_location\n debug \"#{extended_name} is cached\"\n else\n raise \"No download URL specified for #{extended_name}\" if download_url.nil?\n blah \"Fetching #{extended_name}\"\n downloader = Drupid.makeDownloader self.download_url.to_s,\n self.cached_location.dirname.to_s,\n self.cached_location.basename.to_s,\n self.download_specs\n downloader.fetch\n downloader.stage\n @local_path = downloader.staged_path\n end\n end",
"def lib_out\n @mpc_project.recipe.get_relative_path(@mpc_project.lib_out)\n end",
"def tarball\n Dir[\"#{dest}/#{SCOPE}-#{gemspec.name}-#{gemspec.version}.tgz\"].first\n end",
"def build\n\t@built_gem_path ||= @helper.build_gem\nend",
"def package\n @package ||= path.split('/lib/')[0].split('/').last.split('.js').last\n end",
"def gem_deps_file # :nodoc:\n File.basename @path\n end",
"def install_gem; end",
"def source_uri\n URI.parse(url_for(@software))\n end",
"def full_gem_path\n # TODO: This is a heavily used method by gems, so we'll need\n # to aleast just alias it to #gem_dir rather than remove it.\n @full_gem_path ||= find_full_gem_path\n end",
"def full_gem_path\n # TODO: This is a heavily used method by gems, so we'll need\n # to aleast just alias it to #gem_dir rather than remove it.\n @full_gem_path ||= find_full_gem_path\n end",
"def get_packages!(path)\n response = Api::Request.new do |request|\n request[:sign] = false\n request[:method] = :GET\n request[:path] = \"/shared/packages/#{path}\"\n end.execute!\n\n Object::File.open(path, 'wb') do |file|\n file.write(response)\n end\n\n path\n end",
"def fetch_spec(spec)\n spec = spec - [nil, 'ruby', '']\n spec_file_name = \"#{spec.join '-'}.gemspec.rz\"\n\n uri = URI.parse(\"#{@remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}\")\n\n spec_rz = (uri.scheme == \"file\") ? Gem.read_binary(uri.path) : fetch(uri)\n Marshal.load Gem.inflate(spec_rz)\n end",
"def retrieve\n raise RetrieverError.new(\"download retriever is unavailable\") unless available?\n ::FileUtils.remove_entry_secure @repo_dir if File.exists?(@repo_dir)\n ::FileUtils.remove_entry_secure workdir if File.exists?(workdir)\n ::FileUtils.mkdir_p @repo_dir\n ::FileUtils.mkdir_p workdir\n file = ::File.join(workdir, \"package\")\n\n # TEAL FIX: we have to always-download the tarball before we can\n # determine if contents have changed, but afterward we can compare the\n # previous download against the latest downloaded and short-circuit the\n # remaining flow for the no-difference case.\n @logger.operation(:downloading) do\n credential_command = if @repository.first_credential && @repository.second_credential\n ['-u', \"#{@repository.first_credential}:#{@repository.second_credential}\"]\n else\n []\n end\n @output = ::RightScale::RightPopen::SafeOutputBuffer.new\n @cmd = [\n 'curl',\n '--silent', '--show-error', '--location', '--fail',\n '--location-trusted', '-o', file, credential_command,\n @repository.url\n ].flatten\n begin\n ::RightScale::RightPopen.popen3_sync(\n @cmd,\n :target => self,\n :pid_handler => :pid_download,\n :timeout_handler => :timeout_download,\n :size_limit_handler => :size_limit_download,\n :exit_handler => :exit_download,\n :stderr_handler => :output_download,\n :stdout_handler => :output_download,\n :inherit_io => true, # avoid killing any rails connection\n :watch_directory => workdir,\n :size_limit_bytes => @max_bytes,\n :timeout_seconds => @max_seconds)\n rescue Exception => e\n @logger.note_phase(:abort, :running_command, 'curl', e)\n raise\n end\n end\n\n note_tag(file)\n\n @logger.operation(:unpacking) do\n path = @repository.to_url.path\n if path =~ /\\.gz$/\n extraction = \"xzf\"\n elsif path =~ /\\.bz2$/\n extraction = \"xjf\"\n else\n extraction = \"xf\"\n end\n Dir.chdir(@repo_dir) do\n @output = ::RightScale::RightPopen::SafeOutputBuffer.new\n @cmd = ['tar', extraction, file]\n begin\n ::RightScale::RightPopen.popen3_sync(\n @cmd,\n :target => self,\n :pid_handler => :pid_download,\n :timeout_handler => :timeout_download,\n :size_limit_handler => :size_limit_download,\n :exit_handler => :exit_download,\n :stderr_handler => :output_download,\n :stdout_handler => :output_download,\n :inherit_io => true, # avoid killing any rails connection\n :watch_directory => @repo_dir,\n :size_limit_bytes => @max_bytes,\n :timeout_seconds => @max_seconds)\n rescue Exception => e\n @logger.note_phase(:abort, :running_command, @cmd.first, e)\n raise\n end\n end\n end\n true\n end",
"def gem_name\n @gem_name ||= @source_path.sub_ext(\"\").basename.to_s\n end",
"def jar(name)\n \"https://clojars.org/#{name}\"\n end",
"def yardoc_file_for_gem(gem, ver_require = T.unsafe(nil), for_writing = T.unsafe(nil)); end",
"def fetch_spec(name_tuple)\n fetcher = Gem::RemoteFetcher.fetcher\n\n spec_file_name = name_tuple.spec_name\n\n source_uri = enforce_trailing_slash(uri) + \"#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}\"\n\n cache_dir = cache_dir source_uri\n\n local_spec = File.join cache_dir, spec_file_name\n\n if File.exist? local_spec\n spec = Gem.read_binary local_spec\n spec = Marshal.load(spec) rescue nil\n return spec if spec\n end\n\n source_uri.path << '.rz'\n\n spec = fetcher.fetch_path source_uri\n spec = Gem::Util.inflate spec\n\n if update_cache?\n require \"fileutils\"\n FileUtils.mkdir_p cache_dir\n\n File.open local_spec, 'wb' do |io|\n io.write spec\n end\n end\n\n # TODO: Investigate setting Gem::Specification#loaded_from to a URI\n Marshal.load spec\n end",
"def download_build(file)\n temp = Tempfile.new(['gadgets', \"#{file}.rb\"])\n temp.write(url_request(url_of_file(File.join('lib', 'one_gadget', 'builds', \"#{file}.rb\"))))\n temp.tap(&:close)\n end",
"def package_path(extension='.gem')\n File.join(package_dir, package_basename(extension))\n end",
"def path\n @backend.lib_dir + name_on_disk\n end",
"def download_link\n \"http://#{self.registered_download.brand.default_website.url}/#{self.registered_download.url}/get_it/#{self.download_code}\"\n end",
"def pkg_fetch\n return if File::exists? @srcdir\n\n sysprint \"#{@name} fetch: #{@fetch_url}\"\n\n # Try to guess by package URL extension\n if @fetch_url.match(/\\.git$/i)\n git_clone(@fetch_url, @srcdir)\n return\n end\n\n # Else use the URL to select fetch method\n protocol = @fetch_url.split(':')[0]\n\n if protocol.length == 0\n syserr \"Invalid package source URL #{@fetch_url}\"\n raise\n end\n\n case protocol\n when /^http$/i, /^https$/i, /^ftp$/i\n curl_fetch(@fetch_url, @srcdir)\n when /git/i\n git_clone(@fetch_url, @srcdir)\n else\n syserr \"Unhandled URL type: #{protocol}\"\n raise\n end\n end",
"def get_download_url()\n return @@download_url;\n end",
"def pkg_path\n \"pkg/#{spec.full_name}\"\n end",
"def lib\n @data['lib']\n end",
"def source(url)\n Gem.sources.clear if @default_sources\n\n @default_sources = false\n\n Gem.sources << url\n end",
"def download_asset(prog_id)\n return download_data(\"http://www.channel4.com/programmes/asset/#{prog_id}\")\n end",
"def gemfile; end",
"def gemfile; end",
"def gemfile; end",
"def gemfile; end",
"def gemfile; end",
"def gemfile; end",
"def tailor_package_to_platform\n @package.app('Dropbox')\n @package.volumes_dir('Dropbox Installer')\n @package.source(URI.encode(\"file://#{download_dest}\"))\n end",
"def download_url(url)\n ethon = ethon_easy_requester\n ethon.url = uri_escape(url)\n ethon.perform\n check_and_raise_failure(ethon)\n {\n file_contents: ethon.response_body,\n link_url: last_location_header(ethon)\n }\n end",
"def tailor_package_to_platform\n @package.source(URI.encode(download_dest))\n @package.installer_type(:nsis)\n end",
"def package\n unless @package\n @package = package_resource_class.new(download_dest, run_context)\n tailor_package_to_platform\n end\n @package\n end",
"def remote_repository\n \"http://www.aQute.biz/repo\"\n end",
"def download_driver_http\n File.write(\n @target_path,\n open(@params[:jdbc_driver_jar]).read\n )\n end",
"def get_ai_repo_url(options)\n repo_ver = get_ai_repo_version(options)\n repo_url = \"pkg:/entire@0.5.11-\"+repo_ver\n return repo_url\nend",
"def file_from_repo(github_user, repo, sha, filename, to = filename)\n download(\"http://github.com/#{github_user}/#{repo}/raw/#{sha}/#{filename}\", to)\n end",
"def custom_gem(name, options = Hash.new)\n local_path = File.expand_path \"../vendor/#{name}\", __FILE__\n\n if File.exist? local_path\n options = options.merge :path => local_path\n options.delete_if do |key, _|\n [:github, :branch].include? key\n end\n end\n\n gem name, options\nend",
"def remote_path\n pv = node['platform_version']\n file = if Gem::Version.new(pv) >= Gem::Version.new('10.9')\n 'X2GoClient_latest_macosx_10_9.dmg'\n else\n 'X2GoClient_latest_macosx.dmg'\n end\n \"http://code.x2go.org/releases/#{file}\"\n end"
] |
[
"0.7213154",
"0.6753743",
"0.6710639",
"0.66692287",
"0.6586051",
"0.6453498",
"0.6374388",
"0.63688445",
"0.61961573",
"0.61261266",
"0.6104272",
"0.60967845",
"0.6090408",
"0.6082866",
"0.6081862",
"0.60184836",
"0.59918666",
"0.59887403",
"0.5980656",
"0.59715223",
"0.5948369",
"0.58455825",
"0.58395183",
"0.5827739",
"0.5798216",
"0.57836235",
"0.5749479",
"0.5737159",
"0.5736526",
"0.573601",
"0.5732948",
"0.5732008",
"0.57126915",
"0.57104677",
"0.5695852",
"0.569178",
"0.56891036",
"0.5677401",
"0.5670215",
"0.56634057",
"0.5662156",
"0.5660037",
"0.56449723",
"0.5643359",
"0.5640982",
"0.56067467",
"0.5601399",
"0.56011415",
"0.55986464",
"0.55942315",
"0.5593237",
"0.5593237",
"0.5590525",
"0.5590525",
"0.55814505",
"0.5557499",
"0.55574596",
"0.55545014",
"0.554469",
"0.5542715",
"0.5540933",
"0.5523884",
"0.5522746",
"0.552174",
"0.5520948",
"0.55158097",
"0.55158097",
"0.5508574",
"0.55055565",
"0.55049455",
"0.5495585",
"0.54947394",
"0.54904383",
"0.548005",
"0.5478736",
"0.54733336",
"0.54715127",
"0.5463648",
"0.54597396",
"0.5457819",
"0.5457589",
"0.5456653",
"0.54561067",
"0.5450598",
"0.54368126",
"0.54368126",
"0.54368126",
"0.54368126",
"0.54368126",
"0.54368126",
"0.5426756",
"0.5426324",
"0.5421991",
"0.5417125",
"0.5415741",
"0.5414109",
"0.5408701",
"0.54063547",
"0.5401931",
"0.54013205"
] |
0.73404676
|
0
|
Return path to downloaded gem
|
def downloaded_gem_path
self.class.downloaded_gem_path @name, @version
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def gem_path\n @path || downloaded_gem_path\n end",
"def gem_path\n @path || downloaded_gem_path\n end",
"def downloaded_gem_path\n self.class.downloaded_gem_path @name, @version\n end",
"def downloaded_gem_path(name, version)\n # ensure gem is downloaded\n download_gem name, version\n GemCache.path_for(name, version)\n end",
"def package_path(extension='.gem')\n File.join(package_dir, package_basename(extension))\n end",
"def downloaded_path\n @downloaded_path ||= File.join(install_path, file_name(url))\n return @downloaded_path\n end",
"def gem_path\n File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))\n end",
"def full_gem_path\n # TODO: This is a heavily used method by gems, so we'll need\n # to aleast just alias it to #gem_dir rather than remove it.\n @full_gem_path ||= find_full_gem_path\n end",
"def full_gem_path\n # TODO: This is a heavily used method by gems, so we'll need\n # to aleast just alias it to #gem_dir rather than remove it.\n @full_gem_path ||= find_full_gem_path\n end",
"def download_gem\n self.class.download_gem @name, @version\n end",
"def gem_path\n `gem environment gemdir`.chomp\nend",
"def download_gem\n self.class.download_gem @name, @version\n end",
"def gem_build_complete_path # :nodoc:\n File.join extension_dir, 'gem.build_complete'\n end",
"def gem_dir\n directory = File.join(File.dirname(__FILE__), \"..\")\n File.expand_path(directory, File.dirname(__FILE__))\n end",
"def gem_dir\n if File.directory?(dir = File.join(working_dir, 'gems'))\n dir\n end\n end",
"def gem_dir\n if File.directory?(dir = File.join(working_dir, 'gems'))\n dir\n end\n end",
"def download(path)\n Gem.ensure_gem_subdirectories path\n\n if @spec.respond_to? :sources\n exception = nil\n path = @spec.sources.find do |source|\n begin\n source.download full_spec, path\n rescue exception\n end\n end\n return path if path\n raise exception if exception\n\n elsif @spec.respond_to? :source\n source = @spec.source\n source.download full_spec, path\n\n else\n source = Gem.sources.first\n source.download full_spec, path\n end\n end",
"def local_path\n fetch_path(DevTools.gem_root)\n end",
"def gem_dir\n return force_gem_dir if force_gem_dir\n if File.directory?(dir = default_gem_dir)\n dir\n end\n end",
"def gemfile_path\n @gemfile_path ||= GEMFILES.map { |g| @config.pwd.join g }\n .find { |f| f.exist? }\n end",
"def pkg_path\n \"pkg/#{spec.full_name}\"\n end",
"def gemspec_path\n Pathname.glob('*.gemspec').first\n end",
"def get_path(gemname, version_req)\n return gemname if gemname =~ /\\.gem$/i\n specs = SourceIndex.from_installed_gems.search(gemname, version_req)\n selected = specs.sort_by { |s| s.version }.last\n return nil if selected.nil?\n # We expect to find (basename).gem in the 'cache' directory.\n # Furthermore, the name match must be exact (ignoring case).\n if gemname =~ /^#{selected.name}$/i\n filename = selected.full_name + '.gem'\n return File.join(Gem.dir, 'cache', filename)\n else\n return nil\n end\n end",
"def gem_dir\n @gem_dir ||= File.expand_path File.join(gems_dir, full_name)\n end",
"def gem_install_dir\n if gems_use_tool_repo && tool_repo_install_dir && !user_install_enable\n path = eval_path(tool_repo_install_dir)\n else\n path = eval_path(find_val('user_gem_dir') || find_val('gem_install_dir') || home_dir)\n end\n\n append = find_val('append_gems')\n append = 'gems' if append == true || append.nil?\n\n if append\n unless path.end_with?(append)\n path = File.join(path, append)\n end\n end\n path\n end",
"def package_dir_path\n \"#{package_dir}/#{package_name}\"\n end",
"def path; Gem.ruby; end",
"def get_path_to_rails_gem\n path = ''\n rails_gem_contents = `gem contents rails -v #{get_rails_version_from_project}`\n rails_gem_contents.each_line do |contents|\n path_elements = contents.split(File::SEPARATOR)\n path_elements.pop\n path = path_elements.join(File::SEPARATOR)\n break\n end\n path\n end",
"def install_path\n Berkshelf.cookbook_store.storage_path\n .join(\"#{dependency.name}-#{revision}\")\n end",
"def elm_package_path(package)\n File.join(@git_resolver.repository_path(package), 'elm-package.json')\n end",
"def absolute_gem_binary\n ::File.expand_path(gem_binary, path)\n end",
"def gemfile_path\n @gemfile_path ||= begin\n path = ::File.expand_path(new_resource.path)\n if ::File.file?(path)\n # We got a path to a real file, use that.\n path\n else\n # Walk back until path==dirname(path) meaning we are at the root\n while path != (next_path = ::File.dirname(path))\n possible_path = ::File.join(path, 'Gemfile')\n return possible_path if ::File.file?(possible_path)\n path = next_path\n end\n end\n end\n end",
"def gem_dir(join=nil)\n if join\n File.join(gem_dir, join)\n else\n \"vendor/plugins/#{file_name}\"\n end\n end",
"def gem_dir\n return Dir.pwd unless Gem.loaded_specs.include? 'cts-mpx'\n\n Gem.loaded_specs['cts-mpx'].full_gem_path\n end",
"def get_pkg_location(cookbook)\n\n version = node.etcd.version\n base_url = get_mirror_svc('etcd')\n Chef::Log.info(\"Etcd base_url: #{base_url}\")\n\n # Replace any $version/$arch/$extn placeholder variables present in the URL\n # e.x: https://github.com/coreos/etcd/releases/download/v$version/etcd-v$version-$arch.$extn\n base_url = base_url.gsub('$version', version)\n .gsub('$arch', node.etcd.arch)\n .gsub('$extn', node.etcd.extn)\n exit_with_err(\"Invalid package base URL: #{base_url}\") unless url_valid?(base_url)\n\n file_name = File.basename(URI.parse(base_url).path)\n Chef::Log.info(\"Package url: #{base_url}, filename: #{file_name}\")\n return File.dirname(base_url), file_name\n\n end",
"def get_pkg_location(cookbook)\n\n version = node.etcd.version\n base_url = get_mirror_svc('etcd')\n Chef::Log.info(\"Etcd base_url: #{base_url}\")\n\n # Replace any $version/$arch/$extn placeholder variables present in the URL\n # e.x: https://github.com/coreos/etcd/releases/download/v$version/etcd-v$version-$arch.$extn\n base_url = base_url.gsub('$version', version)\n .gsub('$arch', node.etcd.arch)\n .gsub('$extn', node.etcd.extn)\n exit_with_err(\"Invalid package base URL: #{base_url}\") unless url_valid?(base_url)\n\n file_name = File.basename(URI.parse(base_url).path)\n Chef::Log.info(\"Package url: #{base_url}, filename: #{file_name}\")\n return File.dirname(base_url), file_name\n\n end",
"def gem_dir\n return Dir.pwd unless Gem.loaded_specs.include? 'cts-mpx'\n Gem.loaded_specs['cts-mpx'].full_gem_path\n end",
"def gem_root\n Pathname.new(__FILE__).dirname.parent.parent.expand_path\n end",
"def autoproj_gemfile_path; File.join(autoproj_install_dir, 'Gemfile') end",
"def release_path\n ::File.join(install_path, artifact_name, artifact_version)\n end",
"def dmg_dir_path\n \"#{package_dir}/#{dmg_name}\"\n end",
"def tar_path\n File.expand_path(@env[\"package.output\"], FileUtils.pwd)\n end",
"def gem_deps_file # :nodoc:\n File.basename @path\n end",
"def generate_downloaded_file_path(extension)\n \"#{File.join(Dir.tmpdir, VAGRANT_PACKAGE)}.#{extension}\"\n end",
"def installer_path\n %x[which apt-get].chomp\n end",
"def install_dir # :nodoc:\n File.join Gem.dir, 'bundler', 'gems', \"#{@name}-#{dir_shortref}\"\n end",
"def source_package_file\n pkg_file = nil\n pkg_dir = self.source_package_dir\n @source_urls.each do |url|\n poss_pkg_file = File.join(pkg_dir, File.basename(url[0]))\n if File::exists?(poss_pkg_file)\n pkg_file = poss_pkg_file\n break\n end\n end\n pkg_file\n end",
"def source_package_file\n pkg_file = nil\n pkg_dir = self.source_package_dir\n @source_urls.each do |url|\n poss_pkg_file = File.join(pkg_dir, File.basename(url[0]))\n if File::exists?(poss_pkg_file)\n pkg_file = poss_pkg_file\n break\n end\n end\n pkg_file\n end",
"def gem_name\n @gem_name ||= @source_path.sub_ext(\"\").basename.to_s\n end",
"def download_path\n ::File.join(Chef::Config[:file_cache_path],\n ::File.basename(source_path))\n end",
"def download_path\n ::File.join(Chef::Config[:file_cache_path], ::File.basename(URL))\n end",
"def install_dir # :nodoc:\n return unless File.exist? repo_cache_dir\n\n File.join base_dir, 'gems', \"#{@name}-#{dir_shortref}\"\n end",
"def path\n @backend.lib_dir + name_on_disk\n end",
"def relative_path\n File.join(@repo, @bundle)\n end",
"def gempath_to_yaypath gem_path\n\t\t\treturn \"#{gem_path}/gems/yay-#{Yay::VERSION}/data/yay\"\n\t\tend",
"def remote_path_for(package)\n File.join(path, package.trigger)\n end",
"def relative_install_path\n a = artifact\n name = File.basename(a.to_s)\n a.respond_to?(:group) ? \"#{a.group.gsub('.', '/')}/#{name}\" : \"#{name}\"\n end",
"def package_dir\r\n \"${0%/#{target_name}}\"\r\n end",
"def bundle_dir\n File.expand_path(File.join(Bixby.repo_path, self.relative_path))\n end",
"def remote_path_for(package)\n File.join(\n Config.artifactory_base_path,\n package.metadata[:name],\n package.metadata[:version],\n publish_platform(package),\n publish_platform_version(package),\n package.metadata[:basename],\n )\n end",
"def bundled_path\n File.dirname Wisp::Source.bundled_path\n end",
"def target_path(target_name)\r\n File.join(package_dir, target_name)\r\n end",
"def pack_path(name)\n path = WebpackerLite::Configuration.base_path\n file = WebpackerLite::Manifest.lookup(name)\n \"#{path}/#{file}\"\n end",
"def path_from_package(package_name)\n ret = package_from_name package_name\n ret && ret.root_path\n end",
"def pathDist\n\t\"../../\" + distPackageName + \"_\" + version + \"/\"\nend",
"def path_for(package)\n \"#{package.path}.metadata.json\"\n end",
"def package_scripts_path\n \"#{Config.project_root}/package-scripts/#{name}\"\n end",
"def manifest_path\n path = @config[\"manifest\"][\"path\"] if @config[\"manifest\"]\n return Licensed::Git.repository_root.join(path) if path\n\n @config.cache_path.join(\"manifest.json\")\n end",
"def gem_root\n @@root\n end",
"def gem_path?(file); end",
"def package_url\n \"https://github.com/arduino/arduino-cli/releases/download/#{@desired_version}/#{package_file}\"\n end",
"def find_requireable_file(file)\n root = full_gem_path\n\n require_paths.each do |lib|\n base = File.join(root, lib, file)\n Gem.suffixes.each do |suf|\n path = \"#{base}#{suf}\"\n return path if File.file? path\n end\n end\n\n return nil\n end",
"def install_dir(lib)\n if fr = ENV['FAKEROOT']\n return File.join(fr, lib)\n end\n\n lib\nend",
"def file_name\n \"#{full_name}.gem\"\n end",
"def component_libpath(cmp)\n vars = component_cmake_vars cmp\n libdir = vars.fetch('INSTALL_LIB_DIR', 'lib')\n File.join component_install_path(cmp), libdir\nend",
"def find_source_directory(gem_name, version=nil)\n if version == 'cwd'\n return Dir.pwd\n elsif version\n version_array = [\"= #{version}\"]\n else\n version_array = [\"> 0.0.0\"]\n end\n \n specs = Gem.source_index.find_name(gem_name,version_array)\n unless specs.to_a.size > 0\n raise InstallFailed, \"Can't locate version #{version}!\"\n end\n \n @install_version = specs.last.version\n message \"Installing #{app_name} #{@install_version}\"\n \n specs.last.full_gem_path\n end",
"def pkg_dir\n @pkg_dir ||= File.join( self.build_dir, \"#{name + ( version ? \"-#{version}\" : \"\" ) }\" )\n end",
"def repo_path\n @repo_path ||= \"/tmp/extension-repo-#{id}\"\n end",
"def path_for(package)\n \"#{package.path}.metadata.json\"\n end",
"def expanded_path\n relative_path(dependency.berksfile.filepath)\n end",
"def manifest_path\n build_output_dir.join('manifest.json')\n end",
"def lib_out\n @mpc_project.recipe.get_relative_path(@mpc_project.lib_out)\n end",
"def file_path path\n File.join(output_path, manifest.lookup(path).split('/')[2..-1])\n end",
"def lib_path; end",
"def lib_path; end",
"def lib_path; end",
"def remote_path\n pv = node['platform_version']\n file = if Gem::Version.new(pv) >= Gem::Version.new('10.9')\n 'X2GoClient_latest_macosx_10_9.dmg'\n else\n 'X2GoClient_latest_macosx.dmg'\n end\n \"http://code.x2go.org/releases/#{file}\"\n end",
"def build\n\t@built_gem_path ||= @helper.build_gem\nend",
"def gems_dir\n raise NotImplementedError\n end",
"def gemspec_file\n project_path( \"#{ name }.gemspec\" )\n end",
"def gem_uri\n @gem_uri ||=\n @rack_context.getInitParameter('gem.path') ||\n @rack_context.getInitParameter('gem.home') ||\n '/WEB-INF/gems'\n end",
"def local_path\n src = if %i(direct repo).include?(new_resource.source)\n package_metadata[:url]\n else\n new_resource.source.to_s\n end\n ::File.join(Chef::Config[:file_cache_path], ::File.basename(src))\n end",
"def gem_uri\n @gem_uri ||=\n @rack_context.getInitParameter('gem.path') ||\n @rack_context.getInitParameter('gem.home')\n end",
"def libfile\n libfile = Pathname.new(resource[:lib]).absolute? ? resource[:lib] : \"modules/#{resource[:lib]}\"\n end",
"def gem_r_lib\n File.expand_path(File.join(File.dirname(__FILE__), %w(.. r_lib)))\n end",
"def extension_dir\n @extension_dir ||= File.expand_path(File.join(extensions_dir, full_name)).tap(&Gem::UNTAINT)\n end",
"def default_path\n Gem.default_path + [@home]\n end",
"def license_package_location(component_name, where)\n if local?(where)\n File.join(output_dir, \"#{component_name}-#{File.split(where).last}\")\n else\n u = URI(where)\n File.join(output_dir, \"#{component_name}-#{File.basename(u.path)}\")\n end\n end",
"def license_package_location(component_name, where)\n if local?(where)\n File.join(output_dir, \"#{component_name}-#{File.split(where).last}\")\n else\n u = URI(where)\n File.join(output_dir, \"#{component_name}-#{File.basename(u.path)}\")\n end\n end",
"def gemspec_path\n unless instance_variable_defined? :@gemspec\n path = \"#{name}.gemspec\"\n\n unless File.exist?(path)\n shell.say 'No gemspec found'\n exit 1\n end\n\n @gemspec_path = path\n end\n\n @gemspec_path\n end"
] |
[
"0.86328757",
"0.8511787",
"0.8444249",
"0.764266",
"0.7624339",
"0.7498303",
"0.71763456",
"0.70950896",
"0.70950896",
"0.7091811",
"0.7047844",
"0.7008313",
"0.7005286",
"0.69122773",
"0.6885031",
"0.6885031",
"0.68829566",
"0.68764734",
"0.6868022",
"0.68548036",
"0.67847955",
"0.6769897",
"0.6744987",
"0.67422086",
"0.6728374",
"0.67259276",
"0.6702808",
"0.6658755",
"0.6643578",
"0.66244954",
"0.6619361",
"0.66183853",
"0.6617244",
"0.6570604",
"0.6515049",
"0.6515049",
"0.6504307",
"0.6502916",
"0.6492575",
"0.64525926",
"0.64489794",
"0.64471704",
"0.64207906",
"0.6419756",
"0.63971406",
"0.63971114",
"0.63900197",
"0.63900197",
"0.63864464",
"0.6371441",
"0.63557935",
"0.6349021",
"0.63463116",
"0.6307549",
"0.62823796",
"0.6271591",
"0.6271242",
"0.62536705",
"0.6249402",
"0.62360954",
"0.6221315",
"0.621993",
"0.6210741",
"0.61889815",
"0.61643386",
"0.6149231",
"0.61479855",
"0.6114298",
"0.61138296",
"0.61080325",
"0.61070925",
"0.61046517",
"0.61018103",
"0.60880136",
"0.6081778",
"0.6080638",
"0.607343",
"0.60703504",
"0.60647166",
"0.60466385",
"0.6046412",
"0.6045416",
"0.604387",
"0.6039889",
"0.6039889",
"0.6039889",
"0.6034778",
"0.60345423",
"0.6034302",
"0.6033616",
"0.60216594",
"0.60080206",
"0.6003495",
"0.60006154",
"0.5996604",
"0.59842485",
"0.5983354",
"0.5981976",
"0.5979555",
"0.5978859"
] |
0.8569027
|
1
|
Return user's full name for display
|
def name(formatter = :first_last)
if formatter
eval('"' + (USER_FORMATS[formatter] || USER_FORMATS[:first_name_last_name]) + '"')
else
@name ||= eval('"' + (USER_FORMATS[Setting.user_format] || USER_FORMATS[:first_name_last_name]) + '"')
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def full_name\n if user_data\n \"#{user_data['first_name']&.downcase&.capitalize} #{user_data['last_name']&.downcase&.capitalize}\"\n end\n end",
"def user_full_name\n if user\n user.first_name + ' ' + user.last_name\n else\n 'Anonymous'\n end\n end",
"def full_name\n name = `finger $USER 2> /dev/null | grep Login | colrm 1 46`.chomp\n name.empty? ? \"John Doe\" : name.squish\n end",
"def full_name\n name = `finger $USER 2> /dev/null | grep Login | colrm 1 46`.chomp\n name.present? ? name.squish : \"John Doe\"\n end",
"def full_name\n if self.profile.present?\n \"#{self.profile.first_name.capitalize} #{self.profile.last_name.capitalize}\"\n else\n \"#{username.capitalize}\"\n end\n end",
"def full_name(user)\n user.first_name + ' ' + user.last_name\n end",
"def full_name\n\t\tself.user_fname.capitalize + \" \" + self.user_lname.capitalize\n\tend",
"def proper_name # method to get the full name of user\n first_name + \" \" + last_name\n end",
"def full_user_name\n formatedName=first_name[0].upcase+first_name[1,first_name.size].downcase+\" \"+last_name[0].upcase+last_name[1,last_name.size].downcase\n return formatedName.strip if (first_name || last_name)\n return \"Anonymous\"\n end",
"def display_name_for(user)\n user.first_name.capitalize + ' ' + user.last_name.capitalize + ' ( ID: ' + user.reference_number + ')'\n end",
"def full_name\n \tif !self.first_name.nil? && !self.last_name.nil?\n\t\t\"#{self.first_name.titleize} #{self.last_name.titleize}\"\n\telsif !self.oauth_user_name.nil?\n\t\tself.oauth_user_name\n\telse\n\tend\n end",
"def user_full_name\n user ? user.full_name : \"Anonymous\"\n end",
"def short_user_name\n user.first_name\n end",
"def full_name \n if current_user\n current_user.firstname + \" \" + current_user.lastname\n else\n \"Please Log in\"\n end\n end",
"def full_name\n if self.user\n user.full_name\n else\n self.name\n end\n end",
"def user_full_name\n first_name + \" \" + last_name\n end",
"def display_name\n username\n end",
"def full_name\n \tif self.first_name != nil and self.last_name != nil\n \t\tself.first_name + \" \" + self.last_name\n \telse\n \t\t\"User does not have a full name\"\n \tend\n end",
"def full_name\n \"#{self.first_name} #{self.last_name}\"\n # can got to rails console and type command \"user = User.first\" => \"user.full_name\"\n end",
"def full_name\n \"#{username}/#{name}\"\n end",
"def user_display_name\n return @user_display_name\n end",
"def user_display_name\n return @user_display_name\n end",
"def user_display_name\n return @user_display_name\n end",
"def full_name\n \n if (not self.first_name.nil? and not self.first_name.eql? \"\") or (not self.last_name.nil? and not self.last_name.eql? \"\")\n \"#{self.title} #{self.first_name} #{self.last_name}\".strip\n elsif self.username\n self.username \n else\n # wrapped email only prefix\n\n parsed_email = self.email.split('@')\n parsed_email[0]\n end\n end",
"def display_name\n full_name.join(\" \")\n end",
"def display_name\n \"#{username} <#{email}>\"\n end",
"def display_name \n username\n end",
"def full_name\n \"#{user_profile.first_name} #{user_profile.last_name}\" unless user_profile.blank?\n end",
"def get_full_name(user_id)\n if user_id\n u = User.find(user_id)\n return u.firstname + \" \" + u.lastname\n else\n return \"Unknown\"\n end\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name()\n name + ' ' + last_name\n end",
"def user_full_name\n @user[\"name\"]\n end",
"def user_display_name\n @attributes[:user_display_name]\n end",
"def full_name\n (@session[:current_user_details] || {})[:description]\n end",
"def display_name\n entry = JSON.parse(self.entry)\n user = User.find(user_id)\n \"#{user.display_name} #{entry['text']}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n\t\treturn self.salutation.to_s + \" \" + self.last_name.to_s + \" \" + self.first_name.to_s\n end",
"def full_name\n return first_name + \" \" + last_name\n end",
"def full_name\n return first_name + \" \" + last_name\n end",
"def full_name\n \treturn \"#{first_name} #{last_name}\".strip if(first_name || last_name) \n \t\"Anonymous\"\n end",
"def full_name\n return \"#{@first_name} #{@last_name}\"\n end",
"def full_name\n return \"#{@first_name} #{@last_name}\"\n end",
"def get_display_name\n @display_name ||= self.user.display_name\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def name\n\t\tn = names\n\t\treturn n[:fullname] if n[:fullname]\n\t\treturn n[:username] if n[:username]\n\t\treturn I18n.translate(\"user.name.unknown\")\n\tend",
"def show_name\n return_string = \"\"\n if first_name.present? || last_name.present?\n return_string = \"#{first_name} #{last_name}\".strip\n end\n if login.present?\n return_string = return_string.blank? ? login : \"#{return_string} (#{login})\".strip\n end\n if return_string.blank?\n return_string = email\n end\n return_string\n end",
"def name\n \"#{user_name.titleize}\"\n end",
"def user_full_name\n return object.billing_name if object.billing_name.present?\n \"#{user_firstname} #{user_lastname}\"\n end",
"def display_name\n #self.email.split('@')[0]\n self.username\n end",
"def name_display\n if first_name || last_name\n \"#{first_name} #{last_name}\".strip\n else\n email\n end\n end",
"def simple_username\n return user.firstname + ' ' + user.lastname.first + '.' if !user.nil?\n name\n end",
"def full_name\n return '' unless profile\n profile.full_name\n end",
"def full_name\n \"#{first_name}\" \" #{last_name}\"\n end",
"def full_name\n \"#{self.nickname.blank? ? self.first_name : self.nickname} #{self.last_name}\"\n end",
"def full_name\n if !first_name && !last_name\n return \"New User\"\n else\n return first_name + \" \" + last_name\n end\n end",
"def full_name\n first_name + \" \" + last_name\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def display_full_name\n \"#{self.name} #{self.last_name}\"\n end",
"def display_user(user)\n user.name\n end",
"def display_name\n if cas_surname and cas_givenname\n cas_givenname + ' ' + cas_surname\n else\n username\n end\n end",
"def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend",
"def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend",
"def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend",
"def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend",
"def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend",
"def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend",
"def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"def full_name\n \"#{first_name.titleize} #{last_name.titleize}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\".titleize\n end",
"def full_name\n \"#{first_name} #{last_name}\".titleize\n end",
"def full_name\n \"#{first_name} #{last_name}\".strip.squeeze(' ').titleize\n end",
"def full_name\n \t\"#{first_name} #{last_name}\"\n end",
"def name\n if first_name.present? || last_name.present?\n [first_name, last_name].join(\" \").strip\n else\n username\n end\n end",
"def full_name\n \"#{@first_name} #{@last_name}\"\n end",
"def full_name\n @first_name + ' ' + @last_name\n end",
"def user_name\n\t\tobject.user.full_name \n\tend",
"def fullname\n \"#{first_name} #{last_name}\"\n end",
"def sol_full_name(user)\n user.sol_f_name + ' ' + user.sol_fl_name\n end",
"def full_name\n firstname.capitalize() + \" \" + lastname.capitalize()\n end",
"def display_name\n return \"#{first_name} #{last_name}\".strip if first_name\n return email\n end",
"def full_name\n # TODO: update method -> \"${name}, ${last_name}\"\n name\n end",
"def fullname\n return @first_name.capitalize + \" \" + @surname.capitalize\n end",
"def full_name\n self.first_name + \" \" + self.last_name\n end",
"def full_name\n \"#{last_name} #{first_name}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end"
] |
[
"0.8776414",
"0.868374",
"0.8585989",
"0.85622734",
"0.85540235",
"0.8520409",
"0.8489057",
"0.8476972",
"0.836573",
"0.8358091",
"0.8353521",
"0.8322302",
"0.8317349",
"0.8301317",
"0.82975614",
"0.82645774",
"0.8261927",
"0.82473344",
"0.82256263",
"0.8222661",
"0.8221144",
"0.8221144",
"0.8221144",
"0.82187814",
"0.8216932",
"0.8209706",
"0.8199152",
"0.81697065",
"0.8169206",
"0.81630445",
"0.81630445",
"0.81630445",
"0.8152753",
"0.8129717",
"0.8118632",
"0.80926865",
"0.80923086",
"0.80892426",
"0.8079834",
"0.8079749",
"0.8079749",
"0.8072614",
"0.80695575",
"0.80695575",
"0.8037176",
"0.80354005",
"0.8034443",
"0.8026337",
"0.8017075",
"0.8011465",
"0.80071187",
"0.80066276",
"0.80027485",
"0.7992179",
"0.7975322",
"0.79748833",
"0.7973491",
"0.79634595",
"0.796031",
"0.79573405",
"0.7956962",
"0.7953165",
"0.7926157",
"0.7926157",
"0.7926157",
"0.7926157",
"0.7926157",
"0.7926157",
"0.79158884",
"0.79136926",
"0.7913257",
"0.7913257",
"0.7913002",
"0.7903065",
"0.78997445",
"0.7894912",
"0.78821415",
"0.78795284",
"0.7879261",
"0.7876375",
"0.7873204",
"0.78703964",
"0.78695756",
"0.7862053",
"0.7851577",
"0.7850625",
"0.78488666",
"0.78488666",
"0.78488666",
"0.78488666",
"0.78488666",
"0.78488666",
"0.78488666",
"0.78488666",
"0.78488666",
"0.78488666",
"0.78488666",
"0.78488666",
"0.78488666",
"0.78488666",
"0.78488666"
] |
0.0
|
-1
|
This only formats MMYYYY
|
def format_month_year(date)
date.strftime("%Y-%b")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def format_date(month, year)\n \"#{format(month,:two_digits)}/#{format(year, :two_digits)}\"\n end",
"def format_date(month, year)\n \"#{format(month,:two_digits)}/#{format(year, :two_digits)}\"\n end",
"def format_ap_date(date_obj)\n date_obj = DateTime.parse(date_obj) unless date_obj.is_a? DateTime\n\n if [*3..7].include? date_obj.month # months 3,4,5,6,7 are written as is in AP\n date_obj.strftime('%B %-d, %Y')\n elsif date_obj.month == 9 # Sept. is special\n date_obj.strftime('%bt. %-d, %Y')\n else # 3 letter abbr with .\n date_obj.strftime('%b. %-d, %Y')\n end\nend",
"def year_month(date, fmt=\"yyyy mmm\")\n return nil unless date\n yyyy = date.year.to_s\n mmm = %w(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)[date.month-1]\n case fmt\n when \"mmm-yy\" then \"%s-%s\" % [mmm, yyyy[2, 2]]\n when \"mmm yyyy\" then \"%s %s\" % [mmm, yyyy]\n else \"%s %s\" % [yyyy, mmm]\n end\n end",
"def sortable_year_for_yyyy\n matches = orig_date_str.match(/\\d{4}/) if orig_date_str\n matches.to_s if matches\n end",
"def format_date(date)\n if date.nil?\n return \"\"\n end\n if date.year == Date.today.year\n return date.strftime(\"%A, %B %-d\") unless date.nil?\n else\n return date.strftime(\"%A, %B %-d %Y\") unless date.nil?\n end\n end",
"def format_date\n chars = @date.split('')\n chars.pop(6)\n chars.join('')\n end",
"def formatted_date( date )\n date.strftime( \"%Y-%b-%d\" ) + \" \" + date.strftime( \"%A\" ).slice( 0..2 ) unless date == nil\n end",
"def format_year(year)\n \"#{year}-#{year+1}\"\n end",
"def format_month(month)\n month.to_s.insert(0, \"0\") unless month.to_s.length == 2\n end",
"def strftime_to_ms_format numberformat\n return nil if numberformat.nil?\n numberformat.gsub(\"%Y\", \"yyyy\").gsub(\"%A\", \"dddd\").gsub(\"%B\", \"mmmm\").gsub(\"%a\", \"ddd\").gsub(\"%b\", \"mmm\").gsub(\"%y\", \"yy\").gsub(\"%d\", \"dd\").gsub(\"%m\", \"mm\").gsub(\"%y\", \"y\").gsub(\"%y\", \"%%y\").gsub(\"%e\", \"d\")\n end",
"def format_date(date)\n date.strftime(\"%b #{date.day.ordinalize}, %Y\")\n end",
"def expected_note_short_date_format(date)\n (Time.now.strftime('%Y') == date.strftime('%Y')) ? date.strftime('%b %-d') : date.strftime('%b %-d, %Y')\n end",
"def to_year\n month_obj = []\n month_obj << \"#{month_name}\".center(DEFAULT_MONTH_WIDTH)\n month_obj << \"Su Mo Tu We Th Fr Sa\"\n month_obj.concat(format_body)\n end",
"def normalize_date(date)\r\n if date.chars.length==3\r\n norm_date = Date.strptime(date, '%m-%d')\r\n else\r\n norm_date = Date.strptime(date, '%m-%d-%y')\r\n end\r\n norm_date = norm_date.to_s\r\nend",
"def date_format(datetime)\n datetime.strftime(\"%Y年%m月%d日\") unless datetime.blank?\n end",
"def pretty_date\n from_index[:modified].sub(/(\\d{4})(\\d{2})(\\d{2})\\d{6}/,'\\1-\\2-\\3')\n end",
"def format_date(year, month = 1, day = 1)\n format_year(year) + format_month(month) + format_day(day)\n end",
"def date_move_formatter\n '%Y-%m'\n end",
"def format_date(date)\n date.strftime(\"%d %B %Y\")\n end",
"def formatFullDate(date)\n date.strftime(\"%A | %B #{date.day.ordinalize}, %Y\")\n end",
"def format_date_nicely(date)\nend",
"def to_s\n \"#{year}-#{month.to_s.rjust(2, '0')}\"\n end",
"def month_format(date)\n return nil if date.blank?\n date.strftime('%b')\n end",
"def month_format(date)\n return nil if date.blank?\n date.strftime('%b')\n end",
"def post_year\n chars = @date.split('')\n chars.pop(4).join('').to_i\n end",
"def get_year_with_number\n date_receipt.strftime(\"%Y\") + \"-\" + sprintf( \"%03i\", receipt_num )\n end",
"def nice_date_form(the_date)\n \treturn the_date ? the_date.strftime('%b %d, %Y') : ''\n\tend",
"def show_date_format(time)\n unless time.blank?\n time.strftime(\"%Y年%m月%d日\") rescue '--'\n end\n end",
"def pretty_date(input_date)\n return input_date.strftime(\"%d %B %Y\")\n end",
"def fmt_date(date)\n if (date)\n date.strftime(\"%m-%d-%Y\")\n end\n end",
"def expected_note_long_date_format(date)\n format = (Time.now.strftime('%Y') == date.strftime('%Y')) ? date.strftime('%b %-d %l:%M%P') : date.strftime('%b %-d, %Y %l:%M%P')\n format.gsub(/\\s+/, ' ')\n end",
"def format_date date\n date.strftime('%m/%d/%y')\n end",
"def dateify_dob\n self.dob ||= \"\"\n parts = self.dob.split(\"/\").map{|i| i.to_i}\n self.dob = \"#{parts[0].to_s.rjust(2, \"0\")}/#{parts[1].to_s.rjust(2, \"0\")}/#{parts[2]}\"\n end",
"def reformat_date_for_save(date_string)\n return if date_string.nil?\n month = \"1\"\n day = \"1\"\n year = \"1900\"\n #match = date_string.gsub(\"-\",\"/\").match(/(\\d+)\\/|\\-(\\d+)\\/|\\-(\\d+)/)\n match = date_string.gsub(\"-\", \"/\").split(\"/\")\n month_numbers = {\"Jan\" => \"1\", \"Feb\" => \"2\", \"Mar\" => \"3\", \"Apr\" => \"4\", \"May\" => \"5\", \"Jun\" => \"6\",\n \"Jul\" => \"7\", \"Aug\" => \"8\", \"Sep\" => \"9\", \"Oct\" => \"10\", \"Nov\" => \"11\", \"Dec\" => \"12\"}\n format_codes = GlobalSettings[:default_date_format].gsub(\"-\", \"/\").gsub(\" \", \"/\").split(\"/\")\n format_codes.each_with_index do |fmt, idx|\n case fmt.downcase\n when '%m'\n month = match[idx]\n when '%d'\n day = match[idx]\n when '%y'\n year = match[idx]\n when '%b'\n month = month_numbers[match[idx]]\n end\n end\n \"#{year}-#{month}-#{day}\"\n end",
"def format_table_date_range(date)\n date.strftime('%Y%m*')\n end",
"def spelled_out_for_date(date)\n %w[%B %b].map { |month| date.strftime(\"#{month} %Y\") }\n end",
"def comment_year(datetime)\n datetime.year != DateTime.now.year ? \"#{datetime.year} \" : \"\"\n end",
"def normalize_date_pair(pair)\n pair = full_year!(pair) if full_year?(pair)\n\n year = pair.map do |x|\n x.match(/\\d{4}/).to_s\n end.reject(&:empty?).first\n\n pair.map do |x|\n x =~ /\\d{4}/ ? x : \"#{x} #{year}\"\n end\n end",
"def change_date_format(date)\n date_array = date.split(\"/\")\n if date_array[1].to_i > 12\n new_date = date_array[1]+\"/\"+date_array[2]+\"/\"+date_array[0]\n else\n new_date = date_array[0]+\"/\"+date_array[2]+\"/\"+date_array[1]\n end\n puts \"anusha\"\n puts new_date.inspect\n return new_date\n end",
"def template\n if self.style == 'mmyy'\n 'date_field_mmyy'\n else\n 'date_field'\n end\n end",
"def to_s; \"%d-%02d\" % [@years, @months.abs] end",
"def format_date(date)\n date.strftime '%d-%m-%Y'\n end",
"def fmt_date(date)\n if (date == :now)\n return Date.today\n end\n if (date.is_a? Integer)\n date = {:year => date, :month => 1}\n end\n Date.parse(date[:year].to_s+\"-\"+date[:month].to_s+\"-01\")\n end",
"def date_reformatting(date)\n #date.split('/')..join(',')\n Date.parse.(date).strftime'[%m, %d, %Y]'\nend",
"def reformat(string, format)\n case format\n when \"MM/YYYY\"\n val = string.to_i\n sprintf(\"%02d/%4d\", val % 12 + 1, val / 12)\n when /.*%.*f.*/\n sprintf(format, string.to_f).gsub(/(\\d)(?=\\d{3}+(\\.\\d*)?[^0-9]*$)/, '\\1,')\n when /.*%.*d.*/\n sprintf(format, string.to_i).gsub(/(\\d)(?=\\d{3}+(\\.\\d*)?[^0-9]*$)/, '\\1,')\n else\n string\n end\nend",
"def view_date(str)\r\n\t\t(wday,day,mon,year,hhmmss,etc) = str.to_s.split(/ /)\r\n\t\tmonth = @months[mon]\r\n\t\tstr = \"#{year}\\/#{month}\\/#{day} #{hhmmss}\"\r\n\t\treturn str\r\n\tend",
"def format_date(date) \r\n (date == \"mm/dd/yy\" || date == \"MM/DD/YY\" || date.blank?)? nil : Date.strptime(date, '%m/%d/%y')\r\n end",
"def year_name(number); end",
"def date_format_readable(date)\n #date.strftime '%Y-%b-%d'\n date.strftime '%b %d %Y' if date.present?\n end",
"def sortable_year_str_for_early_numeric\n return unless orig_date_str.match(EARLY_NUMERIC)\n\n if orig_date_str =~ /^\\-/\n # negative number becomes x - 1000 for sorting; -005 for -995\n num = orig_date_str[1..-1].to_i - 1000\n return '-' + num.to_s[1..-1].rjust(3, '0')\n else\n return orig_date_str.rjust(4, '0')\n end\n end",
"def input_date_format(date)\n if date.split(\"-\").count > 2\n new_date = date.split(\"-\")\n return new_date[1] + \"-\" + new_date[0]\n else\n return date\n end\n end",
"def year\n created.strftime '%Y'\n end",
"def year\n #Para que salga con el formato de ARG\n fecha = Date.parse(self.created_at.to_s)\n fecha.strftime('%Y')\n end",
"def formatwrittendate(unformattedtime)\n unformattedtime.strftime('%A, %d %B, %Y')\n end",
"def monthstamp(year, month)\n \"#{year}#{month.to_s.rjust(2, \"0\")}\".to_i\nend",
"def good_date(dd)\n dd = dd.to_s\n dd = \"0\" + dd if dd.length<2\n dd\n end",
"def good_date(dd)\n dd = dd.to_s\n dd = \"0\" + dd if dd.length<2\n dd\n end",
"def good_date(dd)\n dd = dd.to_s\n dd = \"0\" + dd if dd.length<2\n dd\n end",
"def datetime_format\n /^\\d{4}-\\d{2}-\\d{2}\\w\\d{2}:\\d{2}:\\d{2}/\n end",
"def formatted_date(date)\n date.present? ? date.strftime(\"%A, %B %d, %Y\") : \"\"\n end",
"def build_date_from_year_month(data)\n dt = data['year']\n if data['month']\n dt += '-' + data['month'] + '-1'\n end\n dt\n end",
"def date(input, format); end",
"def year_name(number)\n if year_format_lambda = @options[:year_format]\n year_format_lambda.call(number)\n else\n number\n end\n end",
"def w_year\n @obj.date.strftime(\"%G\")\n end",
"def format_date1(original_date)\n original_date.sub(/\\A(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)\\z/, '\\3.\\2.\\1')\nend",
"def format_date(original_date_str)\n original_date_str.sub(%r{\\A(\\d{4})([-/])(\\d{2})\\2(\\d{2})\\z},'\\4.\\3.\\1')\nend",
"def format_start_end_date(s_date, e_date)\n # Format the dates based on month and year.\n if (s_date.mon == e_date.mon) && (s_date.year == e_date.year)\n date = s_date.strftime(\"%b %d-\").to_s + e_date.strftime(\"%d, %Y\").to_s\n elsif s_date.year == e_date.year\n date = s_date.strftime(\"%b %d - \").to_s + e_date.strftime(\"%b %d, %Y\").to_s\n else\n date = s_date.strftime(\"%b %d, %Y - \").to_s + e_date.strftime(\"%b %d, %Y\").to_s\n end\n date\n end",
"def formatted_date(field)\n self.send(field).strftime('%b %d, %Y') if self.send(field).present?\n end",
"def name_of_month(style = :full)\n @time.strftime(style == :full ? \"%B\" : \"%b\")\n end",
"def format_date(date)\n return date unless !!date.match(/[\\-]+/)\n date.split(/\\-/).reverse.join(\".\")\nend",
"def format_date(original_date)\n original_date.sub(/\\A(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)\\z/, '\\3.\\2.\\1')\nend",
"def format_date(original_date)\n original_date.sub(/\\A(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)\\z/, '\\3.\\2.\\1')\nend",
"def short_date( date )\n date.strftime( '%b %d, %Y')\n end",
"def format_date(date, format)\n date = datetime(date)\n if format.nil? || format.empty? || format == \"ordinal\"\n date_formatted = ordinalize(date)\n else\n format.gsub!(/%a/, ABBR_DAYNAMES_DE[date.wday])\n format.gsub!(/%A/, DAYNAMES_DE[date.wday])\n format.gsub!(/%b/, ABBR_MONTHNAMES_DE[date.mon])\n format.gsub!(/%B/, MONTHNAMES_DE[date.mon])\n date_formatted = date.strftime(format)\n end\n date_formatted\n end",
"def format_date\n object.created_at.strftime(\"%b %d, %Y\")\n end",
"def format_date(datetime)\n return datetime if !datetime.respond_to?(:strftime)\n datetime.strftime(\"%m-%d-%Y\")\n end",
"def lsish\n strftime \"%e. %b \" + (year == Time.start.year ? \"%H:%M:%S\" : \"%Y \")\n end",
"def zt_date date\n if date.year == Time.now.year\n l date, format: :short\n else\n l date, format: :long\n end\n end",
"def format_date(text)\n text.gsub(/(\\d\\d\\d\\d)([\\-\\/])(\\d\\d)\\2(\\d\\d)/, '\\4.\\3.\\1')\nend",
"def format_date(date)\n date = DateTime.parse(date)\n date.strftime('%m/%d/%y')\n end",
"def format_start_date()\n\t\tif Date.valid_date?(self.year, self.month, self.day)\n\t\t\treturn self.month.to_s + '/' + self.day.to_s\n\t\telse\n\t\t\traise \"Invalid start date specified.\"\n\t\tend\n\tend",
"def fmt_date(dt)\n if dt.present?\n dt.strftime(ApplicationHelper.date_fmt)\n end\n end",
"def sortable_year_for_yyyy_or_yy\n # most date strings have a four digit year\n result = sortable_year_for_yyyy\n result ||= sortable_year_for_yy # 19xx or 20xx\n result\n end",
"def format_date(str)\n str.sub(/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)$/, '\\3.\\2.\\1')\nend",
"def validate_year_date(field)\n date = nil\n formats = [\"%d/%m/%Y\",\"%d-%m-%Y\",\"%d %m %Y\",\"%m/%d/%Y\",\"%m-%d-%Y\",\"%m %d %Y\"]\n formats.each do |format|\n if(Date.strptime(field, format) rescue false)\n date = Date.strptime(field, format)\n break\n end\n end\n unless date.nil?\n field = date.to_s.scan(/\\d*/) # Return an array with patterns matching with only numbers in it\n if field[0].length == 4\n return true\n else\n return false\n end\n else\n return false\n end\n end",
"def format_date_nicely(date)\n\tn = Time.new(2013, 10, 31)\n\tn.strftime(\"%d/%m/%Y\")\nend",
"def month\n @month.to_s.rjust(2, '0')\n end",
"def formatFullDate(date)\n date.strftime(\"%A, %B %d, %Y\")\n end",
"def date_formatted\n date.strftime(\"%A %B %d, %Y\")\n end",
"def datetime_format\n end",
"def number_to_short_month_name(a)\n return number_to_full_month_name(a).slice(0,3)\nend",
"def year_month_int_to_str(year_month)\n \"#{year_month / 12} #{MONTHS[year_month % 12]}\"\n end",
"def format_fuzzy_date(d)\n if is_numeric_string(d, 8)\n year, mon, day = d.slice(0, 4), d.slice(4, 2), d.slice(6, 2)\n date = ''\n if year.to_s.length > 0 && year != '0000'\n date += year\n end\n if mon.to_s.length && mon != '00'\n mon_int = mon.to_i\n date += '-' + sprintf(\"%02d\", mon_int)\n\n if day.to_s.length && day != '00'\n day_int = day.to_i\n date += '-' + sprintf(\"%02d\", day_int)\n end\n end\n return date\n end\n d\n end",
"def format_date(date)\n date.gsub(/^(\\d{4})-(\\d{2})-(\\d{2}$)/, '\\3.\\2.\\1') #capture groups make this way easier!\nend",
"def format_date(original_date)\n date_regex = /\\A(\\d\\d\\d\\d)([\\-\\/])(\\d\\d)\\2(\\d\\d)\\z/\n original_date.sub(date_regex, '\\4.\\3.\\1')\nend",
"def normalize_dates!\n pub_date = self.emma_publicationDate&.to_s\n pub_year = pub_date&.first(4)\n if pub_date&.end_with?('-01-01')\n self.dcterms_dateCopyright ||= IsoYear.new(pub_year)\n cpr_date = self.dcterms_dateCopyright.to_s\n self.emma_publicationDate = nil if cpr_date == pub_year\n elsif (cpr_date = self.dcterms_dateCopyright&.to_s)\n self.dcterms_dateCopyright = nil if cpr_date == pub_year\n end\n end",
"def date_short(date)\n\t\tdate.strftime(\"%b %e, %Y\") if !date.blank?\n\tend",
"def formatted_smalldate(d) # Mon, Januaury 01\n d.strftime('%b, %d') unless !d\n end",
"def clean_date(date)\n mo_day_year = date.split(\" \")[0]\n \n return mo_day_year.split(\"/\")\nend"
] |
[
"0.71196556",
"0.71196556",
"0.6733248",
"0.67012584",
"0.6603148",
"0.65891355",
"0.65476215",
"0.6544962",
"0.6523477",
"0.6468496",
"0.6459266",
"0.64371973",
"0.6404232",
"0.6392666",
"0.63622385",
"0.6317562",
"0.6307046",
"0.62962246",
"0.6293782",
"0.62904775",
"0.6253989",
"0.623116",
"0.62285703",
"0.61915845",
"0.61915845",
"0.6178757",
"0.61619675",
"0.6130059",
"0.6117002",
"0.6100273",
"0.6081391",
"0.60795987",
"0.6079451",
"0.6070576",
"0.60625106",
"0.6056328",
"0.60473204",
"0.6035311",
"0.6028187",
"0.60157156",
"0.60040843",
"0.59890115",
"0.5987207",
"0.59828323",
"0.59781355",
"0.5949012",
"0.59419537",
"0.5935911",
"0.5918735",
"0.59134775",
"0.59129095",
"0.59025395",
"0.59003294",
"0.58759904",
"0.58750176",
"0.58691716",
"0.5862463",
"0.5862463",
"0.5862463",
"0.58434665",
"0.58428323",
"0.5839024",
"0.5837616",
"0.58339846",
"0.58319104",
"0.582971",
"0.5825536",
"0.5821156",
"0.5796905",
"0.579336",
"0.5791013",
"0.5789789",
"0.5789789",
"0.5788077",
"0.57783294",
"0.5778263",
"0.5774643",
"0.5767986",
"0.57650745",
"0.5755811",
"0.57498944",
"0.57410985",
"0.57406956",
"0.5737466",
"0.5737052",
"0.57336295",
"0.5731358",
"0.57275105",
"0.57259035",
"0.5723226",
"0.57231057",
"0.57202613",
"0.57167614",
"0.5711391",
"0.57111824",
"0.57035154",
"0.57020676",
"0.56976",
"0.56922394",
"0.569056"
] |
0.713793
|
0
|
The return reserved word is not required in order to return something from a method
|
def just_assignment(number)
foo = number + 3
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def returns; end",
"def return_value; end",
"def return_a_value\n \"Nice\"\nend",
"def method_with_explicit_return\n :a_non_return_value\n return :return_value\n :another_non_return_value\n end",
"def return_type; end",
"def return_type; end",
"def return_type; end",
"def a \n return 1\nend",
"def foo\n\treturn 'bar'\nend",
"def returnsomething\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 18 )\n\n begin\n # at line 613:5: expression\n @state.following.push( TOKENS_FOLLOWING_expression_IN_returnsomething_848 )\n expression\n @state.following.pop\n # --> action\n\n \trt = @stack_operands.pop\n rt_t = @stack_types.pop\n if(rt_t != @current_method.return_type)\n raise \"Invalid return type #{rt_t} in the #{@current_method.return_type} type method #{@current_class.name}::#{@current_method.name}\"\n end\n generate('ret', nil, nil ,rt )\n @is_returning = true\n free_avail(rt)\n free_avail_const(rt)\n \n \n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 18 )\n\n end\n \n return \n end",
"def metodo_con_return\n return 2 + 5\nend",
"def returns=(_arg0); end",
"def myreturn\n @myreturn\n end",
"def return(&block); end",
"def result()\n end",
"def hello\r\n return \"Hello there\"\r\nend",
"def hello\n return \"Hello\"\nend",
"def returns val = nil\n @returns = val\n self\n end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def say_hello\n return \"hello\"\nend",
"def add(a, b)\n a + b; # 'return' is implicit\nend",
"def print_me\n return \"I'm printing the return value!\"\nend",
"def hello\n return \"hello world\"\nend",
"def hello\r\n return \"hello world\"\r\nend",
"def my_name() # Start of a function declaration\n return(\"Zoo Lander\") # Explicit return with parenthesis\nend",
"def greet\n return \"hello world!\"\nend",
"def return!(&block); end",
"def exMethod\r\n # explicitly the last line will be the return\r\n\t# return var is also allowed but this also works\r\n $var\r\nend",
"def test_method\n return \"The method will return this string here!\"\n puts \"This line of code will not run.\"\nend",
"def return_10\n return 10\nend",
"def greet\n return \"hello world!\"\nend",
"def returns_something?; @return_type || !@returned_arguments.empty? end",
"def result?; end",
"def return_name\n 'Taynara'\nend",
"def greeter\n return 'Hello World!'\nend",
"def supports_returning?\n false\n end",
"def ret!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 1)\n\n type = RET\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 7:7: 'returns'\n match(\"returns\")\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 1)\n\n end",
"def return_a_value\n name = \"Austin\"\n return name\n name = \"Brian\"\nend",
"def add(a, b)\n a + b # implicit return\nend",
"def return\n @v_return\n end",
"def five\n return 5 # Some people choose to use the return statement just to be clear, \n end",
"def something\n \"foo\"\nend",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def return_value\n @return_value\n end",
"def return!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 25 )\n\n type = RETURN\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 327:10: 'return'\n match( \"return\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 25 )\n\n end",
"def result\n raise NotImplementedError, \"#{self.class} has not implemented method '#{__method__}'\"\n end",
"def return!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 20 )\n\n type = RETURN\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 141:10: 'return'\n match( \"return\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 20 )\n\n end",
"def something\n end",
"def student_talks()\n return \"I can talk!\"\nend",
"def a\n return true\nend",
"def return!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 45 )\n\n\n\n type = RETURN\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 223:9: 'return'\n match( \"return\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 45 )\n\n\n end",
"def meal \n puts 'Dinner'\n return 'Breakfast'\nend",
"def whatever\n end",
"def greeting(name)\n return \"Hello #{name}! Nice to meet you!\"\nend",
"def some_method(number)\n number = 7 # this is implicitly returned by the method\nend",
"def meal\n puts \"Dinner\"\n return \"Breakfast\"\nend",
"def returns_nil; end",
"def some_method(number)\n\tnumber = 7 # this is implicitly returned by the method\nend",
"def return_type_void\n @return_type_void\n end",
"def supports_returning?(type)\n true\n end",
"def supports_returning?(type)\n true\n end",
"def returner\n ok params\n end",
"def something\n\nend",
"def greet(name)\n return puts \"Hello, #{name} how are you doing today?\"\nend",
"def original_result; end",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def return_value=(_arg0); end",
"def bye(a)\n return a\nend",
"def hello\r\n\treturn \"Hello World\"\r\nend",
"def goodbye(name)\n return = \"Bye \" + name + \".\"\nend",
"def result=(_); end"
] |
[
"0.83451164",
"0.7845633",
"0.75585055",
"0.75006557",
"0.7370031",
"0.7370031",
"0.7370031",
"0.73550564",
"0.7283366",
"0.71213615",
"0.7119428",
"0.7034524",
"0.7026671",
"0.7023651",
"0.70214653",
"0.7007164",
"0.70053715",
"0.69983065",
"0.6961716",
"0.6961716",
"0.6961716",
"0.6961716",
"0.6961716",
"0.6961716",
"0.6961716",
"0.6961716",
"0.69607025",
"0.6955831",
"0.69303226",
"0.68919826",
"0.68684",
"0.6857332",
"0.6853602",
"0.67966175",
"0.67798525",
"0.67794526",
"0.6773785",
"0.67556065",
"0.6747471",
"0.6736483",
"0.6721113",
"0.670575",
"0.6670626",
"0.66275483",
"0.6597273",
"0.65922886",
"0.65862924",
"0.658598",
"0.65700513",
"0.65497375",
"0.65497375",
"0.65497375",
"0.65497375",
"0.65497375",
"0.65497375",
"0.65497375",
"0.65497375",
"0.65497375",
"0.65497375",
"0.65497375",
"0.65497375",
"0.6548078",
"0.6527042",
"0.6525489",
"0.65069795",
"0.65015125",
"0.6490731",
"0.6464232",
"0.64609814",
"0.64550686",
"0.6437814",
"0.6428206",
"0.6423343",
"0.6416595",
"0.64163995",
"0.6412184",
"0.6411945",
"0.64090395",
"0.64090395",
"0.6392118",
"0.6371029",
"0.6368862",
"0.6363242",
"0.63545984",
"0.63545984",
"0.63545984",
"0.63545984",
"0.63545984",
"0.63545984",
"0.63545984",
"0.63545984",
"0.63545984",
"0.63545984",
"0.63545984",
"0.63545984",
"0.63545984",
"0.6342027",
"0.6329707",
"0.6328118",
"0.6328029",
"0.6311946"
] |
0.0
|
-1
|
Determines all of the attributes defined for a controller, then, calls the handler method on the controller to generate and return an Array of Hashes representing all of the url nodes to be included in the sitemap for the current route being processed.
|
def sitemap_setup(options = {})
rows = []
DuckMap.logger.debug "sitemap_setup: action_name => #{options[:action_name]} source => #{options[:source]} model => #{options[:model]}"
attributes = self.sitemap_attributes(options[:action_name])
DuckMap.logger.debug "sitemap_setup: attributes => #{attributes}"
if attributes.kind_of?(Hash) && attributes[:handler].kind_of?(Hash) && !attributes[:handler][:action_name].blank?
config = {handler: attributes[:handler]}.merge(options)
rows = self.send(attributes[:handler][:action_name], config)
end
return rows
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fetch_controller_parameters\n generate_routes_file\n controller_files, paths_to_hit = fetch_controllers, []\n controller_files.each do |file_name|\n file, controller = File.expand_path(file_name, \"#{Rails.root}/app/controllers\"), file_name.split('_controller').first\n paths_to_hit+=read_file_and_find_paths(file, controller)\n end # end of controller_files iterator\n paths_to_hit\n end",
"def sitemap\n store_location\n\n # note: icons could be included, but do not seem to add much\n # note: tried showing unavailable pages as 'sans link', results not particularly attractive\n\n # TBD: My Talks, My Messsages, Current Messages\n # TBD: Maps, Calendars, Tags & Topics, Friends & Groups, Attachments, Venues\n @routes = talk_routes + user_routes + message_routes + admin_routes + common_routes \n\n end",
"def index\n headers['Content-Type'] = 'application/xml'\n @routes = website_routes + @opportunity_routes\n @blog_sitemap_route = buttercms_blog_sitemap_url\n end",
"def routes\n { :static => @route_ids, :dynamic => @dynamic }\n end",
"def build\n route.controller.new.tap do |ctrl|\n Karafka::Routing::Route::ATTRIBUTES.each do |attr|\n ctrl.public_send(:\"#{attr}=\", route.public_send(attr))\n end\n end\n end",
"def generate_permissions\n permissions = []\n Rails.application.eager_load!\n controllers = BaseController.descendants\n controllers.each do |c|\n controller_name = c.name.gsub(/Controller$/, '')\n controller = {}\n controller[:name] = controller_name.underscore\n controller[:actions] = []\n c.action_methods.each do |m|\n controller[:actions] << m unless m == 'method_missing'\n end\n permissions << controller\n end\n permissions\n end",
"def generate_sitemap\n end",
"def routes\n context[:routes]\n end",
"def fetch\n @routes = []\n source_extractors.keys.each do |source|\n extract_routes(source, data_for_source(source))\n end\n end",
"def routes_generate_options\n {\n :action => action_ref(:class => :controller),\n #TODO named root params\n :controller => controller_ref,\n :generate_all => nil,\n :method => link_to_methods,\n :use_route => nil,\n\n }\n end",
"def sitemap_urls\n each_sitemap_url.to_a\n end",
"def routes_map; end",
"def routes_normal\n return Array.new\n end",
"def url_map opts = {}\n map = {}\n @mounted_controllers.each do |c|\n c.url_map.each_pair do |r, s|\n s.each_pair { |rm, as| (map[r] ||= {})[rm] = as.dup.unshift(c) }\n end\n end\n\n def map.to_s\n out = []\n self.each do |data|\n route, request_methods = data\n next if route.size == 0\n out << \"%s\\n\" % route\n request_methods.each_pair do |request_method, route_setup|\n out << \" %s%s\" % [request_method, ' ' * (10 - request_method.size)]\n out << \"%s#%s\\n\" % [route_setup[0], route_setup[3]]\n end\n out << \"\\n\"\n end\n out.join\n end\n map\n end",
"def generate\n gen_app\n handle_public_index\n gen_file(\"config/routes.rb\", \"routes\")\n @app.goals.values.each_with_index { |goal, i| gen_goal(goal, i) }\n gen_misc\n self\n end",
"def routes\n app_obj.routes\n end",
"def route_sets; end",
"def google_sitemap\n\t\t@urls = []\n\t\t# 1. 305 - Redirected back to the reverse proxy to show old site page.\n\t\tREDIRECTIONS.select {|k,v| v[:action] == 305}.each {|r| @urls.push(r[0])}\n\t\t# 2. All Homepage's (including mainpage)\n\t\tSection.environments().each do |section|\n\t\t\thome = section_homepage_url(section)\n\t\t\t@urls << home if home\n\t\tend\n\t\t# 3. All Pages\n\t\tAsset.find_all_by_resource_type('Page').select {|p| p.published_page?}.each {|p| @urls << site_page_url(p)}\n\n respond_to do |format|\n format.xml\n end\n\tend",
"def sitemap_index_urls\n each_sitemap_index_url.to_a\n end",
"def retrieve_controller_assets\n application_manifest = PathInfo.new(\"#{app_path.to_s}/application.#{asset_extension}\")\n controller_manifest = PathInfo.new(\"#{app_path.to_s}/#{@controller}/#{@controller}.#{asset_extension}\")\n\n manifest = nil\n manifest = application_manifest if FileTest.exist?(application_manifest)\n manifest = controller_manifest if FileTest.exist?(controller_manifest)\n\n # TODO add rspec example\n return @assets if manifest.nil?\n\n # TODO: test when application is not exist\n return @assets.push(manifest.rel) if @shallow_retrieval\n\n @assets.concat(retrieve_assets_from(manifest) << manifest.rel)\n end",
"def get_controller_info\n controller_info = {}\n routes = Dir.chdir(::Rails.root.to_s) { `rake routes` }\n routes.split(\"\\n\").each do |entry|\n begin\n method, url, controller_action = entry.split.slice(-3, 3)\n if METHODS.include? method.upcase\n controller, action = controller_action.split('#')\n controller_info[controller] ||= []\n controller_info[controller] << [action, method, url]\n end\n rescue\n end\n end\n controller_info\n end",
"def routes\r\n RoutesController.instance\r\n end",
"def finalize_artifacts\n \n return if skip_method(__method__)\n \n puts \"finalize Rails routes in config/routes.rb\"\n \n add_routes(@@rails_routes)\n \n # create the navigation menu\n finalize_menu\n \n end",
"def routes\n @routes ||= []\n end",
"def routes\n @routes ||= []\n end",
"def sitemap_index_links\n each_sitemap_index_link.to_a\n end",
"def sitemap_links\n each_sitemap_link.to_a\n end",
"def routes\n @route_map.dup\n end",
"def site_pages \n Rails.application.reload_routes!\n page_routes = Rails.application.routes.routes.select do |route|\n route.verb == \"GET\" && !route.name.blank? && !route.name.match(/^edit/) && !route.name.match(\"translat\") && !route.name.match(\"external_author\")\n end\n\n @paths = []\n @errors = []\n @errors << \"Skipping translation and external author pages because these areas are in-progress.\"\n\n page_routes.each do |r|\n path = r.path.split('(').first\n while (path.match(/:([^\\/]+)_id\\//)) do\n id = get_id(path, current_user, $1.singularize)\n if id\n path.gsub!(\":#{$1}_id\", \"#{id}\") if id\n @last_id = id\n else\n @errors << \"Couldn't find object for #{path}, #{$1}\"\n break\n end\n end\n\n if (path.match(/\\/([^\\/]+)\\/:id/))\n id = get_id(path, current_user, $1.singularize)\n if id\n path.gsub!(\":id\", \"#{id}\")\n @last_id = id\n else\n @errors << \"Couldn't find object for #{path}, id\"\n end\n end\n\n @paths << [path, r.name]\n end\n \n render :action => \"site_pages\", :layout => \"application\"\n end",
"def generate_info( routes_info )\n routes_info.map {|i| i[:controller]}.compact.uniq.each do |controller_name|\n next unless controller_exists?(controller_name)\n @description << controller_extractor(controller_name).description\n end\n\n routes_info.each do |route|\n next unless controller_exists?(route[:controller])\n @actions_doc << get_action_doc( route, controller_extractor(route[:controller]) )\n end\n end",
"def generate_info( routes_info )\n routes_info.map {|i| i[:controller]}.compact.uniq.each do |controller_name|\n next unless controller_exists?(controller_name)\n @description << controller_extractor(controller_name).description\n end\n\n routes_info.each do |route|\n next unless controller_exists?(route[:controller])\n @actions_doc << get_action_doc( route, controller_extractor(route[:controller]) )\n end\n end",
"def getcontrollers\n @controllers = Eb::Permission.getcontrollers\n end",
"def routes\n @routes ||= []\n end",
"def generate!\n controllers = (Rails.application.routes.routes.map do |route|\n controller_name = \"#{route.requirements[:controller].camelize}Controller\"\n ActiveSupport::Dependencies.ref(controller_name).get\n end).insert(0, ApplicationController).uniq\n\n valid_controllers = valid_controllers()\n valid_locales = valid_locales()\n\n controllers.each do |controller|\n controller_path = controller.controller_path\n if controller.respond_to?(:managable_content_for) && valid_controllers.include?(controller_path)\n Page.transaction do\n valid_locales.each do |locale|\n # Create Page if it does not exist yet\n page = Page.where(:controller_path => controller_path, :locale => locale).first || Page.new()\n if page.new_record?\n page.controller_path = controller_path\n page.locale = locale\n page.save!\n end\n\n # Create PageContent if it does not exist yet\n contents = (controller == ApplicationController) ? controller.managable_layout_content_for : controller.managable_content_for\n contents.each do |key|\n if page.page_contents.where(:key => key).first.nil?\n page_content = page.page_contents.build\n page_content.key = key\n page_content.save!\n end\n end\n end\n end\n end\n end\n end",
"def all\n resource_gateway.json_index.map { |model| build(model) }\n end",
"def compile\n robot.handlers.each do |handler|\n next unless handler.respond_to?(:http_routes)\n\n handler.http_routes.each { |route| router.add_route(route) }\n end\n end",
"def get_routes\n @agency = params[:name]\n request_url = \"http://services.my511.org/Transit2.0/GetRoutesForAgency.aspx?token=#{@@token}&agencyName=#{@agency}\"\n request_url = request_url.gsub(/ /,\"%20\")\n @routes = search_for_key(parse_request(request_url), \"Route\")\n @routes = [@routes] unless @routes.kind_of?(Array)\n respond_to do |format|\n format.js {}\n end\n end",
"def all_routes\n matching_routes\n end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def add_distribution_routes\n # 'barn' => { :distribution => '192.168.204.0/24', :gw => '192.168.204.1', :sites => '10.4.0.0/16', :site_mask => 27, :site_size => 32, :count => 32},\n @distribution.each do |distribution_site_name, distribution_detail|\n distribution_ip = IPAddr.new(distribution_detail[:distribution])\n site_ip_range = IPAddr.new(distribution_detail[:sites])\n @nodes[distribution_site_name] ||= {} # Make sure site has an entry\n @nodes[distribution_site_name][:distribution_routes] ||= [] # Somewhere to save the distribution routes.\n (1...distribution_detail[:count]).each do |c|\n interface_name = \"#{distribution_site_name}-links\"\n node_name = \"#{distribution_site_name}-#{'%02d' % c}\"\n gw = (distribution_ip + (c + 1)).to_string\n network = (site_ip_range + (c * distribution_detail[:site_size])).mask(distribution_detail[:site_mask])\n if @local_networks[network].nil?\n @nodes[distribution_site_name][:distribution_routes] << { network_name: \"#{node_name}-site\", local: false, node_name: node_name, gw: gw, interface_network_name: interface_name, route: network, hop_count: 1 }\n end\n end\n end\n end",
"def routes\n cached_routes\n end",
"def paths_for(controller=:_all,action=:_all)\n return files_for(:paths,controller,action)\n end",
"def index\n @controllers = Controller.all\n end",
"def menu_for(*controllers) #:yields:\n hash= {}\n controllers.each do |c|\n hash[c.mount_path] = block_given? ? yield(c) : c.name.gsub(/Controller/,'')\n end\n menu_from_hash(hash)\n end",
"def index\n @crawlers = Crawler.all\n end",
"def create_sitemap\n end",
"def build_shortcuts_on( controller_class )\n @class_method_map.each do |klass,meth|\n k = klass.constantize\n controller_class.send( :define_method, meth ) do\n k.new(params)\n end\n end\n end",
"def links\n url = @controller.request.url\n url = url.split('.')[0..-2].join('.') if url =~ /\\.\\w+$/\n\n parent_url = url.split('/')[0..-2].join('/')\n parent_name = parent_url.split('/')[0..-2].last.singularize\n\n _links = {\n self: { href: url },\n parent_name => { href: parent_url }\n }\n\n { _links: _links }\n end",
"def urls\n @urls ||= all_urls(sitemap)\n end",
"def routes\n routes_method.call\n end",
"def generate_routes!\n Router.new(self).generate(@app)\n end",
"def process_controllers\n\t\t\t\tprocess_services\n\t\t\t\tmodules= jinda_engine::Module.all\n\t\t\t\tmodules.each do |m|\n\t\t\t\t\tnext if controller_exists?(m.code)\n\t\t\t\t\tputs \" Rails generate controller #{m.code}\"\n\t\t\t\tend\n\t\t\tend",
"def index\n @ht_routes = HtRoute.all\n end",
"def index\n @sites = fetch_sites\n\n @formattedSites = @sites.map do |site|\n {\n 'title' => {'value' => site.name, 'link' => { 'url' => site.routes.first.host_with_scheme, 'external' => true}, 'searchable' => true, 'sortable' => true},\n 'template' => {'value' => site.site_template&.name, 'searchable' => true, 'sortable' => true},\n 'preview' => {'value' => site.routes.first.host_with_scheme, 'link' => { 'url' => site.routes.first.host_with_scheme, 'external' => true}, 'searchable' => true, 'sortable' => true},\n 'edit' => {'value' => edit_admin_site_site_step_path(site_slug: site.slug, id: :name), 'method' => 'get'},\n 'delete' => {'value' => admin_site_path(slug: site.slug), 'method' => 'delete'}\n }\n end\n\n gon.sites = @formattedSites\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @sites }\n end\n end",
"def sitemap\n @tlsitemap_entries = []\n #Get only published timelines\n Timeline.find_each(:batch_size => 500, :conditions => [\"visibility = ?\", VIS_PUBLIC]) do |each_tl|\n @tlsitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{timeline_path(each_tl)}\")\n end\n \n @homepage_entry = \"#{request.protocol}#{request.host_with_port}\"\n \n @other_sitemap_entries = []\n # About, FAQ, Browse, Showcase\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{about_path}\")\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{browse_path}\")\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{showcase_path}\")\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{faq_path}\")\n \n render :template => \"timelines/sitemap\", :formats => [:xml], :handlers => :haml\n end",
"def sitemap\n @pages = Page.sitemap\n end",
"def retrieve(controller = '', action = '', options = {})\n options = { :full => false, :tagged => false, :shallow => false }.update(options)\n\n @assets = []\n @parsed_manifests = []\n @controller = controller\n @action = action\n @shallow_retrieval = options[:shallow]\n\n retrieve_controller_assets\n retrieve_action_assets if @action != ''\n @assets.uniq!\n\n @assets.map! { |asset| PathInfo.new(asset).abs } if options[:full]\n @assets.map! { |asset| tag(\"/#{asset.rel}\") } if options[:tagged]\n\n @assets\n end",
"def handle_routes\n instance_exec(@_roda_app.request, &self.class.router_block)\n end",
"def index\n\n\t\t@url_data_models = UrlDataModel.all\n\n\tend",
"def routes\n raise NotImplementedError\n end",
"def index\n @routes = Route.get_active\n end",
"def index\n @crawlers = Crawler.order(:id)\n end",
"def sitemap\n @pages = Page.sitemap\n respond_to do |format|\n format.xml { render layout: \"alchemy/sitemap\" }\n end\n end",
"def sitemap\n @pages = Page.sitemap\n respond_to do |format|\n format.xml { render layout: 'alchemy/sitemap' }\n end\n end",
"def available_routes\n routes = {}\n @components.each_value do |c|\n c.proxy.routes.each do |r|\n if routes[r] == nil\n routes[r] = c.proxy.uri\n else\n raise \"Route '#{r}' already handled by component \" +\n routes[r].name\n end\n end if c.registered?\n end\n routes\n end",
"def routes(context={})\n \n routes = [ \n ]\n \n end",
"def routes(context={})\n \n routes = [ \n ]\n \n end",
"def _routes; end",
"def routes\n @routes ||= load_routes\n end",
"def sitemap\n self.root\n self.follow('dtime:sitemap')\n self.get\n self\n end",
"def anchored_routes; end",
"def routes(context={})\n \n routes = [{:path => '/admin/system',\n :parent_path => '/admin',\n :regular_expression => /^\\/admin\\/system/, \n :title => 'Sistema', \n :description => 'Reads the log messages',\n :fit => 1,\n :module => :system },\n {:path => '/admin/logger',\n :parent_path => '/admin/system',\n :regular_expression => /^\\/admin\\/logger/, \n :title => 'Trazas', \n :description => 'Reads the log messages',\n :fit => 1,\n :module => :system },\n {:path => '/logger-config',\n :regular_expression => /^\\/admin\\/logger-config/, \n :title => 'Logger configuration', \n :description => 'Configure the logger',\n :fit => 1,\n :module => :system }, \n {:path => '/business-events',\n :regular_expression => /^\\/admin\\/business-events/, \n :title => 'Business events',\n :description => 'Manage the business events.',\n :fit => 1,\n :module => :system }]\n \n end",
"def index\n @rails_routes = RailsRoute.all\n end",
"def entries\n @controller.send(:entries)\n end",
"def maproutes(graph_instance)\n url ='http://www.gcmap.com/mapui?P='\n route_strings=''\n graph_instance.node_hash.each_key{ |key|\n linked = graph_instance.node_hash[key].linked_cities\n linked.each{ |tuple|\n route_strings = route_strings + \"#{key}-#{tuple.city},+\"\n }\n }\n Launchy.open(url+route_strings)\nend",
"def get_list_of_controllers_for_menu\n @controllers = get_list_of_file_names('app/controllers').reject! { |c| c =~ /^application|^site_settings|^user_sessions|^ajax/i }\n @controllers.map { |c| c.gsub!('_controller', '') }\n \n unless current_user.has_role?('Admin')\n @controllers.reject! { |c| !current_user.has_permission? c, 'index' }\n end\n end",
"def routes(context={})\n \n routes = [{:path => '/admin/cms',\n :parent_path => '/admin',\n :regular_expression => /^\\/admin\\/cms/,\n :title => 'Gestor contenidos',\n :description => 'Gestiona los contenidos',\n :fit => 2,\n :module => :cms},\n {:path => '/admin/cms/content-types',\n :parent_path => '/admin/cms',\n \t :regular_expression => /^\\/admin\\/cms\\/content-types/, \n :title => 'Tipos de contenido' , \n :description => 'Manages the content types: creation and update of content types.',\n :fit => 3,\n :module => :cms},\n {:path => '/mctype/:type/:aspect',\n :parent_path => \"/mctypes\",\n :regular_expression => /^\\/mctype\\/.+\\/.+/, \n :title => 'Content type aspect configuration', \n :description => 'Edit the content type/aspect configuration',\n :fit => 1,\n :module => :cms}, \n {:path => '/admin/cms/contents',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/content/, \n :title => 'Contenidos', \n :description => 'Manages the contents',\n :fit => 2,\n :module => :cms},\n {:path => '/admin/cms/content/new/',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/content\\/new/, \n :title => 'Crear contenido', \n :description => 'Create a new content: Choose the content type.',\n :fit => 2,\n :module => :cms},\n {:path => '/admin/cms/content/new/:content_type',\n :parent_path => \"/admin/cms/content/new/\",\n :regular_expression => /^\\/admin\\/cms\\/content\\/new\\/.+/, \n :title => 'Nuevo', \n :description => 'Create a new content: Complete data.',\n :fit => 3,\n :module => :cms}, \n {:path => '/admin/cms/content/edit/:content_id',\n :parent_path => '/admin/cms/contents',\n :regular_expression => /^\\/admin\\/cms\\/content\\/edit\\/.+/, \n :title => 'Editar contenido', \n :description => 'Editar contenido',\n :fit => 1,\n :module => :cms}, \n {:path => '/admin/cms/taxonomy',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/taxonomy/, \n :title => 'Taxonomías', \n :description => 'Manages the taxonomies: creation and update of taxonomies',\n :fit => 1,\n :module => :cms },\n {:path => '/admin/cms/terms/:taxonomy_id',\n :parent_path => \"/admin/cms/taxonomy\",\n :regular_expression => /^\\/admin\\/cms\\/terms\\/.+/, \n :title => 'Term',\n :description => 'Manage the terms of a taxonomy.',\n :fit => 1,\n :module => :cms },\n {:path => '/admin/cms/templates',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/templates/, \n :title => 'Plantillas', \n :description => 'Manages templates: creation and update of templates',\n :fit => 1,\n :module => :cms }, \n {:path => '/admin/cms/comments',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/comments/, \n :title => 'Comentarios', \n :description => 'Manages comments: creation and update of templates',\n :fit => 1,\n :module => :cms }, \n {:path => '/admin/cms/blocks',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/blocks/, \n :title => 'Bloques', \n :description => 'Manage the blocks. It allows to discover and configure modules blocks',\n :fit => 1,\n :module => :cms},\n {:path => '/admin/cms/views',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/views/, \n :title => 'Vistas', \n :fit => 1,\n :description => 'Manage the views: creation and update of views',\n :module => :cms},\n {:path => '/content/:page',\n :regular_expression => /^\\/content\\/.+/,\n :title => 'Content',\n :description => 'Shows a content',\n :fit => 1,\n :module => :cms},\n {:path => '/contents/category/:term_id',\n :regular_expression => /^\\/contents\\/category\\/.+/,\n :title => 'Contents by category',\n :description => 'Shows all the contents tagged with the category',\n :fit => 1,\n :module => :cms},\n {:path => '/admin/cms/menu-management',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/menu-management/, \n :title => 'Menu', \n :description => 'Manages the menus: creation and update of menus',\n :fit => 1,\n :module => :cms },\n {:path => '/admin/cms/menu-item-management/:menu_name',\n :parent_path => '/admin/cms/menu-management',\n :regular_expression => /^\\/admin\\/cms\\/menu-item-management\\/.+/, \n :title => 'Elemento de menú',\n :description => 'Manage the items of a menu.',\n :fit => 1,\n :module => :cms },\n {:path => '/admin/cms/translate/content/:content_id',\n :parent_path => '/admin/cms/contents',\n :regular_expression => /^\\/admin\\/cms\\/translate\\/content\\/.+/, \n :title => 'Traducir contenido', \n :description => 'Translate a content',\n :fit => 1,\n :module => :translation },\n {:path => '/admin/cms/translate/menuitem/:menuitem_id',\n :parent_path => '/admin/cms/menu-management',\n :regular_expression => /^\\/admin\\/cms\\/translate\\/menuitem\\/.+/, \n :title => 'Traducir elemento de menu', \n :description => 'Translate a menu item',\n :fit => 1,\n :module => :translation }, \n {:path => '/admin/cms/translate/term/:term_id',\n :parent_path => '/admin/cms/taxonomy',\n :regular_expression => /^\\/admin\\/cms\\/translate\\/term\\/.+/, \n :title => 'Traducir término',\n :description => 'Translate a term.',\n :fit => 1,\n :module => :translation },\n {:path => '/admin/cms/translate/template/:template_id',\n :parent_path => '/admin/cms/templates',\n :regular_expression => /^\\/admin\\/cms\\/translate\\/template\\/.+/, \n :title => 'Traducir plantilla',\n :description => 'Translate a term.',\n :fit => 1,\n :module => :translation } \n ]\n \n end",
"def controller_actions(perms)\n application_controller(perms)\n ApplicationController.descendants.each do |c|\n next if c == Peek::ResultsController || c.parent == Blazer # Fix for gems\n next unless c.respond_to?(:permission_definition)\n next if c.permission_definition.nil? || c.permission_definition == {}\n perms << PermissionsGenerator.new(c)\n end\n return perms\nend",
"def get_models\n eval \"@#{controller_name} = #{controller_name.singular.camelcase}.all\"\n end",
"def defaults\n\t\t\t\trest\n\n\t\t\t\t@controller.actions.each do |action|\n\t\t\t\t\tget action unless find_reverse_route(action)\n\t\t\t\tend\n\n\t\t\t\tmount_nested_controllers if @mount_nested && (\n\t\t\t\t\t@controller.demodulize == 'IndexController' &&\n\t\t\t\t\t!@namespace_name.empty?\n\t\t\t\t)\n\t\t\tend",
"def sitemap\n @pages = Page.find_all_by_sitemap_and_public(true, true)\n respond_to do |format|\n format.xml { render :layout => \"sitemap\" }\n end\n end",
"def build_keyword_pages\n keyword_pages = {}\n sitemap.resources.each do |resource|\n keywords = resource.metadata[:page][\"keywords\"]\n next if keywords.blank?\n keywords.each do |keyword|\n (keyword_pages[keyword] ||= []) << resource\n end\n end\n keyword_pages\nend",
"def index(context)\n # context.request is an instance of Sinatra::Request\n params = context.request.params\n instance_variable_set(:\"@#{resource_name.pluralize}\", resource_name.classify.constantize.all)\n instance_variable_get(:\"@#{resource_name.pluralize}\").to_json\n end",
"def routes(context={})\n \n routes = [{:path => '/admin/aspects',\n \t :regular_expression => /^\\/admin\\/config\\/aspects/, \n :title => 'Aspects' , \n :description => 'Configure the aspects.',\n :fit => 1,\n :module => :aspects},\n {:path => '/admin/aspect/:model_name/:aspect',\n :parent_path => \"/model-aspects\",\n :regular_expression => /^\\/admin\\/config\\/aspect\\/.+\\/.+/, \n :title => 'Model aspect configuration', \n :description => 'Edit the model/aspect configuration',\n :fit => 1,\n :module => :aspects\n }]\n \n end",
"def index\n @routes_title = I18n.t(\"interface.routes.titles.default\")\n @order = params[:order] || 'updated_at'\n @page = params[:page] || '1'\n @asc = params[:asc] || 'desc'\n conditions = params[:user_id] ? {:user_id => params[:user_id].split('-').first} : {}\n\n #FIXME intentar cargar solo los waypoints para el static path\n #FIXME se debería hacer como un has_many a nivel de modelo o en named_scope\n @routes = Route.paginate :include => [:waypoints, :user, :comments, :favoriters],\n :conditions => conditions, :per_page => '10',\n :page => @page,\n :order => @order + \" \" + @asc\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @routes }\n end\n end",
"def sitemap\n @pages = []\n website.available_locales.each do |l|\n @pages << { url: locale_sitemap_url(locale: l.locale.to_s, format: 'xml'),\n updated_at: 1.day.ago }\n end\n render \"sitemap_index\"\n end",
"def _map_identify_mapping_handler(object_type)\n proc_name = PrcLib.model.meta_obj.rh_get(object_type,\n :lambdas, :get_attr_e)\n\n is_controller = PrcLib.model.meta_obj.rh_get(object_type,\n :options, :controller)\n\n return nil if !proc_name && !is_controller\n\n if proc_name\n map_handler = [@process.method(proc_name), proc_name, false]\n map_handler << @process.class\n return map_handler\n end\n\n [@controller.method(:get_attr), :get_attr, true, @controller.class]\n end",
"def route_index; end",
"def routes\n routes = {}\n self.class.each_route do |route|\n #routes[:name] = route.app.name # \"SomeSinatraApp\"\n info = {}\n routes[route.path.to_s.to_sym] = info # that's the path given as argument to get and akin\n info[:verb] = route.verb # get / head / post / put / delete\n info[:file] = route.file # \"some_sinatra_app.rb\" or something\n info[:line] = route.line # the line number of the get/post/... statement\n info[:pattern] = route.pattern # that's the pattern internally used by sinatra\n info[:keys] = route.keys # keys given when route was defined\n info[:conditions] = route.conditions # conditions given when route was defined\n info[:block] = route.block # the route's closure\n end\n routes\n end",
"def index\n @attr_templates = AttrTemplate.all\n end"
] |
[
"0.59049433",
"0.57854116",
"0.5594955",
"0.55681175",
"0.5511554",
"0.5492239",
"0.54193693",
"0.54131967",
"0.53821677",
"0.53550595",
"0.53530216",
"0.5347042",
"0.53442514",
"0.53152317",
"0.53100294",
"0.5307648",
"0.5292911",
"0.52542704",
"0.52397615",
"0.5237427",
"0.5235566",
"0.5217858",
"0.52060485",
"0.51776344",
"0.51776344",
"0.51675016",
"0.5166869",
"0.5164053",
"0.5163859",
"0.51425505",
"0.51425505",
"0.51382035",
"0.51334995",
"0.51249045",
"0.5123371",
"0.5120374",
"0.5107734",
"0.50943846",
"0.50934833",
"0.50934833",
"0.50934833",
"0.50934833",
"0.50934833",
"0.50934833",
"0.50934833",
"0.50934833",
"0.50934833",
"0.50934833",
"0.50934833",
"0.50810844",
"0.5080868",
"0.5079182",
"0.5068834",
"0.50511163",
"0.5048239",
"0.50460184",
"0.5040893",
"0.50237876",
"0.5017659",
"0.5010923",
"0.50015926",
"0.5000963",
"0.49924764",
"0.49905083",
"0.4988199",
"0.4979061",
"0.49731094",
"0.49705228",
"0.49698573",
"0.49585602",
"0.4957031",
"0.4955953",
"0.49504524",
"0.49504256",
"0.49476096",
"0.4947592",
"0.4947592",
"0.49368435",
"0.4935544",
"0.4929677",
"0.49251518",
"0.4916592",
"0.4909698",
"0.489971",
"0.48938647",
"0.48935083",
"0.48918304",
"0.488455",
"0.48826584",
"0.4878261",
"0.48564422",
"0.48558617",
"0.48505235",
"0.48358735",
"0.4831485",
"0.4827228",
"0.48260778",
"0.48135608",
"0.4804976",
"0.4793306"
] |
0.5457129
|
6
|
Returns the date / time value from config/locale/sitemap.yml associated with the current controller / action. The static date/times are actual timestamps extracted from the date of the view on disk and from a .git repository if used. Be sure to run the generator or rake task: duck_map:sync to populate the locale file at: config/locale/sitemap.yml
|
def sitemap_static_lastmod(my_controller_name = nil, my_action_name = nil)
value = nil
unless my_controller_name.blank? || my_action_name.blank?
unless my_controller_name.blank?
my_controller_name = my_controller_name.underscore
my_controller_name = my_controller_name.gsub("/", ".")
end
begin
value = I18n.t("#{my_controller_name.downcase}.#{my_action_name.downcase}", default: "", locale: :sitemap)
rescue Exception => e
DuckMap.logger.exception(e)
end
value = value.blank? ? nil : LastMod.to_date(value)
end
return value
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def schedule_info\n\n Time.at(@at)\n end",
"def system_modified_dtsi\n Time.parse get('system_modified_dtsi')\n end",
"def deployed_at() ; info_time(:deployed_datetime) ; end",
"def deployed_at() ; info_time(:deployed_datetime) ; end",
"def get_request_timestamp\n\t\treturn @transport.get_path(\"meta\",\"datetime\")\n\tend",
"def submission_time\n Time.current.strftime(Rails.configuration.x.time_format)\n end",
"def date\n @date ||= @config['date']\n end",
"def yaml_time\n modification_time(Table.table_path(slug))\n end",
"def timestamp\n Rake::EARLY\n end",
"def timestamp\n Rake::EARLY\n end",
"def timestamp\n Rake::EARLY\n end",
"def system_datetime\r\n request(HTTPMethods::GET, PATH_SYSTEMDATETIME)\r\n end",
"def news_published_on(page)\n published_on = page.blocks.find {|b| b.identifier == 'published_on' }\n if !!published_on && !published_on.content.blank?\n DateTime.parse published_on.content\n else\n page.created_at\n end\n end",
"def system_created\n Time.parse self['system_create_dtsi']\n end",
"def sitemap\n @pages = []\n website.available_locales.each do |l|\n @pages << { url: locale_sitemap_url(locale: l.locale.to_s, format: 'xml'),\n updated_at: 1.day.ago }\n end\n render \"sitemap_index\"\n end",
"def index\n @pages = []\n website.available_locales.each do |l|\n @pages << {\n url: locale_sitemap_url(locale: l.locale.to_s, format: 'xml'),\n updated_at: 1.day.ago}\n end\n respond_to do |format|\n format.html\n format.xml\n end\n end",
"def build_time\n if btime = app.info_plist[\"ProjectBuildTime\"]\n else\n puts %(\n[RMQ Warning] The build_time method requires that this code is in your RakeFile:\napp.development do\n app.info_plist[\"ProjectBuildTime\"] = Time.now\nend)\n end\n btime\n end",
"def the_datetime(content=nil, output=nil)\n if node = content || @content || Content.get(params[:id])\n output.nil? ? node.created_at : node.created_at.strftime(output)\n else\n \"<strong>Error:</strong> No creation date could be found\" unless ENV['RACK_ENV'] == 'production'\n end\n end",
"def updated_at\n csv_time = google_key.nil? ? modification_time(uri) : google_modification_time\n (csv_time > yaml_time ? csv_time : yaml_time).to_s\n end",
"def published_at\n Time.at @published rescue nil\n end",
"def published_at_date\n self[:published_at].to_s.split.first\n end",
"def date\n Time.now\n end",
"def get_time_placed\n self.created_at.strftime(\"%m/%d/%Y at %l:%M%p\")\n end",
"def sitemap\n @tlsitemap_entries = []\n #Get only published timelines\n Timeline.find_each(:batch_size => 500, :conditions => [\"visibility = ?\", VIS_PUBLIC]) do |each_tl|\n @tlsitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{timeline_path(each_tl)}\")\n end\n \n @homepage_entry = \"#{request.protocol}#{request.host_with_port}\"\n \n @other_sitemap_entries = []\n # About, FAQ, Browse, Showcase\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{about_path}\")\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{browse_path}\")\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{showcase_path}\")\n @other_sitemap_entries.push(\"#{request.protocol}#{request.host_with_port}#{faq_path}\")\n \n render :template => \"timelines/sitemap\", :formats => [:xml], :handlers => :haml\n end",
"def date_for(date)\n content_tag :time do\n date.strftime(\"%e %b\")\n end\n end",
"def date\n data[\"date\"] ||= (draft? ? source_file_mtime : site.time)\n end",
"def last_modified_at(page)\n Gtn::ModificationTimes.obtain_time(page['path'])\n end",
"def friendly_time\n\t\t@event_info.each do |event_hash|\n\t\t\tdatetime = event_hash[\"datetime\"].strftime(\"%A, %d %b %Y %l:%M %p\")\t\n\t\tend\n\tend",
"def published_at\n handle_none post.published_at do\n time_tag(post.published_at, post.published_at.strftime('%b.%d.%Y'), pubdate: true)\n end\n end",
"def run_at\n doc['run_at']\n end",
"def date\n return @_date if @_date\n\n frontmatter_date = data['date']\n\n # First get the date from frontmatter\n @_date = if frontmatter_date.is_a? Time\n frontmatter_date.in_time_zone\n else\n Time.zone.parse(frontmatter_date.to_s)\n end\n\n # Next figure out the date from the filename\n source_vars = blog_data.source_template.variables\n\n if source_vars.include?('year') &&\n source_vars.include?('month') &&\n source_vars.include?('day')\n\n filename_date = Time.zone.local(path_part('year').to_i, path_part('month').to_i, path_part('day').to_i)\n if @_date\n raise \"The date in #{path}'s filename doesn't match the date in its frontmatter\" unless @_date.to_date == filename_date.to_date\n else\n @_date = filename_date.to_time.in_time_zone\n end\n\n end\n\n raise \"Blog post #{path} needs a date in its filename or frontmatter\" unless @_date\n\n @_date\n end",
"def get_time\n @time = Time.now.strftime(\"%H:%M:%S \")\n render \"store/date\"\n #render partial: \"store/date\"\n end",
"def systemdate\n response = CreateSend.get('/systemdate.json')\n Hashie::Mash.new(response)\n end",
"def curent_time\n Time.zone.now.strftime('%l:%M %p')\n end",
"def time\n (published_at || created_at).try :in_time_zone\n end",
"def created_at\n @created_at ||= @path.pathname.ctime\n end",
"def current_time\n @definition.current_time\n end",
"def generated_at\n \"Generated at \" + Time.now.strftime(\"[%m/%d/%Y %H:%M:%S]\")\n end",
"def default_locale\n AppConfig.default_locale\n end",
"def aktTime()\n (Time.now).strftime(\"%T\")\nend",
"def timestamp\n timestamp_to_datetime(static_data(\"timestamp\"))\n end",
"def action_by_admin\n @current_time = Home.last_cut_off_time.first\n end",
"def getDateTime()\n return self.getLogDate.to_DateTime()\n end",
"def date\n Time.now.in_time_zone\n end",
"def build_timestamp\n @build_timestamp\n end",
"def path\n current_localization.path\n end",
"def time\n DateTime.now.strftime(TIME_FORMAT)\n end",
"def created_at\n content_key.created_at\n end",
"def date_published\n created_at.strftime(\"%b %d, %Y\")\n end",
"def web_time; strftime(WEB_TIME_FORMAT); end",
"def published_date_time\n return @published_date_time\n end",
"def published_date_time\n return @published_date_time\n end",
"def locale\n current_site.locale || I18n.default_locale.to_s\n end",
"def current_time\n Time.now.strftime(\"%l:%M %p\")\n end",
"def last_updated_at\n RefreshReportingViews.last_updated_at_facility_daily_follow_ups_and_registrations\n end",
"def notification_daily_send_time\n @attributes[:notification_daily_send_time]\n end",
"def notification_daily_send_time\n @attributes[:notification_daily_send_time]\n end",
"def show\n @created_at_time = Program.format_date_time_est(@program.created_at)\n @updated_at_time = Program.format_date_time_est(@program.updated_at)\n end",
"def time\n entry(MANIFEST).time\n end",
"def time\n @time ||= begin\n return Time.now unless env('CI_PIPELINE_CREATED_AT')\n\n DateTime.strptime(env('CI_PIPELINE_CREATED_AT')).to_time\n end\n end",
"def created_at\n I18n.l object.created_at\n end",
"def launch_date_time\n return @launch_date_time\n end",
"def manager_action_date_time\n return @manager_action_date_time\n end",
"def date_published_human\n date_published.strftime(\"on %B %d, %Y at %H:%M\")\n end",
"def get_timestamp\n Time.now.strftime('%d %B %Y %H:%M')\n end",
"def web_date; strftime(WEB_DATE_FORMAT); end",
"def sitemap\n self.root\n self.follow('dtime:sitemap')\n self.get\n self\n end",
"def last_modified\n rails_root_mtime = Time.zone.at(::File.new(\"#{Rails.root}\").mtime)\n timestamps = [rails_root_mtime, self.updated_at] + self.page.elements.collect{|e| e.last_modified}\n timestamps.sort.last\n end",
"def display_time_for_appointment\n date.strftime(\"%I:%M:%S %p, %B #{date.day.ordinalize}, %Y\")\n end",
"def time_stamp()\n return get INIT_TIME_STAMP_NAME\n end",
"def get_current_date\n time = Time.now.to_s\n time = DateTime.parse( time ).strftime( \"%d/%m/%Y %H:%M\" )\n end",
"def scheduled_at_date\n (model.scheduled_at || Time.zone.now + 7.days).strftime(\"%m/%-d/%Y\")\n end",
"def key_build_times\n \"build_times\"\n end",
"def date_crawled\n @url.date_crawled\n end",
"def scheduled_at\n run_at || created_at\n end",
"def current_time\n DateTime.now\n end",
"def current_time\n DateTime.now\n end",
"def goth_published_date(goth)\n\t\tgoth.published_at.strftime('%b %d, %Y %H:%M')\n\tend",
"def time_scripts(locale)\n render :partial => 'scripts/time_scripts', :locals => {:locale => locale}\n end",
"def show_header_date\n I18n.localize(Date.today, format: :long)\n end",
"def timestamp\n if File.exist?(name)\n File.mtime(name.to_s)\n else\n Rake::EARLY\n end\n end",
"def date_from_post_path\n m = REGEXP_DATE_ISO.match(self.identifier)\n time = m[2].nil? ? '19:00:00' : m[2..4].join(':')\n return m.nil? ? nil : [m[1], time].join('T')\n end",
"def date\n updated_at.strftime(\"%d %b %y %H:%M\")\n end",
"def get_date()\n @time\n end",
"def index\n @locations = Location.all\n @cur_date = {:date => Time.now.strftime(\"%d-%m-%Y\")}\n end",
"def local_asctime\n @time.getlocal.asctime\n end",
"def published_at\n object.created_at.strftime(\"%d %b %Y\")\n end",
"def launched_at # {{{\n DateTime.parse(@data[:launchTime])\n end",
"def t_stamp\n Time.now.strftime(\"%m-%d_%H-%M-%S\")\nend",
"def pickup_date_print(request)\n request.pickup_time.strftime(\"%A %d-%m-%Y %H:%M\")\n end",
"def display_day_published\r\n \"Published : #{created_at.strftime('%-b %-d, %Y')}\"\r\n end",
"def httpdate\n Time.now.httpdate\n end",
"def statistic_up_date\n I18n.l(Time.zone.today.to_date)\n end",
"def updated_at_display\n updated_at.in_time_zone(User.new.decorate.h.controller.current_user.timezone).strftime('%b %d, %Y @ %I:%M %p %Z')\n end",
"def index\n todaydate = Time.now.in_time_zone(\"US/Pacific\").to_date\n\n end",
"def launch_time\n DateTime.parse(\"2015-02-04 13:00:00 UTC\")\n end",
"def current_date()\r\n return Time.new.strftime(\"%Y-%m-%d\")\r\n end",
"def dateMark\n Time.now.strftime(\"%Y%m%d_%H%M%S\")\n end",
"def created_at\n time = object.created_at.in_time_zone('Tokyo')\n helpers.content_tag :time, :datetime => time.to_datetime do\n time.strftime(\"%Y年%m月%d日 %H時%M分\")\n end\n end",
"def label_for(page, opts = {})\n opts[:format] ||= @vars[:format]\n localize(starting_time_for(page.to_i), opts) # page could be a string\n end"
] |
[
"0.57362396",
"0.5731056",
"0.5713031",
"0.5713031",
"0.56561637",
"0.56265986",
"0.5583622",
"0.548209",
"0.53863734",
"0.53863734",
"0.53863734",
"0.5386075",
"0.53558856",
"0.53481543",
"0.5327672",
"0.53198487",
"0.5304827",
"0.52979004",
"0.5290553",
"0.5285355",
"0.5278119",
"0.5273017",
"0.5259641",
"0.5258257",
"0.5250617",
"0.5246341",
"0.52129304",
"0.520953",
"0.51925564",
"0.5185451",
"0.5182841",
"0.51799077",
"0.5176653",
"0.51705927",
"0.5169834",
"0.5168463",
"0.5165641",
"0.51651496",
"0.5155684",
"0.51527745",
"0.5137305",
"0.5124753",
"0.51212996",
"0.5117622",
"0.5113158",
"0.5112041",
"0.50983185",
"0.5091282",
"0.5090216",
"0.50843096",
"0.50838405",
"0.50838405",
"0.5076297",
"0.5063127",
"0.5046816",
"0.50464356",
"0.50464356",
"0.5042928",
"0.5037982",
"0.5036394",
"0.50303584",
"0.503",
"0.5025762",
"0.5012496",
"0.5009297",
"0.5005822",
"0.5005728",
"0.50030565",
"0.49899134",
"0.49870303",
"0.4982464",
"0.49783948",
"0.49752674",
"0.49749547",
"0.49588686",
"0.4958319",
"0.4958319",
"0.49568698",
"0.49548316",
"0.494839",
"0.49476242",
"0.49435675",
"0.49382943",
"0.4935982",
"0.49332666",
"0.49315572",
"0.49308753",
"0.4927244",
"0.49251008",
"0.4922498",
"0.4920801",
"0.49204415",
"0.491688",
"0.49165288",
"0.49136716",
"0.49123985",
"0.49097937",
"0.48976383",
"0.4892223",
"0.48770005"
] |
0.71463656
|
0
|
j=job job remainder email
|
def sitter_request_remainder
# puts "puts remainder====================="
jobs_to_send = Job.find(:all, :conditions => ["date_from <= ? AND notification_sent IS NOT true", 2.days.from_now])
jobs_to_send.each do |j|
unless j.parent_id.nil? || j.sitter_id.nil? || (j.status == 'cancelled')
parent = Parent.find(j.parent_id)
sitter = Sitter.find(j.sitter_id)
if parent.profile.text_message
#Notifications.deliver_parent_job_sms_reminder(parent, sitter, j)
end
if parent.profile.email
Notifications.deliver_parent_job_reminder(parent, sitter, j)
end
if sitter.profile.text_message
#Notifications.deliver_sitter_job_sms_reminder(parent, sitter, j)
end
if sitter.profile.email
Notifications.deliver_sitter_job_reminder(parent, sitter, j)
end
j.notification_sent = true
j.save
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def email_job_result(jlh)\n return unless email_result?(jlh)\n email_expression = Regexp.new('EMAIL_RESULT_BELOW:(.*)EMAIL_RESULT_ABOVE',Regexp::MULTILINE)\n match = email_expression.match(jlh[:job_result])\n jmd = jlh[:jmd]\n jle = jlh[:jle]\n if (match.nil?)\n $logger.debug(\"The output for job_code #{jmd.job_code} does not have valid e-mail output!\")\n return\n end\n $logger.debug(\"The output for job_code #{jmd.job_code} does have valid e-mail output! See the rails log for details\")\n body = match[1]\n #get the subject from the body\n match = Regexp.new('SUBJECT:(.*)').match(body)\n subject = match[1] unless match.nil?\n body.sub!(\"SUBJECT:#{subject}\",'')#append on subject\n subject = $application_properties['service_subject'] + \" \" + subject if jlh.has_key?(:service)\n subject = subject + ' -- REMINDER ' + @reminder_hash[jmd.job_code].to_s if (jlh[:reminder_email])\n body.chomp!.reverse!.chomp!.reverse! unless jmd.email_content_type.eql?('text/html')\n from = $application_properties['PST_Team']\n content_type = jmd.email_content_type\n recipients = []\n cc = []# or should it be ''?\n #banana slug\n #integrate with escalation levels to get additional e-mails out of the escalation\n recipients = jlh[:email_to] if jlh.has_key?(:email_to)\n cc = jlh[:email_cc] if jlh.has_key?(:email_cc)\n\n if (jmd.track_status_change && jmd.email_on_status_change_only)\n esc = jle.get_escalation\n esc = JobLogEntry.before(jle).status_not(\"UNKNOWN\").limit(1).first.get_escalation if esc.nil? #if this is nil this jle is green\n\n if ! esc.nil? #this is added in the event that the alert has never been red and we are in this method because we are executing as a service\n esc_emails = esc.get_escalation_based_emails\n recipients = recipients | esc_emails[0]\n cc = cc | esc_emails[1]\n end\n end\n\n recipients = recipients.uniq.join(',')\n cc = cc.uniq.join(',')\n\n email_hash = {:request => jmd.job_code, :content_type => content_type, :subject=>subject,\n :recipients=>recipients, :from=>from, :cc=>cc,:body=>body,\n :incl_attachment=>jmd.incl_attachment,:attachment_path=>jmd.attachment_path,\n :jmd => jmd, :jle => jle}\n\n JobMailer.job_result(email_hash).deliver\n end",
"def job_complete(job)\n @job = job\n mail subject: \"Job Complete\"\n end",
"def overdue_job(user, job)\n @job = job \n mail(to: user.email, subject: 'Job Overdue') \n end",
"def job_reminder\n UserMailer.job_reminder(User.first, Job.first)\n end",
"def published job\n @job = job\n\n mail :to => @job.email, :subject => \"Empleos TI: #{@job.title}\"\n end",
"def job_assign(email, subject, job)\n @job = job\n @member = DailyMember.find(job.daily_member_id) unless job.daily_member_id.nil?\n mail(to: email, subject: subject)\n end",
"def send_job_reminder(job)\n UserMailer.job_reminder(self, job).deliver_now\n end",
"def job_posted_announcer_notification(job)\n @job = job\n @user = User.find(@job.user_id)\n mail(:subject => \"Anuncio enviado com sucesso.\", :to => @user.email)# for announcer and a hide copy to admin\n end",
"def perform(email, job_id)\n if email.blank? or job_id.blank?\n puts(\"Either of job or email is blank. Email: #{email}, Job: #{job_id}\")\n return\n end\n\n email_invitations = EmailInvitation.where(:email => email)\n email_invitation = nil\n email_invitations.each do |invitation|\n unless invitation[:invitor_handle].blank?\n email_invitation = invitation\n end\n end\n\n if !email_invitations.blank? and email_invitation.blank?\n email_invitation = email_invitations[0]\n end\n\n if email_invitation.blank?\n email_invitation = create_email_invitation_for_email(email, nil)\n end\n\n if email_invitation.reminder_count >= 3\n puts(\"Reminder count exceeded for user: #{email}\")\n return\n end\n\n job = get_job_by_id(job_id)\n if job.blank? or !job.live\n puts(\"Either Job is blank or not live. live? #{job.live}\")\n return\n end\n\n email_variation_id = get_job_email_variation\n user = get_user_by_email(email)\n if user.blank?\n user = create_passive_user(email)\n elsif user[:active]\n puts(\"USER (#{user})is active returning from not sending invitation\")\n return\n end\n begin\n Notifier.email_job_invitation(user, '', job, email_variation_id).deliver\n rescue Exception => ex\n puts \"Exception: #{ex}\"\n end\n\n email_invitation.last_variation_used = email_variation_id\n email_invitation.time = Time.now\n email_invitation.reminder_count = email_invitation.reminder_count + 1\n email_invitation.save\n track_email_send(\"track_job_email_#{job_id}_#{email_variation_id}\")\n end",
"def job_notification(id, emails)\n @job = Job.find id\n\n mail to: emails, subject: \"[Job is #{@job.status.humanize}] zaradotcom-scraper job notification\"\n end",
"def job_signup_canceled_notification\n UserMailer.job_signup_canceled_notification(User.first, Job.first)\n end",
"def job_reminder(user, job)\n @user = user\n @job = job\n @custom_info = EMAIL_CUSTOM_JOB_SIGNUP_MESSAGE\n mail to: \"#{user.full_name} <#{user.email}>\",\n subject: t(\".subject\", job_title: job.title)\n record_activity :send_job_reminder, @user, data: {job: @job}\n end",
"def send_emails\n # p \"job_exists?: #{job_exists?}\"\n return if job_exists?\n\n AbsenceJob.set(wait_until: email_wait_time)\n .perform_later(semester_id, date.to_s)\n\n # return unless absent? && date == Date.today\n #\n # # always send email to student\n # email_student\n #\n # # if the absence was consecutive?\n # if consecutive?\n # email_director\n # else\n # email_teacher_assistant\n # end\n end",
"def job \n @job\n end",
"def jobseeker_notified(employer_name, job_name, employer_email, jobseeker_email, jobseeker_name)\n @jobseeker_name = jobseeker_name\n @employer_name = employer_name\n @job_name = job_name\n mail to: jobseeker_email, subject: \"You have been matched by an employer!\"\n end",
"def job_canceled_notification\n UserMailer.job_canceled_notification(User.first, Job.first)\n end",
"def job\n @job\n end",
"def job_queue_name\n 'email'\n end",
"def job_queue_name\n 'email'\n end",
"def send_signup_email(job_application)\n @job_application = job_application\n mail( :to => 'apply@refunction.ca',\n :subject => 'Job Application Received' )\n end",
"def job\n @job\n end",
"def job\n @job\n end",
"def jobfail(log,msg)\n Rails.logger.error(\"#{log} #{self.id}\")\n self.update_attributes(:status =>'error',:errormsg => msg)\n user = User.find_by_email(self.email)\n UserMailer.job_failed(user,self).deliver \n UserMailer.admin_job_failed(self).deliver\n end",
"def job_signup_canceled_notification(user, job)\n # TODO: Consider sending only one email to all concerned users.\n @user = user\n @job = job\n @job_coordinator = job.user\n mail to: \"#{user.full_name} <#{user.email}>\",\n cc: \"#{@job_coordinator.full_name} <#{@job_coordinator.email}>\",\n subject: t(\n \".subject\",\n job_title: job.title,\n job_date: @job.start_at.to_date.to_localized_s(:short_with_weekday)\n )\n record_activity :send_job_signup_canceled_notification, @user, data: {\n job: @job\n }\n end",
"def jobpost_email(user)\n @user = user\n \n mail to: user.email, subject: 'Thank you for posting a new job', from: 'WebMaster@AlumniConnection.com'\n end",
"def Job_application\n AccountCreatedMailer.Job_application\n end",
"def invoice_mail(user,job)\n @user = user\n @job = job\n mail(to: @user.email, subject: 'Job Invoice')\n end",
"def job # this is a getter\n @job\n end",
"def confirmation\n begin\n if @jobber.jobs.count > 0\n # match jobber with job\n @jobber.update_attributes( next_contact_at: 4.weeks.since)\n Message.mail subject: 'Tak for din bekræftelse!',\n who: @jobber.email,\n what: m4_message,\n jobber: @jobber,\n job: @jobber.jobs.first,\n confirm_link: (confirmation_jobber_url(jobber, confirmed_token: jobber.confirmed_token) rescue '- bekræftelseslink mangler -'),\n messenger: current_user\n\n Message.mail subject: 'Vi har et match!',\n who: @jobber.jobs.first.user.email,\n what: 'Vi har et match - jobberen hedder {{jobber_name}}. Skriv på adressen {{jobber_email}}. \\n\\nStor spejder hilsen \\nJobcenteret Spejdernes Lejr 2017',\n jobber: @jobber,\n job: @jobber.jobs.first,\n confirm_link: '',#(confirmation_jobber_url(jobber, confirmed_token: jobber.confirmed_token) rescue '- bekræftelseslink mangler -'),\n messenger: current_user\n\n else\n unless @jobber.delivery_team.nil?\n # match jobber with delivery_team\n @jobber.update_attributes( next_contact_at: 4.weeks.since)\n Message.mail subject: 'Tak for din bekræftelse!',\n who:@jobber.email,\n what: m2_message,\n jobber: @jobber,\n job: @jobber.jobs.first,\n delivery_team: @jobber.delivery_team,\n confirm_link: (confirmation_jobber_url(jobber, confirmed_token: jobber.confirmed_token) rescue '- bekræftelseslink mangler -'),\n messenger: current_user\n\n\n # Message.mail subject: 'Vi har et match!',\n # who: @jobber.delivery_team.user.email,\n # what: 'Vi har et match - jobberen hedder {{jobber_name}}. Skriv på adressen {{jobber_email}}',\n # jobber: @jobber,\n # job: @jobber.assignments.first,\n # confirm_link: '',#(confirmation_jobber_url(jobber, confirmed_token: jobber.confirmed_token) rescue '- bekræftelseslink mangler -'),\n # messenger: current_user\n\n\n else\n Message.create( title: 'Ny bekræftelse!', msg_from: @jobber.email, msg_to: Rails.application.secrets.imap_reply_email, body: '_', messenger: @jobber)\n end\n end\n rescue\n Rails.logger.info \"Under bekræftelsen fejlede noget?!? jobber: %s\" % @jobber.to_json\n end\n if current_user\n @jobber.confirm!\n respond_to do |format|\n format.html { render layout: false }\n end\n else\n notice = @jobber.confirmed?(params) ? 'Din tilmelding er nu bekræftet - og vi vil kontakte dig hurtigst muligt' : 'Din tilmelding er ikke bekræftet'\n respond_to do |format|\n format.html { redirect_to root_path, notice: notice}\n end\n end\n end",
"def send!\n raise \"job #{job.backup_id} has no email option\" unless job.options[:email]\n # define local variables for closure over Mail.new\n from_address = settings['email_from']\n to_address = job.options[:email]\n subject_text = \"Backup of RDS #{job.rds_id} (job ID #{job.backup_id})\"\n body_text = body\n mail = Mail.new do\n from from_address\n to to_address\n subject subject_text\n body \"#{body_text}\\n\"\n end\n mail.deliver!\n end",
"def job_canceled_notification(user, job)\n # TODO: Consider sending only one email to all concerned users.\n @user = user\n @job = job\n @job_coordinator = job.user\n mail to: \"#{user.full_name} <#{user.email}>\",\n cc: \"#{@job_coordinator.full_name} <#{@job_coordinator.email}>\",\n subject: t(\n \".subject\",\n job_title: job.title,\n job_date: @job.start_at.to_date.to_localized_s(:short_with_weekday)\n )\n record_activity :send_job_canceled_notification, @user, data: {job: @job}\n end",
"def jobs_notifier(email_list)\n @listed_jobs = JobPosting.where(created_at: (Time.now.midnight-5.days)..(Time.now))\n @greeting = \"Hi\"\n headers['X-SMTPAPI'] = { :to => email_list.to_a }.to_json\n mail(\n :to => \"info@ourcompany.com\",\n :subject => \"New Job Posted!\"\n )\n \n end",
"def new_self_job_signup_confirmation(user, job)\n @user = user\n @job = job\n @job_coordinator = job.user\n @custom_info = EMAIL_CUSTOM_JOB_SIGNUP_MESSAGE\n mail to: \"#{user.full_name} <#{user.email}>\",\n subject: t(\n \".subject\",\n job_title: job.title,\n job_date: @job.start_at.to_date.to_localized_s(:short_with_weekday)\n )\n record_activity :send_new_self_job_signup_confirmation, @user, data: {\n job: @job\n }\n end",
"def job_moved_to_invoiced(user, job)\n @user = user\n @job = job\n\n mail(to: @user.email, subject: \"#{@user.full_name}, #{@job.name} has moved to invoiced.\")\n end",
"def done(parse)\n @greeting = \"Job is done\"\n @parse = parse\n attachments[parse.result_f_file_name] = File.read(parse.result_f.path)\n mail to: \"augerdownbooks@gmail.com\", from: \"shawnzam@gmail.com\", subject: \"foof\"\n \n # attachments[report.pdf_file_file_name] = File.read(report.pdf_file.path)\n end",
"def new_job_signup_by_admin_confirmation(user, job, current_user)\n @user = user\n @job = job\n @job_coordinator = job.user\n @current_user = current_user\n @custom_info = EMAIL_CUSTOM_JOB_SIGNUP_MESSAGE\n mail to: \"#{user.full_name} <#{user.email}>\",\n cc: \"#{current_user.full_name} <#{current_user.email}>\",\n subject: t(\n \".subject\",\n job_title: job.title,\n job_date: @job.start_at.to_date.to_localized_s(:short_with_weekday)\n )\n record_activity :send_new_job_signup_by_admin_confirmation, @user, data: {\n job: @job\n }\n end",
"def after job=dj\n end",
"def jobs\n\t\t# ...\n\tend",
"def job\n fetch('games.final_fantasy_xiv.jobs')\n end",
"def jobs\r\n end",
"def new_job(job, username, password)\n puts \"Requesting quote for job:\"\n puts JSON.pretty_generate(job)\n puts \"\"\n res = post_json('jobs.json', job, username, password)\n if res['error'] || res['status'] == 'error'\n puts \"Job rejected (error #{res['status']}): #{res['error'] || res['reason']}\"\n return\n end\n\n puts \"Gnip's job desc:\"\n puts summarise_job(res)\nend",
"def perform(email)\n CompletionMailer.notify_admin_completion(email).deliver_now\n end",
"def new_self_job_signup_confirmation\n UserMailer.new_self_job_signup_confirmation(User.first, Job.first)\n end",
"def mailer; end",
"def job_posted_pending(recipient, company, sent_at = Time.now)\n subject \"#{AppConfig.site_name} - Thanks for Posting\"\n recipients recipient\n from AppConfig.from_email\n sent_on sent_at\n content_type \"multipart/alternative\"\n\n part :content_type => \"text/plain\",\n :body => render_message(\"job_posted_pending\", :company => company)\n end",
"def notify\n MemberMailerWorker.perform_async(member_id: self.employer.id.to_s, job_order_id: self.id.to_s, perform: :send_invoice_to_employer)\n TeamMailerWorker.perform_async(job_order_id: self.id.to_s, perform: :send_new_job_order)\n\n end",
"def publish\n @job = Job.find_by_id_and_edit_token!(params[:id], params[:edit_token])\n if @job.email_verified?\n job_update\n else\n job_send_verification_email\n end\n end",
"def event_mail\n NoticePlannerMailer.delay.notice_planner_email('lumi.xperia@gmail.com', 'test', 'cron-test', 'https://yahoo.co.jp')\n end",
"def completed\n @job = Job.find(params[:id])\n if @job.employer_id.eql?(current_user.id)\n # pay the user the money for completing the job\n @employee = User.find(@job.employee_id)\n @employee = @employee.specific\n @employee.update_attributes(:money => @employee.money + @job.pay)\n \n # notify the employee that he got paid\n @notification = Notification.new({:subject => \"Congratulations on completing a job!\", \n :description => \"You have completed a job and have been paid for it.\", \n :read => false, :user_id => @job.employee_id})\n @notification.save\n \n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url}\n format.json { head :no_content }\n end\n \n else\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'You cannot edit this job.'}\n format.json { head :no_content }\n end\n end\n end",
"def in_progress\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def jid; end",
"def job=(job)\n @job = job\n end",
"def send_confirmation_email\n\t\tRentersConfirmationJob.perform_later self\n OwnersConfirmationJob.perform_later self\n\tend",
"def queue_job; end",
"def in_process\n to = params[:patron_email] + ', ' + params[:staff_email]\n from = \"Request Services <#{params[:staff_email]}>\"\n title = params[:bib_record].title\n subject = \"On Order / In Process Request [#{title}]\"\n mail(to: to, from: from, subject: subject)\n end",
"def send_update_email(artifact)\n @artifact = artifact\n list = []\n @artifact.project.users.each do |apu|\n list << apu.email\n end\n mail( :to => list,\n :subject => 'There is an update in your user area.' )\n end",
"def job_done job, results\n puts \"#{name}: Done #{job.id}\"\n jc = Job::COMPLETE_TEMPLATE.dup\n jc['id'] = job.id\n jc['result'] = results\n ts.write jc\n end",
"def admin_alert(data, subject)\n #@claim_url = \"http://www.cleanjay.ca/claim-booking/#{job.profile.claim_id}\"\n @data = data\n sub = \"[Admin Alert] \" + subject.to_s\n\n mail(:to => \"tom@cleanjay.ca\", subject: sub)\n end",
"def email(cdn, e)\n data = JSON.load REDIS[cdn]\n link = \"http://logserver.flocasts.com/#{cdn.to_sym.object_id}\"\n\n tox = data['server_admins']\n from = 'flocast.bordercollie@gmail.com'\n subj = '[ERROR] ' + cdn\n text = [link, \"\\n\", e.message, e.class, e.backtrace].join \"\\n\"\n\n Gmail.new from, 'flocastayo' do |gmail|\n gmail.deliver do\n to tox\n subject subj\n text_part { body text }\n end\n end\nend",
"def success(job)\n complete()\n end",
"def notify_all\n MemberMailerWorker.perform_async(member_id: self.freelancer.id.to_s, job_order_id: self.id.to_s, perform: :send_job_paid_to_freelancer)\n MemberMailerWorker.perform_async(member_id: self.employer.id.to_s, job_order_id: self.id.to_s, perform: :send_job_paid_to_employer)\n TeamMailerWorker.perform_async(job_order_id: self.id.to_s, perform: :send_job_order_paid)\n\n\n MemberMailerWorker.perform_in(4.hours, member_id: self.employer.id.to_s, job_order_id: self.id.to_s, perform: :resend_job_paid_to_employer)\n MemberMailerWorker.perform_in(4.hours, member_id: self.freelancer.id.to_s, job_order_id: self.id.to_s, perform: :resend_job_paid_to_freelancer)\n\n km_properties = self.job.km_properties\n km_properties[:paid_job] = self.currency.convert_to_idr(self.budget)\n km_properties[:job_order_id] = self.id.to_s\n km_properties[:type] = self.class.to_s\n\n KissmetricsWorker.perform_async(perform: :job_paid, identity: self.job.member.email, properties: km_properties)\n\n # notify other applicants that a freelancer has been hired, only for the first job order\n if self.first_paid_order?\n all_applicants = self.job.job_applications\n all_applicants.each do |ja|\n if ja != self.job_application\n MemberMailerWorker.perform_async(member_id: ja.member.id.to_s, job_order_id: self.id.to_s, perform: :send_freelancer_hired_to_other_applicants)\n end\n end\n end\n end",
"def mail; end",
"def email; end",
"def email; end",
"def email; end",
"def email; end",
"def atm_checkout_completed_successfully!\n self.update_column(:payment_status, \"order_placed_ATM\")\n publish(:pub_atm_checkout_completed_successfully, self) # to listener\n LadyboomailerJob.new.async.perform(LadybooMailer, :atm_checkout_completed_successfully, self) if @@sendmail\n LadyboomailerJob.new.async.perform(LadybooMailer, :order_placed, self) if @@sendmail\n #LadybooMailer.atm_checkout_completed_successfully(self).deliver if @@sendmail\n #LadybooMailer.order_placed(self).deliver if @@sendmail\n end",
"def create\n @job = @user.jobs.new(params[:job])\n\n respond_to do |format|\n if @job.save\n\t\t# send mail now or later...\n\t\tBackground.instance.delay.sendLater(@job)\n\t \n format.html { redirect_to(@job, :notice => 'Job was successfully created.') }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def job=(job_name)\n @job = job_name\n end",
"def notify\n if self.job.first_notify.present?\n self.job.unset(:first_notify)\n MemberMailerWorker.perform_async(member_id: self.job.member.id.to_s, job_application_id: self.id.to_s, perform: :send_new_job_application)\n end\n end",
"def job=(job)\n @job = job\n end",
"def launch_email_client(event)\n mail_list = @@item.mail_list\n mail_list = \"private@#{mail_list}.apache.org\" unless mail_list.include? '@'\n\n to = @@item.chair_email\n cc = \"#{mail_list},#{@@item.cc}\"\n\n if @@item.missing\n subject = \"Missing #{@@item.title} Board Report\"\n if @@item.attach =~ /^\\d/\n body = %{\n Dear #{@@item.owner},\n\n The board report for #{@@item.title} has not yet been submitted for\n this month's board meeting. Please try to submit these reports by the\n Friday before the meeting.\n\n Thanks,\n\n #{User.username}\n }\n else\n body = %{\n Dear #{@@item.owner},\n\n The board report for #{@@item.title} has not yet been submitted for\n this month's board meeting. If you or another member of the PMC are\n unable to get it in by twenty-four hours before meeting time, please\n let the board know, and plan to report next month.\n\n https://www.apache.org/foundation/board/reporting#how\n\n Thanks,\n\n #{User.username}\n\n (on behalf of the ASF Board)\n }\n end\n\n # strip indentation; concatenate lines within a paragraph\n indent = body[/^\\s*/]\n body = body.strip().gsub(/#{indent}/, \"\\n\").gsub(/(\\S)\\n(\\S)/, \"$1 $2\")\n else\n subject = \"#{@@item.title} Board Report\"\n body = @@item.comments.join(\"\\n\\n\")\n\n if not body and @@item.text\n monthNames = %w(January February March April May June July August\n September October November December)\n year = Agenda.date.split('-')[0].to_i\n month = Agenda.date.split('-')[1].to_i\n\n subject = \"[REPORT] #{@@item.title} - #{monthNames[month-1]} #{year}\"\n to = @@item.cc\n cc = mail_list\n body = @@item.text\n end\n end\n\n if event.ctrlKey or event.shiftKey or event.metaKey\n @email = {\n to: to,\n cc: cc,\n subject: subject,\n body: body\n }\n\n jQuery('#email-' + @@item.mail_list).modal(:show)\n else\n window.location = \"mailto:#{to}?cc=#{cc}\" +\n \"&subject=#{encodeURIComponent(subject)}\" +\n \"&body=#{encodeURIComponent(body)}\"\n end\n end",
"def forwarded_application(assignment)\n @moderator = assignment.manager\n @vacancy = assignment.job_application.vacancy\n @user = assignment.job_application.user\n @assignment = assignment\n\n mail to: @moderator.email, subject: \"A job apllication was forwarded to you.\"\n end",
"def order_in_progress\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def chore_notification_email(assignment)\n @user = assignment.user\n @chore = assignment.chore\n @due_date = assignment.due_date.to_formatted_s(:long_ordinal)\n @url = complete_chore_url(assignment)\n sendgrid_category \"Chore Notification\"\n # sendgrid_unique_args :key2 => \"newvalue2\", :key3 => \"value3\"\n mail :to => @user.email, :subject => \"#{@user.name}. You've got a chore!\"\n end",
"def send_notifications!\n NotificationMailer.job_notification(account_manager, self).deliver_later\n end",
"def create\n job_type = params[:type]\n email = params[:email]\n subject = params[:subject]\n job = Job.find(params[:id]) unless params[:id].nil?\n\n if job_type == 'assign'\n AutoMailer.job_assign(email, subject, job).deliver_later\n elsif job_type == 'reject'\n AutoMailer.job_reject(email, subject, job).deliver_later\n elsif job_type == 'members'\n AutoMailer.mail_members(email, subject, params[:body]).deliver_later\n elsif job_type == 'job'\n AutoMailer.mail_job(\"npfosi@gmail.com\", job).deliver_later\n AutoMailer.mail_job(email, job).deliver_later\n elsif job_type == 'update_job'\n AutoMailer.mail_job(\"npfosi@gmail.com\", job).deliver_later\n end\n\n render json: \"ok\", status: 204\n end",
"def fetch_mail\n# \tp \"Fetching mail...\"\n \tconfig = { :host => 'imap.gmail.com', :port => 993, :username => 'CrowdAssistant', :password => 'CrowdAss'}\n \timap = Net::IMAP.new(config[:host], config[:port], true)\n \timap.login(config[:username], config[:password])\n \timap.select(\"INBOX\")\n \tmessages_to_archive = []\n \timap.search([\"NOT\", \"DELETED\"]).each do |message_id|\n \t\ttask = imap.fetch(message_id, 'BODY[TEXT]')[0].attr['BODY[TEXT]']\n \t\tmessage = imap.fetch(message_id, 'ENVELOPE')[0].attr['ENVELOPE']\n \t\tfrom = \"#{message.sender[0].mailbox}@#{message.sender[0].host}\"\n# p from\n \t\tu = User.find_by_email(from)\n# p u\n \t\tif u\n\t \t\t#Why does an empty resource and resourcetype fail?\n task = task.gsub(\"=\\r\\n\", \"\")\n\t \t\tt = Task.create(:user_id => u.id, :instructions => task, :fields => \"[{\\\"Reply\\\":\\\"t\\\"}]\", :priority => 2, :workflow => \"p\", :redundancy => 2, :resource => \"www.google.com\", :resourcetype => \"l\", :status=>\"Not Started\")\n\t \t\tAssistant.handle(t)\n\t \telse\n#\t \t\tp \"Whoops, some dude who hasn't signed up sent us an email\"\n\t \tend\n \t\tmessages_to_archive << message_id\n \tend\n \timap.store(messages_to_archive, \"+FLAGS\", [:Deleted]) unless messages_to_archive.empty?\n end",
"def launch_email_client()\n mail_list = @@item.mail_list\n mail_list = \"private@#{mail_list}.apache.org\" unless mail_list.include? '@'\n\n to = @@item.chair_email\n cc = \"#{mail_list},#{@@item.cc}\"\n\n if @@item.missing\n subject = \"Missing #{@@item.title} Board Report\"\n body = %{\n Dear #{@@item.owner},\n\n The board report for #{@@item.title} has not yet been submitted for\n this month's board meeting. If you or another member of the PMC are\n unable to get it in by twenty-four hours before meeting time, please\n let the board know, and plan to report next month.\n\n https://www.apache.org/foundation/board/reporting#how\n\n Thanks,\n\n #{User.username}\n\n (on behalf of the ASF Board)\n }\n\n # strip indentation; concatenate lines within a paragraph\n indent = body[/^\\s*/]\n body = body.strip().gsub(/#{indent}/, \"\\n\").gsub(/(\\S)\\n(\\S)/, \"$1 $2\")\n else\n subject = \"#{@@item.title} Board Report\"\n body = @@item.comments.join(\"\\n\\n\")\n\n if not body and @@item.text\n monthNames = %w(January February March April May June July August\n September October November December)\n year = Agenda.date.split('-')[0].to_i\n month = Agenda.date.split('-')[1].to_i\n\n subject = \"[REPORT] #{@@item.title} - #{monthNames[month-1]} #{year}\"\n to = @@item.cc\n cc = mail_list\n body = @@item.text\n end\n end\n\n window.location = \"mailto:#{to}?cc=#{cc}\" +\n \"&subject=#{encodeURIComponent(subject)}\" +\n \"&body=#{encodeURIComponent(body)}\"\n end",
"def jid=(_arg0); end",
"def get_job_name(course, assessment, submission)\n \"#{course.name}_#{assessment.name}_#{submission.version}_#{submission.course_user_datum.email}\"\n end",
"def instructor_reminder_email(class_date)\n @response_email = ResponseEmail.find_by_purpose(\"auto_instructor_reminder\")\n @body = format_instructor_auto_reminder(@response_email.body, class_date)\n mail(:to => class_date.instructors, :subject => @response_email.subject, :reply_to => @response_email.reply_to) unless class_date.instructors.blank?\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 submit_additional(ecn, message, additionalemails, subject)\n @ecn = ecn\n @message = message\n @emails = additionalemails\n @subject = subject\n to = []\n to << @emails\n mail to: to, subject: 'ECN '+@ecn.ecn_number.to_s+' approval'+' '+@subject, template_name: 'submitted'\n end",
"def earn_jp(jp)\n @jobs[@current_job].earn_jp(jp)\n unlock_advanced_job\n end",
"def jobconf_url\n NAMENODE_URL + \":50030/jobconf.jsp?jobid=#{job_id}\"\n end",
"def proposal_to_a_board_members\n @inv = Invitation.find params[:inv]\n @acc = Accept.find params[:acc]\n\n @summary = []\n @summary << \"L'evento\"\n @summary << \", organizzato da #{@inv.organizer},\" unless @inv.organizer.blank?\n @summary << \" avrà luogo\"\n @summary << \" a #{@inv.location}\" unless @inv.location.blank?\n @summary << \" in data #{I18n.localize(@inv.from_date_and_time.to_date, format: :long_w_weekday)}\" if @inv.from_date_and_time\n @summary << \" e\" if !@inv.location.blank? || @inv.from_date_and_time\n @summary << \" avrà per tema '#{@inv.title}'.\"\n @summary = @summary.join\n # @url =\n @preheader = \"Proposta di partecipazione ad un evento in rappresentanza di ARERA\"\n\n user = Rails.env==\"development\" ? User.find_by(username: ENV[\"test_username\"]) : @acc.user\n\n Sidekiq::Logging.logger.info \"Sending an email 'Proposta di incarico' to #{user.display_name} [#{user.email}]\"\n mail(to: user.email, subject: 'Proposta di incarico')\n\n end",
"def job_name\n @job_name ||= QA::Runtime::Env.ci_job_name&.gsub(%r{ \\d{1,2}/\\d{1,2}}, '')\n end",
"def finish\n self.class.debug_log(\"SAVE #{flavor} \" \\\n \"from=#{begin\n user.login\n rescue StandardError\n \"nil\"\n end} \" \\\n \"to=#{begin\n to_user.login\n rescue StandardError\n \"nil\"\n end} \" +\n queued_email_integers.map { |x| \"#{x.key}=#{x.value}\" }.join(\" \") +\n queued_email_strings.map { |x| \"#{x.key}=\\\"#{x.value}\\\"\" }.join(\" \"))\n current_locale = I18n.locale\n unless MO.queue_email || QueuedEmail.queue\n deliver_email if RunLevel.is_normal?\n destroy\n end\n I18n.locale = current_locale\n end",
"def monthly\n @greeting = \"Hello\"\n mail subject: args[:subject], to: args[:emails]\n mail to: \"to@example.org\"\n end",
"def requests(job)\r\n {\r\n :journal_entry_query_rq => {\r\n # :max_returned => 100,\r\n # :xml_attributes => { \"requestID\" =>\"1\", 'iterator' => \"Start\" },\r\n :modified_date_range_filter => {\"from_modified_date\" => qbwc_log_init(WorkerName), \"to_modified_date\" => qbwc_log_end()},\r\n :include_line_items => true\r\n }\r\n }\r\n end",
"def send_job_status(jobname)\n\t\tputs \"* Checking status of: #{@jenkins_url}\"\n\t\tresponse = http_req(@jenkins_url)\n\t\t\n\t\tjobs = JSON.parse(response.body)[\"jobs\"]\n\t\t\n\t\tjobs.each { |j|\n\t\t\tname = j[\"name\"]\n\n\t\t\tif name.casecmp(jobname) == 0\n\t\t \twrite_serial_status(j)\n \t\t\tend\n\t\t}\n\tend",
"def create\n arg = params[:email]\n counter = Job.enqueue(arg)\n render :status => :accepted, :json => { jobId: counter }\n end",
"def jobdetails_url\n NAMENODE_URL + \":50030/jobdetails.jsp?jobid=#{job_id}\"\n end",
"def send_email(user, user_url)\n user.recipients.each do |recipient|\n @recipient = recipient\n @user = user\n @executor = user.executors.first\n @user_url = user_url\n mail( \n :to => @recipient.email,\n :subject => 'Our Condolences') do |format|\n format.html {render 'send_email' }\n format.text { render 'send_plain_email'}\n end\n end\n end",
"def job_send(options)\n @options = {\n :id => nil,\n :include => [],\n :exclude => [],\n :from_name => nil,\n :from_email => nil,\n :additional => nil,\n :when => nil,\n :multipart => false,\n :track => true,\n :test => false\n }.merge(options)\n \n # Sanity check:\n if @options[:id].nil? ||\n @options[:include].empty?\n raise \"#{ERROR} id and include array/string required!\"\n end\n \n @date =\n (@options[:when].strftime('%-m/%-d/%Y') if\n @options[:when].instance_of?(Date) ||\n @options[:when].instance_of?(DateTime)) || 'immediate'\n \n @time =\n (@options[:when].strftime('%H:%M') if\n @options[:when].instance_of?(DateTime)) || ''\n \n result = Nokogiri::XML(send(render(:job)))\n info = result.xpath('//job_info').text\n desc = result.xpath('//job_description').text\n \n raise \"#{ERROR} job send failed !\" if !info.include? 'success'\n desc\n end",
"def collections_user_added_to_job(user, job)\n @user = user\n @job = job\n\n mail(to: @user.email, subject: \"#{@user.full_name}, you have been added as a subscriber to #{@job.name}.\")\n end",
"def email_on_complete\n count = options['email_me']\n return unless count && count > 0\n if Document.owned_by(document.account).pending.count == 0\n LifecycleMailer.documents_finished_processing(document.account, count).deliver_now\n end\n end",
"def receipt\n authorize @job_candidate\n @job = @job_candidate.job\n end",
"def queue_mid_quarter_emails(action = 'invite', unit = nil)\n send_evals = !placements.filled.empty?\n send_invites = (action == 'invite')\n \n emails = { 'Evaluate only' => [], 'Invite only' => [], 'Invite and Evaluate' => [] }\n\n # go through each primary contact and add to the two lists\n organization.primary_contacts_for_unit(unit).each do |contact|\n emails['Evaluate only'] << contact if send_evals\n emails['Invite only'] << contact if send_invites\n end\n \n # add all the position supervisors and primary contacts to the eval list\n if send_evals\n emails['Evaluate only'] << placements.filled.collect(&:position).collect(&:supervisor)\n emails['Evaluate only'] << organization.primary_contacts_for_unit(unit)\n end\n \n # flatten the hashes\n emails['Evaluate only'] = emails['Evaluate only'].flatten.uniq.compact\n emails['Invite only'] = emails['Invite only'].flatten.uniq.compact\n \n # clean up to create the evals + invites list\n emails['Evaluate only'].each do |e|\n if emails['Invite only'].include?(e)\n emails['Invite and Evaluate'] << e\n emails['Invite only'].delete(e)\n emails['Evaluate only'].delete(e)\n end\n end\n\n # Define the command after delivery\n if action == 'invite'\n command_after_delivery = \"Organization.find(#{organization.id}).activate_for(Quarter.find(#{quarter.next.id}), true, #{unit.id})\"\n else\n command_after_delivery = \"Organization.find(#{organization.id}).mark_inactive\"\n end\n\n # send the emails\n emails.each do |type, recipients|\n recipients.each do |r|\n tmail_object = MID_QUARTER_EMAIL_TEMPLATES[type].create_email_to(r)\n EmailQueue.queue(r.person_id, tmail_object, nil, command_after_delivery)\n @emails_sent = true\n end\n end\n \n # Mark inactive if not inviting for next quarter -- this takes care of organizations that don't get any emails (and therefore\n # the command_after_delivery wouldn't be executed)\n organization.mark_inactive if action != 'invite' && !@emails_sent\n\n end"
] |
[
"0.7358816",
"0.7157537",
"0.6881045",
"0.67670995",
"0.67127216",
"0.66852236",
"0.6666788",
"0.65974325",
"0.6585557",
"0.64286643",
"0.64198047",
"0.6322806",
"0.63017726",
"0.62776107",
"0.62386376",
"0.62378985",
"0.6217127",
"0.6202325",
"0.6202325",
"0.62008697",
"0.6182346",
"0.6182346",
"0.61352897",
"0.6128665",
"0.6122685",
"0.61167014",
"0.61108315",
"0.6070409",
"0.6048682",
"0.6041521",
"0.6011553",
"0.6010829",
"0.59238416",
"0.5900323",
"0.58839375",
"0.58799213",
"0.5875741",
"0.58704627",
"0.58602417",
"0.5846752",
"0.5823363",
"0.57422036",
"0.57256126",
"0.5705795",
"0.5696829",
"0.5694928",
"0.5694567",
"0.56903225",
"0.56798387",
"0.5671498",
"0.5658286",
"0.5653591",
"0.5645289",
"0.56434315",
"0.5641141",
"0.5637596",
"0.56192195",
"0.561767",
"0.56042874",
"0.559775",
"0.5586815",
"0.5586399",
"0.5579259",
"0.5579259",
"0.5579259",
"0.5579259",
"0.5563812",
"0.5563495",
"0.55611014",
"0.5552999",
"0.5551473",
"0.55489236",
"0.5546369",
"0.55322516",
"0.5514216",
"0.5484359",
"0.54792994",
"0.5472003",
"0.54705334",
"0.54704034",
"0.5435466",
"0.54345334",
"0.54271996",
"0.54260606",
"0.54121006",
"0.53968793",
"0.5394696",
"0.5389601",
"0.5386492",
"0.53853095",
"0.53841305",
"0.538249",
"0.5382391",
"0.5374279",
"0.536963",
"0.53680134",
"0.53646666",
"0.53575486",
"0.53573287",
"0.53564143"
] |
0.6372643
|
11
|
copy from the key's data using the glob pattern
|
def nuspec_copy(key, glob)
puts "key: #{key}, glob: #{glob}, proj dir: #{PROJECTS[key][:dir]}"
FileList[File.join(FOLDERS[:binaries], PROJECTS[key][:dir], glob)].collect{ |f|
to = File.join( FOLDERS[:"#{key}"][:nuspec], "lib", FRAMEWORK )
FileUtils.mkdir_p to
cp f, to
# return the file name and its extension:
File.join(FRAMEWORK, File.basename(f))
}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def copy_tree_to(key, source_root, source_key)\n source_root.unprefixed_subtree_keys(source_key).each do |unprefixed_key|\n copy_content_to(File.join(key, unprefixed_key), source_root, File.join(source_key, unprefixed_key))\n end\n end",
"def nuspec_copy(key, glob)\r\n puts \"key: #{key}, glob: #{glob}, proj dir: #{Projects[key][:dir]}\"\r\n FileList[File.join(Folders[:binaries], Projects[key][:dir], glob)].collect{ |f|\r\n to = File.join( Folders[:nuspec], \"lib\", FRAMEWORK )\r\n FileUtils.mkdir_p to\r\n cp f, to\r\n\t # return the file name and its extension:\r\n\t File.join(FRAMEWORK, File.basename(f))\r\n }\r\n end",
"def copy_content_to(key, source_root, source_key, metadata = {})\n source_root.with_input_io(source_key) do |io|\n copy_io_to(key, io, source_root.md5_sum(source_key), source_root.size(source_key),\n {mtime: source_root.mtime(source_key)}.merge(metadata))\n end\n end",
"def copy_key(pipe, key)\n key_type = redis.type(key)\n return false unless ['list', 'hash', 'string', 'set', 'zset'].include?(key_type)\n\n self.send(\"copy_#{key_type}\", pipe, key)\n end",
"def convert_source(key, data)\n if data.is_a?(Hash)\n data.each do |subkey, subdata|\n subkey_fullname = key + (key == '' ? '' : '.') + subkey\n convert_source(subkey_fullname, subdata)\n end\n elsif data.is_a?(String)\n $SOURCE[key] = data\n else\n STDERR.puts \"Source with unexpected type #{key} - halting\"\n exit 1\n end\nend",
"def method_missing(method_name, *args)\n\t\tmatch = method_name.to_s.match(/^copy_(\\w+)_(\\w+)/)\n\t\tif(match)\n\t\t\tcopy_files match[1], match[2]\n\t\telse\n\t\t\tsuper\n\t\tend\n\tend",
"def search_new_key(key)\n _key = key\n if get_file(key).present?\n (1..999).each do |i|\n _key = key.cama_add_postfix_file_name(\"_#{i}\")\n break unless get_file(_key).present?\n end\n end\n _key\n end",
"def set_data_by_key(key, value)\n if FileFetcher::directory_exists?(@temp_folder_path) == false\n create_temp_directory\n end\n\n temp_file_path = File.join(@temp_folder_path, \"#{key}.txt\")\n File.open(temp_file_path, \"w+\") do |file|\n file.write(value)\n end\n end",
"def copy_content_to(key, source_root, source_key, metadata = {})\n if source_root.root_type == :s3 and source_root.can_s3_copy_to?(self.name)\n do_multipart = source_root.size(source_key) > AMAZON_CUTOFF_SIZE\n source_object = source_root.s3_object(source_key)\n target_object = s3_object(key)\n source_mtime = source_root.mtime(source_key)\n if source_mtime and !(metadata[:mtime])\n metadata[:mtime] = source_mtime.to_f.to_s\n end\n unless metadata[AMAZON_HEADERS[:md5_sum]]\n metadata[AMAZON_HEADERS[:md5_sum]] = source_root.md5_sum(source_key)\n end\n # metadata? I think the commented out will just copy, but haven't checked.\n source_object.copy_to(target_object, multipart_copy: do_multipart, metadata: metadata, metadata_directive: 'REPLACE')\n #source_object.copy_to(target_object, multipart_copy: do_multipart)\n else\n super\n end\n end",
"def copy_ssh_key\n copy_file_to_storage_directory(full_keypair_path)\n end",
"def copy_files\n require 'ftools'\n @files.inject({}) do |result, file|\n seed = (rand * 1000).to_i\n new_path = \"temp_uploads/#{seed}\" + file[1].path.split('/').last\n File.move(file[1].path, new_path, true)\n result[file[0].to_sym] = new_path\n result\n end\n end",
"def cp(src,dst)\n @files_to_copy[dst] = [] unless @files_to_copy.has_key? dst\n @files_to_copy[dst].push(src)\n end",
"def pfmerge(dest_key, *source_key); end",
"def pfmerge(dest_key, *source_key); end",
"def copy_file(key:, file:)\n remote_metadata = file.data.merge(\"storage\" => @storage_map[key])\n remote_file = Shrine::UploadedFile.new(remote_metadata)\n Shrine.storages[key].upload(remote_file,file.id)\n end",
"def copy(key, copy_key, bucket = nil, options = {})\n bucket = bucket_name(bucket)\n source_key = path!(bucket, key)\n default_options = {'x-amz-copy-source' => source_key}\n target_key = path!(bucket, copy_key)\n returning put(target_key, default_options) do\n acl(copy_key, bucket, acl(key, bucket)) if options[:copy_acl]\n end\n end",
"def dest_glob\n Dir.glob File.join(PictureTag.dest_dir, name_left + '?' * 6 + name_right)\n end",
"def read_to(pattern); end",
"def grab(*key)\n synchronize do\n @data.get(*key)\n end\n end",
"def copy_content\n @tocopy.each do |pair|\n src = pair[0]\n dst = File.expand_path(File.join(@temp_path, pair[1] || ''))\n dstdir = File.dirname(dst)\n FileUtils.mkpath(dstdir) unless File.exist?(dstdir)\n FileUtils.cp_r(src, dst)\n end\n\n # clear out the list of things to copy so that snippets can\n # re-load it and call copy_content again if needed\n @tocopy = []\n end",
"def copy(copy_name, options = {})\n self.class.copy(key, copy_name, bucket.name, options)\n end",
"def glob_data_paths(pattern,&block)\n return enum_for(:glob_data_paths,pattern).to_a unless block_given?\n\n DataPaths.paths.each do |path|\n Dir.glob(File.join(path,pattern),&block)\n end\n end",
"def [](path, pattern)\n glob(path, pattern, 0)\n end",
"def backup_data(src_file)\n backup_path = src_file + '.simplib_migration.bak.' + Time.now.strftime('%Y_%m_%d_%s')\n puts %Q(Making backup at #{backup_path})\n FileUtils.cp_r(src_file, backup_path)\nend",
"def append_with_glob_member!(name)\n glob_member = name + '*'\n redis.zadd(set_key, 0, glob_member)\n end",
"def read!\n path = pathname\n path.glob('*').each do |file|\n #next if file.to_s.index(/[.]/) # TODO: rejection filter\n name = file.basename #path_to_name(file, path)\n self[name] = get!(file) unless key?(name)\n end\n self\n end",
"def edit_matched_files(*match, &block)\n match.each do |m|\n if Pathname.new(m).absolute?\n path = m\n else\n path = File.join(File.expand_path(TARGET_PATH), m)\n end\n puts \"path: #{path}\"\n\n Dir.glob(path).each do |file|\n block.call(Content.create(file))\n end\n end\nend",
"def from_pattern_match(keys, pattern, match)\n keys.each_with_index.map do |key, idx|\n # Check if there is any replacement specified\n if pattern[key]\n interpolate(pattern[key], match)\n else\n # No replacement defined, just return correct match group\n match[idx + 1]\n end\n end\n end",
"def update!(**args)\n @file_patterns = args[:file_patterns] if args.key?(:file_patterns)\n @sample_gcs_file_specs = args[:sample_gcs_file_specs] if args.key?(:sample_gcs_file_specs)\n end",
"def update!(**args)\n @file_patterns = args[:file_patterns] if args.key?(:file_patterns)\n @sample_gcs_file_specs = args[:sample_gcs_file_specs] if args.key?(:sample_gcs_file_specs)\n end",
"def from_hash(data)\n @group = data[\"group\"]\n @file = data[\"source\"]\n\n self\n end",
"def cp_r srcpath, dstpath\n src_bucket,src_key_path = split_path(srcpath)\n dst_bucket,dst_key_path = split_path(dstpath)\n mkdir_p(dstpath) unless exists?(dstpath)\n if directory? srcpath\n paths_to_copy = ls_r(srcpath)\n common_dir = common_directory(paths_to_copy)\n paths_to_copy.each do |path|\n bkt,key = split_path(path)\n src_key = key\n dst_key = File.join(dst_key_path, path.gsub(common_dir, ''))\n @s3.interface.copy(src_bucket, src_key, dst_bucket, dst_key)\n end\n else\n @s3.interface.copy(src_bucket, src_key_path, dst_bucket, dst_key_path)\n end\n end",
"def glob=(_arg0); end",
"def dmpSetDatafile(k,datafilename)\n @datafile[k] = datafilename ;\n end",
"def get_file_data files, suffix_pattern = \"\\.fastq\\.gz\"\n files = [files].flatten\n\n $NAME_PATTERN = /(.*)_S(\\d+)_L(\\d{3})_R(\\d)_(\\d{3})#{suffix_pattern}/\n # L1401_S1_L001_R1_001.fastq.gz\n # $1 = \"L1401\"\n # $2 = \"1\"\n # $3 = \"001\"\n # $4 = \"1\"\n # $5 = \"001\"\n\n sample_sheet_data = get_sample_sheet_data()\n\n\n file_data = files.collect do |file|\n base_name = File.basename(file)\n match = base_name =~ $NAME_PATTERN\n raise \"ERROR: #{file} does not match expected file name pattern\" unless match\n data = {:name => base_name, :path => file,\n :sample_name => $1, \n :lane => $3.to_i, :read => $4.to_i, :set => $5.to_i}\n barcode = sample_sheet_data[\"samples\"][$2.to_i - 1][\"index\"]\n\n if !(barcode =~ /([ATCGN]+|NoIndex|Undetermined)/)\n raise \"ERRROR: invalid barcode for sample: #{barcode}\"\n end\n data[:barcode] = barcode\n\n puts data.inspect\n data\n end\n file_data\n end",
"def filename\n files = Hash.new\n filenames = Dir.glob('/home/vagrant/register-stub/data/*.json')\n filenames.foreach(\".\") do |file|\n puts file\n files[file].add file\n end\n return files.to_json\nend",
"def copy_sample_files\n system 'for filename in config/*.sample; do cp -n \"$filename\" \"${filename%.sample}\"; done'\nend",
"def copy(*args)\n !!client.bucket_multipart_copy_upload(*args.unshift(upload_id, key))\n end",
"def copy_file(src, dest, preserve = false, dereference = true)\r\n ent = Entry_.new(src, nil, dereference)\r\n ent.copy_file dest\r\n ent.copy_metadata dest if preserve\r\n end",
"def copy_file(src, dest, preserve = false, dereference = true)\r\n ent = Entry_.new(src, nil, dereference)\r\n ent.copy_file dest\r\n ent.copy_metadata dest if preserve\r\n end",
"def associate_to_all(plate:, data:, key:)\n data_map = []\n parts.each do |part|\n loc = plate.find(part)\n loc[2] = data\n loc[3] = key\n data_map.push(loc)\n end\n associate_value_key_to_parts(plate: plate, data_map: data_map)\n end",
"def file_pattern\n return 'US_CO_*.geojson'\n end",
"def copy_entry(dest, dereference: false, preserve: true)\n\t\t\t\trequire 'fileutils'\n\t\t\t\tent = FileUtils::Entry_.new(@path, nil, dereference)\n\t\t\t\tent.copy dest.to_s\n\t\t\t\tent.copy_metadata dest.to_s if preserve\n\t\t\tend",
"def fetch_data(hash, key)\n cur = hash\n key.split('.').each { |k| cur = (cur || {})[k] }\n cur\n end",
"def build_file_into_master_hash(master_hash, key, source_file)\r\n\t\tentries = grab_and_hashify(source_file, SIZE_OF_HASH_BLOCKS)\r\n\t\tif(!entries.blank?)\r\n\t\t\tmaster_hash.merge({ key.to_sym => entries })\r\n\t\telse\r\n\t\t\tmaster_hash.delete(key.to_sym)\r\n\t\t\tmaster_hash\r\n\t\tend\r\n\tend",
"def create_source_files(pattern)\n source_files = []\n if pattern[:cn]\n names = pattern[:cn].scan(/(^[a-zA-Z]*)[^a-zA-Z]*([a-zA-Z]*)/).flatten\n names[0] = '*' if names[0].empty?\n names[1] = '*' if names[1].empty?\n names.permutation do |names|\n file = File.join(URL, \"#{names.join('_').downcase}.contact\")\n Dir.glob(file).each { |file| source_files << file }\n end\n elsif pattern[:sn] or pattern[:gn]\n sn = pattern[:sn] ? pattern[:sn].strip.downcase : '*'\n gn = pattern[:gn] ? pattern[:gn].strip.downcase : '*'\n Dir.glob(File.join(URL, \"#{gn}_#{sn}.contact\")).each do |file|\n source_files << file\n end\n else\n Dir.glob(File.join(URL, \"*_*.contact\")).each do |file|\n source_files << file\n end\n end\n source_files\n end",
"def get_data_by_key(key)\n expected_file_path = File.join(@temp_folder_path, \"#{key}.txt\")\n if FileFetcher::file_exists?(expected_file_path)\n FileFetcher::get_file_contents(expected_file_path)\n else\n nil\n end\n end",
"def copy\n create_obj(obj.amoeba_dup)\n build_enabled(obj)\n\n #add (copy) suffix to name/title, etc.\n obj.send(obj.class.columns_for_table[0] + '=', obj.send(obj.class.columns_for_table[0]) + I18n.t('backend.copy_suffix'))\n end",
"def copy_files(wildcard, dest_dir)\n for_matching_files(wildcard, dest_dir) { |from, to| copy(from, to) }\n end",
"def copy_files(wildcard, dest_dir)\n for_matching_files(wildcard, dest_dir) { |from, to| copy(from, to) }\n end",
"def get key\n entry = @keydict[key]\n\n if entry\n if entry[0] == @data_file.path\n pos = @data_file.pos\n @data_file.pos = entry[2]\n value = @data_file.read entry[1]\n @data_file.pos = pos\n value\n else\n data_file = @old_data_files[entry[0]]\n unless data_file\n data_file = File.open(entry[0], \"rb\")\n @old_data_files[entry[0]] = data_file\n end\n\n data_file.pos = entry[2]\n data_file.read entry[1]\n end\n end\n end",
"def image(key)\n return @data[key].clone\n end",
"def copy_file(src, dest, preserve = false, dereference = true)\n ent = Entry_.new(src, nil, dereference)\n ent.copy_file dest\n ent.copy_metadata dest if preserve\n end",
"def _output_dir_file_data_filter(hash, filter_key)\n hash.select { |key, _| key == filter_key }\n end",
"def process_key(key)\n if ::File.exists?(key)\n key\n else\n tempfile = ::Tempfile.new('key')\n tempfile.write(key)\n tempfile.flush\n\n tempfile.path\n end\n end",
"def getFilePattern(filePattern)\n return if filePattern.nil?\n File.split(filePattern).inject do |memo, obj| \n File.join(memo, obj.split(/\\./).join('*.'))\n end\nend",
"def sdiffstore(destination, *keys); end",
"def sdiffstore(destination, *keys); end",
"def glob(match)\n paths = Array.new(match) # Force array-ness\n\n paths.map! do |spec|\n if spec.include?('*')\n files.select do |file, _|\n # Dir#glob like source matching\n File.fnmatch?(spec, file, File::FNM_PATHNAME | File::FNM_DOTMATCH)\n end.sort\n else\n [spec, files[spec]]\n end\n end\n\n Hash[*paths.flatten]\n end",
"def copy_to_metadata_full_path\n FileUtils.copy @full_path, metadata_full_path\n end",
"def copy_to_metadata_full_path\n FileUtils.copy @full_path, metadata_full_path\n end",
"def copy_files(srcGlob, targetDir, taskSymbol)\n mkdir_p targetDir\n FileList[srcGlob].each do |f|\n target = File.join targetDir, File.basename(f)\n file target => [f] do |t|\n cp f, target\n end\n task taskSymbol => target\n end\nend",
"def import_from_datastore(hash, prefix = '')\n hash.each_key { |k|\n if (self.datastore[prefix + k])\n hash[k] = self.datastore[prefix + k]\n end\n }\n end",
"def load_buffer_data(key)\n @buffers[@active_buffer].set_buffer_data(key,read_file(key))\n end",
"def expand_files map, config\n files = Array.new\n if config.has_key? map\n config[map].each do |v|\n m = /^\\/.*/.match v #starts with /, otherwise it's a group name\n if m\n files << m.to_s\n else\n files + (expand_files m.to_s, config)\n end\n end\n end\n return files\nend",
"def glob pattern\n Dir[File.join(@originals,pattern)].collect do |f|\n File.basename(f)\n end\n end",
"def copy_item(fname)\n src = source + fname\n if src.directory?\n copy_dir(fname)\n else\n copy_doc(fname)\n end\n end",
"def [](key)\n index = @keydir[key] or return nil\n @keydir.data_files[index.file_id][index.value_pos, index.value_sz].value\n end",
"def copy_data_dir_here\n copy_all from: content, to: current_dir\nend",
"def glob=(pattern)\n @glob = pattern\n if pattern.kind_of?(Regexp)\n @pattern = pattern\n else\n @pattern = scan_string\n end\n end",
"def classify_key(data, filename); end",
"def from_hash(hash, *args)\n replace(hash[\"data\"])\n end",
"def keys(glob = T.unsafe(nil)); end",
"def replace(entry, src_path); end",
"def add_key_path(key_name, *path)\n fields.merge!({ key_name => path })\n end",
"def update_file_data(task_data)\n task_data['files'].each { |f| f['name'] = f['filename'] }\n task_data\n end",
"def update_file_data(task_data)\n task_data['files'].each { |f| f['name'] = f['filename'] }\n task_data\n end",
"def extract_data_by_pattern(regexp, message_pattern)\n if match = regexp.match(raw_message) then\n # Creates a hash maching :field_x => data\n new_data = Hash[match.names.zip(match.captures)].symbolize_keys\n\n new_data[:timestamp] = DateTime.strptime new_data[:timestamp], \n message_pattern.source.timestamp_definition\n new_data[:timestamp] += log.time_bias.seconds\n\n self.attributes = new_data\n self.message_pattern = message_pattern\n self.save\n end\n end",
"def file_pattern\n return 'US_OR_*.geojson'\n end",
"def match(glob, &block)\n yield @filename\n end",
"def add(key_file); end",
"def keys(glob)\n timeout_retry(3, 3){\n write \"KEYS #{glob}\\r\\n\"\n bulk_reply.split(' ')\n }\n end",
"def copied(src_item, item)\n end",
"def get_data(key) \n filename = _find_file_key(key)\n return nil if filename.nil?\n file = File.open(@cache_dir + filename, \"rb\")\n contents = file.read\n return Marshal.load(contents)\n end",
"def glob(pattern)\n Dir.chdir(@output_dir) do\n Dir[pattern]\n end\n end",
"def [](key, file=_root_file)\n with_file(file, key)\n end",
"def filtered_copy(src_dir, dest_dir, filters_def = Registry[:filters_def])\n self.copy(:todir => dest_dir.to_s) do\n self.filterset do\n filters_def['filters'].each do |filter|\n token = filter.keys.first\n value = filter[token]\n self.filter(:token => token, :value => value)\n end\n end\n\n filters_def['filtered_files'].each do |includes_pattern|\n self.fileset(:dir => src_dir.to_s, :includes => includes_pattern)\n end\n end\n\n self.copy(:todir => dest_dir.to_s) do\n self.fileset(:dir => src_dir.to_s, :includes => '**/*',\n :excludes => filters_def['filtered_files'].join(','))\n end\n end",
"def write_key(*key); end",
"def copy(file, new_basename = nil, pathtype: :tree)\n filename = new_basename || File.basename(file)\n path = store_path(filename)\n File.open(path, 'wb') { |f| f.write(File.new(file).read) }\n file_path path, pathtype\n end",
"def copy(*paths)\n paths = paths.flatten\n mappings = {}\n paths.each do |path|\n if path.is_a? Hash\n mappings.merge! path\n else\n mappings[path] = path\n end\n end\n\n mappings.each do |src, dest|\n ensure_folder dest\n FileUtils.cp src_path(src), dest_path(dest)\n @to_copy.delete src\n end\n end",
"def copy_file(file_name, existing_data)\n data = YAML.load_file(file_name)\n\n new_data = process_data(data)\n\n existing_data.concat(new_data)\n\n #file = File.open(new_file_name, 'w')\n #file.puts new_data.to_yaml\n #file.close\nend",
"def extract(entry, dest_path, &block); end",
"def glob(path, glob)\n\t\t@connection.glob(path, glob)\n\tend",
"def glob(*args, &block)\n @entry_set.glob(*args, &block)\n end",
"def sinterstore(destination, *keys); end",
"def sinterstore(destination, *keys); end",
"def clone_song_ignoring_patterns_and_structure(original_song)\n cloned_song = Song.new(original_song.kit.base_path)\n cloned_song.tempo = original_song.tempo\n cloned_song.kit = original_song.kit\n \n return cloned_song\n end",
"def store(path ,data)\n @sync.synchronize(Sync::EX){\n if data.kind_of? Hash\n data.each do |key, value|\n if key.kind_of? Array\n store( path + key, value)\n next\n end\n key = key.to_sym\n if key == VALUE_KEY\n store( path, value )\n else\n store( path + [key], value)\n end\n end\n else\n @source[path] = data\n end\n }\n end",
"def preform_copy_file\n @destination_files.each do |destination|\n copy_file(@sources.pop, destination)\n end\n end",
"def process_globs(globs); end"
] |
[
"0.6027272",
"0.5952779",
"0.5875576",
"0.5826581",
"0.5565297",
"0.5502867",
"0.54241097",
"0.53902346",
"0.53886354",
"0.53438026",
"0.53034526",
"0.52869344",
"0.5276853",
"0.5276853",
"0.52369374",
"0.5235098",
"0.51434904",
"0.5128714",
"0.5125614",
"0.5124747",
"0.51005334",
"0.5097749",
"0.50862455",
"0.5084363",
"0.508421",
"0.50647205",
"0.50602293",
"0.5042609",
"0.50299376",
"0.50299376",
"0.5023778",
"0.5020292",
"0.5018362",
"0.501695",
"0.5009179",
"0.5000132",
"0.4998761",
"0.49939325",
"0.49786806",
"0.49786806",
"0.4963653",
"0.4950257",
"0.49479422",
"0.49419737",
"0.49237806",
"0.49166304",
"0.4900538",
"0.49003723",
"0.4899488",
"0.4899488",
"0.48973835",
"0.4884055",
"0.48803934",
"0.48720846",
"0.48607183",
"0.48582852",
"0.48568308",
"0.48568308",
"0.48539442",
"0.48485607",
"0.48485607",
"0.48372382",
"0.48350284",
"0.4828791",
"0.482814",
"0.4823742",
"0.4823309",
"0.4818492",
"0.48164558",
"0.4806043",
"0.480403",
"0.47991908",
"0.4795652",
"0.47896266",
"0.47841677",
"0.47834346",
"0.47834346",
"0.47763783",
"0.47760934",
"0.476125",
"0.47478014",
"0.47473678",
"0.4745255",
"0.47446626",
"0.47422233",
"0.4739084",
"0.47277194",
"0.47266996",
"0.4721068",
"0.47094604",
"0.4707055",
"0.47048193",
"0.4699868",
"0.46988592",
"0.46974275",
"0.46974275",
"0.4690043",
"0.46815482",
"0.4679563",
"0.46672115"
] |
0.60046256
|
1
|
API methods api/campaigns (all campaigns) api/campaigns/active (all active campaigns) api/:country/campaigns (campaigns in country) api/:country/campaigns/active (active campaigns in country)
|
def api_index
campaigns = Campaign.all
campaigns = campaigns.for_country(params[:country].presence) if params[:country]
campaigns = campaigns.active if 'active' == params[:status]
respond_to do |format|
format.json { render json: campaigns }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def campaigns(options={})\n response = connection.get do |req|\n \treq.url \"campaigns\", options\n end\n return_error_or_body(response)\n \tend",
"def campaign_find_active\n call_api(:campaign_find_active)\n end",
"def get_campaigns_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CampaignsApi.get_campaigns ...\"\n end\n # resource path\n local_var_path = \"/campaigns\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_active'] = opts[:'filter_active'] if !opts[:'filter_active'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\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 => 'PageResourceCampaignResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CampaignsApi#get_campaigns\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @campaigns = site.campaigns.by_campaign_and_day.all\n render :json => @campaigns\n end",
"def get_campaign_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MarketingApi.get_campaign_all_using_get ...'\n end\n # resource path\n local_var_path = '/campaign'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\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 => 'PageCampaign')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MarketingApi#get_campaign_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def campaigns(params, additional_headers = {})\n perform_request(self, @token, 'campaigns', 'get', params, additional_headers)\n end",
"def campaigns\r\n CampaignsController.instance\r\n end",
"def get_client_campaign_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MarketingApi.get_client_campaign_all_using_get ...'\n end\n # resource path\n local_var_path = '/client_campaign'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\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 => 'PageClientCampaignMapping')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MarketingApi#get_client_campaign_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @campaigns = Campaign.where(:live => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @campaigns }\n end\n end",
"def index\n @campaigns = current_organization.campaigns\n render :index\n end",
"def get_contact_campaigns(id)\n return make_request(\"#{self.endpoint}/#{id}/campaigns\")\n end",
"def campaigns\n response = get 'campaigns'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def get_campaigns(access_token, opts = {})\n\t\t\t\t\turl = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.campaigns')\n\t\t\t\t\turl = build_url(url, opts)\n\n response = RestClient.get(url, get_headers(access_token))\n body = JSON.parse(response.body)\n\n campaigns = []\n body['results'].each do |campaign|\n campaigns << Components::Campaign.create_summary(campaign)\n end\n\n Components::ResultSet.new(campaigns, body['meta'])\n end",
"def index\n @campaigns = Campaign.all\n end",
"def index\n @campaigns = Campaign.all\n end",
"def index\n @campaigns = Campaign.all\n end",
"def index\n if params[:user_id]\n @campaigns = Campaign.where(user_id: params[:user_id])\n else\n @campaigns = Campaign.all\n end\n render json: @campaigns\n end",
"def index\n @campaigns = Campaign.all\n render json: @campaigns\n end",
"def index\n @campaigns = Campaign.where(activated: true, completed: false)\n # @campaign_goal=\n # @campaign_count\n end",
"def get_campaigns_with_http_info(application_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_campaigns ...'\n end\n # verify the required parameter 'application_id' is set\n if @api_client.config.client_side_validation && application_id.nil?\n fail ArgumentError, \"Missing the required parameter 'application_id' when calling ManagementApi.get_campaigns\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_campaigns, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_campaigns, must be greater than or equal to 1.'\n end\n\n allowable_values = [\"enabled\", \"disabled\", \"archived\", \"draft\", \"scheduled\", \"running\", \"expired\"]\n if @api_client.config.client_side_validation && opts[:'campaign_state'] && !allowable_values.include?(opts[:'campaign_state'])\n fail ArgumentError, \"invalid value for \\\"campaign_state\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/v1/applications/{applicationId}/campaigns'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'campaignState'] = opts[:'campaign_state'] if !opts[:'campaign_state'].nil?\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?\n query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil?\n query_params[:'campaignGroupId'] = opts[:'campaign_group_id'] if !opts[:'campaign_group_id'].nil?\n query_params[:'templateId'] = opts[:'template_id'] if !opts[:'template_id'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse2004' \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementApi#get_campaigns\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n\n #activo session[:campaign_id] para saber en cual campana se esta\n if params[:campaign_id]\n @campaign_id = params[:campaign_id].to_i\n session[:campaign_id] = @campaign_id\n else\n @campaign_id = session[:campaign_id]\n end\n @resources = Resource.where(:campaign_id => @campaign_id).paginate :page => params[:page], :order => 'created_at DESC'\n @campaign = Campaign.find(@campaign_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @resources }\n end\n end",
"def index\n @campaigns = Campaign.all\n respond_to do |format|\n format.json { render :action => \"index\" }\n format.xml { render :action => \"index\" }\n end\n end",
"def index\n @api_v1_campaigns_managers = Api::V1::CampaignsManager.all\n end",
"def index\n @campaigns = Rails.cache.fetch 'campaign-list' do\n Campaign.order('created_at DESC').all\n end\n\n # Redirect to single campaign if there's only one running.\n if !Rails.env.test? && @campaigns.count === 1\n redirect_to root_path(campaign_path: @campaigns.first.path)\n return\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @campaigns }\n end\n end",
"def get_all_active_campaign_mapping_info()\n client = get_client\n query_result = client.http_get(\"/services/data/v#{client.version}/query?q=\" \\\n \"SELECT Id, Type, BZ_Region__c, Program_Site__c FROM Campaign WHERE IsActive = true\")\n sf_answer = JSON.parse(query_result.body)\n end",
"def index\n @campaigns = Campaign.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @campaigns }\n end\n end",
"def get_campaign_data_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MarketingApi.get_campaign_data_all_using_get ...'\n end\n # resource path\n local_var_path = '/campaign_data'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\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 => 'PageCampaignData')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MarketingApi#get_campaign_data_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @campaigns = Competition.all\n end",
"def index\n @platform_campaigns = PlatformCampaign.all\n end",
"def get_campaign_plan_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MarketingApi.get_campaign_plan_all_using_get ...'\n end\n # resource path\n local_var_path = '/campaign_plan'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\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 => 'PageCampaignPlan')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MarketingApi#get_campaign_plan_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_sms_campaigns\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/sms-campaigns'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n return nil if _context.response.status_code == 404\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end",
"def index\n @campaigns = Campaign.by_user_plan_and_tenant(@tenant.id, current_user).order(sort_column + \" \" + sort_direction).paginate(:page => params[:page], :per_page => 5)\n @campaign = Campaign.new\n end",
"def api_path(campaign_id, banner_id = nil)\n path = ['campaigns', campaign_id]\n path += ['banners', banner_id] if banner_id\n path.join(\"/\")\n end",
"def index\n @user_campaigns = UserCampaign.all\n end",
"def list(options={})\n Mailgun.submit(:get, campaign_url, options)[\"items\"] || []\n end",
"def index\n #get the featured campaigns\n @campaigns = Campaign.where({ featured: true }).order(\"created_at DESC\").limit(8)\n #create array of objects where we display each campaign's id, name, goal and image_url\n campaigns_hash_array = @campaigns.collect{|campaign| {\"campaign_id\"=> campaign.id, \"campaign_name\" => campaign.name, \"campaign_goal\" => campaign.goal_cents/100, \"campaign_image_url\" => campaign.getimageurl(campaign.image) }}\n if(campaigns_hash_array != nil)\n render json: campaigns_hash_array\n else\n render json: no_featured_campaigns_error, :status => 404\n end\n end",
"def sms_campaigns_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SmsCampaignApi.sms_campaigns_get ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling SmsCampaignApi.sms_campaigns_get, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling SmsCampaignApi.sms_campaigns_get, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/sms-campaigns'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SmsCampaignApi#sms_campaigns_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def campaigns(options={})\n Resources::Campaigns.new(self, options)\n end",
"def index\n @campaigns = Campaign.order(id: :desc).page params[:page]\n end",
"def country_list\n get_request( \"/api/v2_1/api/countries\")\n end",
"def campaigns(id = nil, opts = {})\n load_resource(Campaign, id, opts)\n end",
"def index\n @campaigns = Campaign.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @orgadmin_campaigns }\n end\n end",
"def campaign\n case params[:page_type]\n when \"wdc\"\n @communities = Community.where(:label => \"wdc\").order(\"name\")\n render :wdc\n when *[\"okl\",\"omakotiliitto\"]\n @communities = Community.where(:label => \"okl\").order(\"name\")\n render :okl\n else\n @contact_request = ContactRequest.new\n render :index\n end\n end",
"def index\n redirect_to campaign_path(@campaign)\n end",
"def index\n\n # 添加了活动\n @campaign = Campaign.find(params[:campaign_id])\n @applies = Apply.where(\"campaign_id = ?\" , @campaign.id).order(\"created_at desc\")\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @applies }\n end\n end",
"def api\n # Instantiate an instance of Gibbon with the API key provided to this adapter.\n # We only work with the lists api here, so namespace into that.\n Gibbon::Request.new(api_key: @campaignable_api_key)\n end",
"def get_user_campaigns username, password\n do_request 'get_user_campaigns', username: username, password: password\n end",
"def index\n @voice_campaigns = VoiceCampaign.all\n end",
"def list\n @marketing_campaigns = MarketingCampaign.paginate( :page => params[:page], :per_page => 10, :order => 'finished_at DESC') \n end",
"def index\n @search = Admins::Campaign.ransack(params[:q])\n @admins_campaigns = @search.result.includes(:election => :office).paginate(page: params[:page], per_page: 10)\n end",
"def campaign\n @model = 'campaign'\n @key = 'title'\n @values = Campaign.all.order(created_at: :desc)\n render 'campaigns'\n end",
"def campaign\n company.campaign\n end",
"def mine_coupons\n @campaigns = current_company.company.businesses_bought.paginate :per_page => 10, :page => params[:page] || 1, :order => [\"created_at DESC\"]\n end",
"def index\r\n\t\t@campaigns = Campaign.where(status: \"ready\").order(\"created_at DESC\")\r\n\t\t@campaignsInterval = 16\r\n\tend",
"def show\n @campaigns = Campaign.where(\"user_id = ?\", @user.id)\n @adgroups = Adgroup.where(\"campaign_id in (?)\", @campaigns.ids)\n @ads = Ad.where(\"adgroup_id in (?)\", @adgroups.ids)\n end",
"def index\n @campaign_results = CampaignResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @campaign_results }\n end\n end",
"def index\n @campaigns = @campaigns.includes(:photos, :approved_photos).order(\"end_date DESC\").page(params[:page])\n end",
"def index\n @campaigns = @current_user.advertiser.campaigns\n flash[:notice] = {type: :success, strong: 'Congratulations!', msg: \"Budget charged. Check if your Campaign <strong>#{params[:campaign]}</strong> was updated.\"} if params[:paid] == 'true'\n end",
"def get_sms_campaigns_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SMSCampaignsApi.get_sms_campaigns ...'\n end\n if @api_client.config.client_side_validation && opts[:'status'] && !['suspended', 'archive', 'sent', 'queued', 'draft', 'inProcess'].include?(opts[:'status'])\n fail ArgumentError, 'invalid value for \"status\", must be one of suspended, archive, sent, queued, draft, inProcess'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling SMSCampaignsApi.get_sms_campaigns, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling SMSCampaignsApi.get_sms_campaigns, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort'])\n fail ArgumentError, 'invalid value for \"sort\", must be one of asc, desc'\n end\n # resource path\n local_var_path = '/smsCampaigns'\n\n # query parameters\n query_params = {}\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?\n query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].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 = ['api-key', 'partner-key']\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 => 'GetSmsCampaigns')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SMSCampaignsApi#get_sms_campaigns\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @subscriptions = Subscription.where(:campaign_id => @campaign.id)\n @subscriptions = @subscriptions.joins(:member).order(:last_name)\n @subscriptions = @subscriptions.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @subscriptions }\n end\n end",
"def index\n @advertisement_campaigns = AdvertisementCampaign.all\n end",
"def country_api\n # endpoint = \"https://corona.lmao.ninja/countries\"\n endpoint = 'https://corona.lmao.ninja/v2/countries'\n response = HTTParty.get(endpoint)\n data = JSON.parse response.body\n res = data\n result =[]\n endpoint_all = \"https://corona.lmao.ninja/all\"\n response1 = HTTParty.get(endpoint_all)\n data1 = JSON.parse response1.body\n res1 = data1\n result<<{\n country: \"world\",\n cases: res1[\"cases\"],\n todayCases: res1[\"todayCases\"],\n deaths: res1[\"deaths\"],\n todayDeaths: res1[\"todayDeaths\"],\n recovered: res1[\"recovered\"],\n active: res1[\"active\"],\n critical: res1[\"critical\"],\n casesPerOneMillion: res1[\"casesPerOneMillion\"],\n deathsPerOneMillion: res1[\"deathsPerOneMillion\"],\n tests: res1[\"tests\"],\n testsPerOneMillion: res1[\"testsPerOneMillion\"],\n affectedCountries: res1[\"affectedCountries\"]\n }\n\n res.each do |country|\n result<<{\n country: country[\"country\"],\n lat: country[\"countryInfo\"][\"lat\"],\n long: country[\"countryInfo\"][\"long\"],\n flag: country[\"countryInfo\"][\"flag\"],\n cases: country[\"cases\"],\n todayCases: country[\"todayCases\"],\n deaths: country[\"deaths\"],\n todayDeaths: country[\"todayDeaths\"],\n recovered: country[\"recovered\"],\n active: country[\"active\"],\n critical: country[\"critical\"],\n casesPerOneMillion: country[\"casesPerOneMillion\"],\n deathsPerOneMillion: country[\"deathsPerOneMillion\"],\n tests: country[\"tests\"],\n testsPerOneMillion: country[\"testsPerOneMillion\"]\n }\n end\n render json: result\n end",
"def audience\n @campaign = Campaign.find(params[:id])\n end",
"def api\n # Instantiate an instance of Gibbon with the API key provided to this adapter.\n # We only work with the lists api here, so namespace into that.\n Gibbon::API.new(@campaignable_api_key).lists \n end",
"def index\n param! :order, String, in: %w(asc desc), transform: :downcase, default: 'desc'\n param! :sort, String, in: Player.sort_allowed_by_country?, default: Player.sort_default_by_country\n param! :search, String, default: nil\n param! :with_inactive, Integer, default: 0\n if request.format.json?\n if params[:with_inactive] == 1\n query = Player.all\n else\n query = Player.where(hideranking: 0)\n end\n query = query.by_country.uniorder(params[:sort], params[:order])\n if params[:search]\n query = query.country_search(params[:search])\n end\n @countries = query\n end\n end",
"def index\n @situations_arrivals_countries = SituationsArrivalsCountry.all\n ap @situations_arrivals_countries\n end",
"def get_acceptedcountries_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AcceptedCountriesApi.get_acceptedcountries ...'\n end\n # resource path\n local_var_path = '/acceptedcountries'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'start_index'] = opts[:'start_index'] if !opts[:'start_index'].nil?\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'whitelist'] = opts[:'whitelist'] if !opts[:'whitelist'].nil?\n query_params[:'search_type'] = opts[:'search_type'] if !opts[:'search_type'].nil?\n query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'AcceptedCountriesListResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"AcceptedCountriesApi.get_acceptedcountries\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AcceptedCountriesApi#get_acceptedcountries\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n render json: @campaign\n end",
"def all_countries \n\t\tself.class.get('/all')\n\tend",
"def index\n @camps = Camp.active.chronological.paginate(page: params[:page]).per_page(10)\n @upcomingCamps = Camp.active.upcoming.chronological.paginate(page: params[:page]).per_page(10)\n @pastCamps = Camp.active.past.chronological.paginate(page: params[:page]).per_page(10)\n @inactiveCamps = Camp.inactive.chronological.paginate(page: params[:page]).per_page(10)\n @user = current_user\n end",
"def active_channels\n channels = Channel.where(:active => true)\n json_response(channels)\n end",
"def index\n if @campaign\n @maps = @campaign.maps\n render json: @maps\n else\n render json: @maps.errors, status: :unprocessable_entity\n end\n end",
"def get_campaign_by_attributes_with_http_info(application_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_campaign_by_attributes ...'\n end\n # verify the required parameter 'application_id' is set\n if @api_client.config.client_side_validation && application_id.nil?\n fail ArgumentError, \"Missing the required parameter 'application_id' when calling ManagementApi.get_campaign_by_attributes\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling ManagementApi.get_campaign_by_attributes\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_campaign_by_attributes, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_campaign_by_attributes, must be greater than or equal to 1.'\n end\n\n allowable_values = [\"enabled\", \"disabled\", \"archived\", \"draft\", \"scheduled\", \"running\", \"expired\"]\n if @api_client.config.client_side_validation && opts[:'campaign_state'] && !allowable_values.include?(opts[:'campaign_state'])\n fail ArgumentError, \"invalid value for \\\"campaign_state\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/v1/applications/{applicationId}/campaigns_search'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'campaignState'] = opts[:'campaign_state'] if !opts[:'campaign_state'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # 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(body) \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse2004' \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementApi#get_campaign_by_attributes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @activity_award_cfgs = ActivityAwardCfg.all\n end",
"def index\n @campaign_banners = @campaign.campaign_banners\n end",
"def index\n @campaigns = Campaign.all\n new \n\n end",
"def campaign_params\n params.require(:campaign).permit(:shop_id, :status, :name, :country_id, :kind, :link_referral, :link_1, :link_2, :link_3, :link_4, :link_5, :points_per_referral, :product_tagging, :currency_per_referral, :campaign_products, :label_1, :label_2, :label_3)\n end",
"def index\n # Apply an active/inactive filter if requested\n # if ( params.include? :active_filter )\n # @phone_books = @phone_books.where( active: params[:active_filter] )\n # end\n\n respond_with @organization, @phone_books\n end",
"def get_all_ach_funding_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingSourcesApi.get_all_ach_funding_sources ...'\n end\n # resource path\n local_var_path = '/fundingsources/program/ach'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'start_index'] = opts[:'start_index'] if !opts[:'start_index'].nil?\n query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ACHListResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"FundingSourcesApi.get_all_ach_funding_sources\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FundingSourcesApi#get_all_ach_funding_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def countries_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CountriesApi#countries ...\"\n end\n \n # resource path\n local_var_path = \"/countries/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'languageCode'] = opts[:'language_code'] if opts[:'language_code']\n query_params[:'key'] = opts[:'key'] if opts[:'key']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CountryList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CountriesApi#countries\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def campaigns(client_id)\n response = Client_GetCampaigns(\"ClientID\" => client_id)\n return [] if response.empty?\n unless response[\"Code\"].to_i != 0\n response[\"Campaign\"].collect{|c| Campaign.new(c[\"CampaignID\"].to_i, c[\"Subject\"], c[\"SentDate\"], c[\"TotalRecipients\"].to_i)}\n else\n raise response[\"Code\"] + \" - \" + response[\"Message\"]\n end\n end",
"def index\n @q = Country.search(params[:q])\n @countries = @q.result.includes(:user_countries)\n\n respond_with(@countries, @q)\n end",
"def show\n @marketing_campaign = MarketingCampaign.find(params[:id])\n \n @contact_groups = @marketing_campaign.contact_groups\n \n @status = @marketing_campaign.status\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @marketing_campaign.to_json({:methods => :value}) }\n end\n end",
"def index\n @page = (params[:page] ? params[:page] : 1)\n @assessments = Assessment.filter_by_published(user_signed_in?).search(params).page(@page)\n authorize! :read, Assessment\n\n if params[:country_id].blank?\n @countries = Country.for_assessments @assessments\n else\n @countries = Country.find_all_by_id(params[:country_id])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assessments }\n end\n end",
"def show\nset_campaign\n \n\n\n end",
"def situations_arrivals_countries_three\n @situations_arrivals_countries = SituationsArrivalsCountry.where(status:true, id: [1,2,3]).order('name ASC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @situations_arrivals_countries}\n end\n end",
"def index\n @api_subscriptions = Api::Subscription.all\n end",
"def index\n if params[:country_id].nil?\n @services = Service.where(nil)\n if params[:topic] == 'Other' \n @services = Service.where.not(topic: [\"Home\", \"Transport\"]) if params[:topic].present?\n else\n @services = Service.topic(params[:topic]) if params[:topic].present?\n end\n else\n @services = Country.find(params[:country_id]).services\n if params[:topic] == 'Other' \n @services = Country.find(params[:country_id]).services.where.not(topic: [\"Home\", \"Transport\"]) if params[:topic].present?\n else\n @services = Country.find(params[:country_id]).services.topic(params[:topic]) if params[:topic].present?\n end\n end\n\n end",
"def get_campaign\n @campaign = Campaign.find(params[:campaign_id])\n end",
"def get_campaign_all_using_get(opts = {})\n data, _status_code, _headers = get_campaign_all_using_get_with_http_info(opts)\n data\n end",
"def list_active\n @games = Game.all.reject{|g| g.started_at.nil?}\n \n if @games.nil? \n respond_to do |format|\n format.all { render :status => :not_found, :text => \"No active games found.\" }\n end\n else\n respond_to do |format|\n format.html { render :action => \"index\", :html => @games }\n format.xml { render :action => \"index\", :xml => @games }\n format.json { render :index, :json => @games }\n end\n end\n end",
"def index\n\t @assets = @campaign.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @assets }\n end\n end",
"def campaign_params\n # 多対多関連のチェックボックスに対応\n # http://qiita.com/gotohiro55/items/0d76ac9412b04a431e32\n p = params.require(:campaign).permit(:campaign_source_id, :source_campaign_identifier, :network_id, :campaign_category_id, :name, :detail, :icon_url, :url, :requirement, :requirement_detail, :period, :price, :payment, :payment_is_including_tax, :point, :available, :medium_ids => [])\n p[:medium_ids] ||= []\n p\n end",
"def show\n @campaign = Campaign.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @campaign }\n end\n end",
"def get_campaigns(opts = {})\n data, _status_code, _headers = get_campaigns_with_http_info(opts)\n return data\n end",
"def all_event_push_campaigns\n get(url_(\"event-pushcampaign\"))\n end",
"def index\n @ag_countries = Ag::Country.all\n end",
"def show\n render json: @campaign, include: [\n '*', characters: [:class, :race, :player, status: [:alignment]]\n ]\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 campaign_ids\n (params[:campaign_ids] || []).map(&:to_i)\n end"
] |
[
"0.70781124",
"0.6772431",
"0.6720626",
"0.6612099",
"0.6534977",
"0.64728206",
"0.6457495",
"0.63592166",
"0.6358737",
"0.62297285",
"0.619548",
"0.6191473",
"0.61860263",
"0.6166906",
"0.6166906",
"0.6166906",
"0.61664605",
"0.6122602",
"0.6113763",
"0.61098367",
"0.60971534",
"0.60923576",
"0.6069706",
"0.6069656",
"0.6064144",
"0.6045887",
"0.5999395",
"0.5976695",
"0.5970224",
"0.59238356",
"0.5865067",
"0.58581066",
"0.58489025",
"0.584258",
"0.58254296",
"0.58213305",
"0.5763656",
"0.57534003",
"0.5744332",
"0.5693617",
"0.5665196",
"0.5660133",
"0.56511724",
"0.5646595",
"0.5620177",
"0.56128895",
"0.56037027",
"0.55598927",
"0.55585206",
"0.5531817",
"0.55051345",
"0.5502746",
"0.54831743",
"0.5465561",
"0.5438289",
"0.54378057",
"0.5432647",
"0.5431073",
"0.54300976",
"0.5427374",
"0.54099166",
"0.5399984",
"0.5385084",
"0.53839284",
"0.5373299",
"0.5363981",
"0.5359866",
"0.5351155",
"0.53425044",
"0.5337701",
"0.5324442",
"0.5322322",
"0.53124195",
"0.531033",
"0.53086543",
"0.5308192",
"0.5300701",
"0.52942646",
"0.52914006",
"0.5287226",
"0.52839243",
"0.52811444",
"0.52800226",
"0.52676415",
"0.5260549",
"0.5259089",
"0.5254136",
"0.5250792",
"0.52461034",
"0.52458006",
"0.5242228",
"0.5242177",
"0.52359766",
"0.52350456",
"0.5233858",
"0.5220869",
"0.52088714",
"0.5207482",
"0.5207474",
"0.52031225"
] |
0.8253609
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_campaign
@campaign = Campaign.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 campaign_params
params[:campaign].permit(:name, :budget, :start_date, :end_date, :in_pause, :link, :country_code, :creative, :advertiser_id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def 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
|
Updates the both Event and Idea/Transportation/Notes models. Idea model's title is copied from Event model.
|
def update
@event = Event.find(params[:id])
if @event.eventable_type == "Activity" or @event.eventable_type == "Hotel" or @event.eventable_type == "Foodanddrink"
@idea = Idea.find(@event.eventable_id)
respond_to do |format|
if @event.update_attributes(params[:event]) and @idea.update_attributes(params[:idea])
format.html { redirect_to show_new_visitor_trip_path(:id => @trip, :view => params[:view]) } if new_visitor_created_trip?
format.html { redirect_to trip_path(:id => @trip, :view => params[:view]) }
format.js
else
flash[:error] = "There seems to be an error updating the note."
format.html { redirect_to trip_path(:id => @trip, :view => params[:view]) }
end
end
elsif @event.eventable_type == "Transportation"
@transportation = Transportation.find(@event.eventable_id)
@event.title = CGI::escapeHTML(params[:transportation][:from]) + " → " + CGI::escapeHTML(params[:transportation][:to])
respond_to do |format|
if @transportation.update_attributes(params[:transportation]) and @event.update_attributes(params[:event])
format.html { redirect_to show_new_visitor_trip_path(:id => @trip, :view => params[:view]) } if new_visitor_created_trip?
format.html { redirect_to trip_path(:id => @trip, :view => params[:view]) }
format.js
else
flash[:error] = "There seems to be an error updating the transportation."
format.html { redirect_to trip_path(:id => @trip, :view => params[:view]) }
end
end
elsif @event.eventable_type == "Notes"
@notes = Notes.find(@event.eventable_id)
tmp_notes = Notes.new(params[:notes])
@event = tmp_notes.create_notes(@event, @trip)
respond_to do |format|
if @event.update_attributes(params[:event]) and @notes.update_attributes(params[:notes])
format.html { redirect_to show_new_visitor_trip_path(:id => @trip, :view => params[:view]) } if new_visitor_created_trip?
format.html { redirect_to trip_path(:id => @trip, :view => params[:view]) }
format.js
else
flash[:error] = "There seems to be an error updating your note."
format.html { redirect_to trip_path(:id => @trip, :view => params[:view]) }
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @idea_event = IdeaEvent.find(params[:id])\n\n respond_to do |format|\n if @idea_event.update_attributes(params[:idea_event])\n format.html { redirect_to @idea_event, notice: 'Idea event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @idea_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @idea = Idea.find(params[:idea][:id])\n if @idea.update_attributes(params[:idea])\n redirect_to :action=>:index\n else\n flash[:error]=\"修改后标题或内容不能为空\"\n redirect_to :action => \"edit\", :id => @idea.id\n end\n end",
"def update!(**args)\n @issue_model = args[:issue_model] if args.key?(:issue_model)\n @parent = args[:parent] if args.key?(:parent)\n end",
"def update!(**args)\n @issue_model = args[:issue_model] if args.key?(:issue_model)\n @parent = args[:parent] if args.key?(:parent)\n end",
"def update\n # remove protected columns (including a \"link\" to content blob - actual data cannot be updated!)\n if params[:model]\n [:contributor_id, :contributor_type, :original_filename, :content_type, :content_blob_id, :created_at, :updated_at, :last_used_at].each do |column_name|\n params[:model].delete(column_name)\n end\n \n # update 'last_used_at' timestamp on the Model\n params[:model][:last_used_at] = Time.now\n end\n\n update_annotations @model\n publication_params = params[:related_publication_ids].nil?? [] : params[:related_publication_ids].collect { |i| [\"Publication\", i.split(\",\").first]}\n\n @model.attributes = params[:model]\n\n if params[:sharing]\n @model.policy_or_default\n @model.policy.set_attributes_with_sharing params[:sharing], @model.projects\n end\n\n experiment_ids = params[:experiment_ids] || []\n respond_to do |format|\n if @model.save\n\n # update attributions\n Relationship.create_or_update_attributions(@model, params[:attributions])\n \n # update related publications\n Relationship.create_or_update_attributions(@model,publication_params, Relationship::RELATED_TO_PUBLICATION)\n \n #update creators\n AssetsCreator.add_or_update_creator_list(@model, params[:creators])\n \n flash[:notice] = 'Model metadata was successfully updated.'\n format.html { redirect_to model_path(@model) }\n # Update new experiment_asset\n Experiment.find(experiment_ids).each do |experiment|\n if experiment.can_edit?\n experiment.relate(@model)\n end\n end\n #Destroy ExperimentAssets that aren't needed\n experiment_assets = @model.experiment_assets\n experiment_assets.each do |experiment_asset|\n if experiment_asset.experiment.can_edit? and !experiment_ids.include?(experiment_asset.experiment_id.to_s)\n ExperimentAsset.destroy(experiment_asset.id)\n end\n end\n deliver_request_publish_approval params[:sharing], @model\n else\n format.html {\n render :action => \"edit\"\n }\n end\n end\n end",
"def update\n @idea = Idea.find(params[:id])\n\n respond_to do |format|\n if @idea.update_attributes(params[:idea])\n format.html { redirect_to @idea, :notice => 'Idea was successfully updated.' }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def update\n @aboutEvent = AboutEvent.where(:note_id => params[:id]).first\n @aboutPerson = AboutPerson.where(:note_id => params[:id]).first\n\n if (Integer(params[:event][:id]) rescue nil)\n if @aboutEvent\n if @aboutEvent.event_id == params[:event][:id]\n #No changes.\n else\n @aboutEvent.destroy\n @aboutEvent = AboutEvent.new\n @aboutEvent.event_id=params[:event][:id]\n @aboutEvent.note_id=params[:id]\n @aboutEvent.save\n end\n else\n @aboutEvent = AboutEvent.new\n @aboutEvent.event_id=params[:event][:id]\n @aboutEvent.note_id=params[:id]\n @aboutEvent.save\n end\n else\n if @aboutEvent\n @aboutEvent.destroy\n end\n end\n\n\n if (Integer(params[:person][:id]) rescue nil)\n if @aboutPerson\n if @aboutPerson.person_id == params[:person][:id]\n #No changes.\n else\n @aboutPerson.destroy\n @aboutPerson = AboutPerson.new\n @aboutPerson.person_id=params[:person][:id]\n @aboutPerson.note_id=params[:id]\n @aboutPerson.save\n end\n else\n @aboutPerson = AboutPerson.new\n @aboutPerson.person_id=params[:person][:id]\n @aboutPerson.note_id=params[:id]\n @aboutPerson.save\n end\n else\n if @aboutPerson\n @aboutPerson.destroy\n end\n end\n\n\n respond_to do |format|\n if @note.update_attributes(params[:note])\n @notes = current_registry.person.notes.includes(:about_person => :person)\n @notes = @notes.includes(:about_event => :event)\n format.html { render action: \"index\", notice: 'Note was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @idea = Idea.find(params[:id])\n\n\t\t\n\t\trespond_to do |format|\n if @idea.update_attributes(params[:idea])\n flash[:notice] = 'Idea was successfully updated.'\n format.html { redirect_to(@idea) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @idea.errors, :status => :unprocessable_entity }\n end\n end\n\n end",
"def update\n @idea = Idea.find(params[:id])\n @idea.updated_by = current_admin.email\n respond_to do |format|\n if @idea.update_attributes(params[:idea])\n format.html { redirect_to(admin_ideas_url, :notice => 'Idea was successfully updated.') }\n format.xml { head :ok }\n else\n @tags = @idea.get_related_paginated \"tags\", :sort => [[:tag_type, :asc], [:name, :asc]]\n @products = @idea.get_related_paginated \"products\", :sort => [[:item_num, :asc]]\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @idea.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def updateTitle(id, title)\n item = Todo.find(id)\n item.title = title\n item.save\nend",
"def update\n @idea = Idea.find(params[:id])\n\n respond_to do |format|\n if @idea.update_attributes(params[:idea])\n format.html { redirect_to(@idea, :notice => 'Idea was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @idea.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @idea = Idea.find(params[:id])\n\n respond_to do |format|\n if @idea.update_attributes(params[:idea])\n format.html { redirect_to(@idea, :notice => 'Idea was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @idea.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @idea = Idea.find(params[:id])\n\n respond_to do |format|\n if @idea.update_attributes(params[:idea])\n format.html { redirect_to(@idea, :notice => 'Idea was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @idea.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @idea = Idea.find(params[:id])\n\n respond_to do |format|\n if @idea.update_attributes(params[:idea])\n format.html { redirect_to(@idea, :notice => 'Idea was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @idea.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @title_obtaineds = TitleObtained.all\n respond_to do |format|\n if @type_of_meeting.update(type_of_meeting_params.merge(pre_attendance_meetings_attributes: pre_attendance_meeting_params))\n format.html {redirect_to @type_of_meeting, notice: 'Type of meeting was successfully updated.'}\n format.json {render :show, status: :ok, location: @type_of_meeting}\n else\n format.html {render :edit}\n format.json {render json: @type_of_meeting.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n respond_to do |format|\n if @idea.update(idea_params)\n @idea.create_activity :update, owner: (current_user)\n format.html { redirect_to @idea, notice: 'Idea was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @issue_models = args[:issue_models] if args.key?(:issue_models)\n end",
"def update\n @idea = Idea.find(params[:id])\n\n respond_to do |format|\n if @idea.update_attributes(params[:idea])\n format.html { redirect_to @idea, notice: 'Idea was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @idea = Idea.find(params[:id])\n\n respond_to do |format|\n if @idea.update_attributes(params[:idea])\n format.html { redirect_to @idea, notice: 'Idea was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_practice_schedule\n if self.event_type == \"Practice Schedule\"\n update_practice_schedule = PracticeSchedule.find_by(id: self.practice_tag)\n if update_practice_schedule.title != self.title || update_practice_schedule.start_time != self.start_time \n update_practice_schedule.update :title => self.title, :start_time => self.start_time\n end \n end\n end",
"def update!(**args)\n @abstract_display = args[:abstract_display] if args.key?(:abstract_display)\n @abstract_html = args[:abstract_html] if args.key?(:abstract_html)\n @abstract_html_left_over = args[:abstract_html_left_over] if args.key?(:abstract_html_left_over)\n @abstract_language = args[:abstract_language] if args.key?(:abstract_language)\n @abstract_text = args[:abstract_text] if args.key?(:abstract_text)\n @abstract_type_from_source = args[:abstract_type_from_source] if args.key?(:abstract_type_from_source)\n end",
"def update\n @alternate_title = AlternateTitle.find(params[:id])\n\n respond_to do |format|\n if @alternate_title.update_attributes(params[:alternate_title])\n flash[:success] = 'AlternateTitle was successfully updated.'\n format.html { redirect_to(add_details_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @alternate_title.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @issue_model = args[:issue_model] if args.key?(:issue_model)\n @issues = args[:issues] if args.key?(:issues)\n end",
"def update!(**args)\n @issue_model = args[:issue_model] if args.key?(:issue_model)\n @issues = args[:issues] if args.key?(:issues)\n end",
"def update\n @idea = Idea.find(params[:id])\n raise_error_on_intrusion\n\n respond_to do |format|\n if @idea.update_attributes(params[:idea])\n format.html { redirect_to @idea, notice: 'Idea was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def event_and_specs_edit\n #Updates to Event Section\n @event = Event.where(id: params[\"event_id\"]).first\n @event.name = params[\"event_name\"]\n @event.date_of_event = params[\"event_date\"]\n @event.time = params[\"event_time\"]\n @event.delivery_setup_time = params[\"setup_time\"]\n @event.feel_of_day = params[\"feel_of_day\"]\n @event.color_palette = params[\"color_palette\"]\n @event.flower_types = params[\"flower_types\"]\n @event.attire = params[\"attire\"]\n @event.photographer = params[\"photographer\"]\n @event.coordinator = params[\"coordinator\"]\n @event.locations = params[\"locations\"]\n @event.employee_id = Employee.where(name: params[\"lead_designer\"]).where(florist_id: session[\"found_florist_id\"]).first.id \n @event.notes = params[\"notes\"]\n @event.other_notes = params[\"other_notes\"]\n @event.budget = params[\"budget\"]\n @event.quote_message = params[\"quote_message\"]\n @event.customer_id = params[\"customer_id\"]\n @event.show_display_name = params[\"display_name\"]\n @event.show_product_image = params[\"show_product_image\"] \n if @event.save == false\n @employee_list = Employee.where(florist_id: session[\"found_florist_id\"]).where(status: \"Active\").uniq.pluck(:name)\n @specifications = @event.specifications.where(\"item_name not like 'X1Z2-PlaCeHoldEr'\").order(\"id\")\n render(:event_edit) and return\n else # do nothing\n end\n #Updates to Event Specifications Section\n for each in Specification.where(event_id: params[\"event_id\"]).where(\"item_name not like 'X1Z2-PlaCeHoldEr'\") \n each.item_name = params[\"spec_item-#{each.id}\"]\n each.item_quantity = params[\"spec_qty-#{each.id}\"].to_i * 100.0\n each.item_specs = params[\"spec_notes-#{each.id}\"]\n each.exclude_from_quote = params[\"exclude-#{each.id}\"]\n each.updated_by = Employee.where(florist_id: session[\"found_florist_id\"]).where(id: session[\"found_user_id\"]).first.username\n each.save \n end\n if params[\"vs\"]\n redirect_to \"/virtual_studio/#{params[\"vs\"]}\" and return\n \n elsif params[\"delete\"]\n spec_id = params[\"delete\"]\n spec = Specification.where(id: spec_id).first\n spec.destroy\n designed_products = DesignedProduct.where(specification_id: spec_id)\n for each in designed_products\n each.destroy\n end \n for image in spec.images\n image.destroy\n end \n elsif params[\"add\"]\n # Create a \"spec\" placeholder for the list of products if one hasn't already been created.\n if Specification.where(event_id: params[\"event_id\"]).where(item_name: \"X1Z2-PlaCeHoldEr\").first == nil\n new_spec = Specification.new\n new_spec.event_id = params[\"event_id\"]\n new_spec.item_quantity = 100000\n new_spec.item_name = \"X1Z2-PlaCeHoldEr\"\n new_spec.florist_id = session[\"found_florist_id\"]\n new_spec.exclude_from_quote = 1 \n new_spec.save!\n end\n new_spec = Specification.new\n new_spec.event_id = params[\"ev_id\"]\n new_spec.item_quantity = 1 * 100.0\n new_spec.item_name = \"\"\n new_spec.updated_by = Employee.where(florist_id: session[\"found_florist_id\"]).where(id: session[\"found_user_id\"]).first.username\n new_spec.florist_id = session[\"found_florist_id\"] \n new_spec.save!\n elsif params[\"add_image\"]\n redirect_to \"/images/#{params[\"add_image\"]}\" and return\n else #do nothing\n end\n redirect_to \"/event_edit/#{params[\"event_id\"]}\" and return\n end",
"def update!(**args)\n @model = args[:model] if args.key?(:model)\n @model_display_name = args[:model_display_name] if args.key?(:model_display_name)\n end",
"def update!(**args)\n @model = args[:model] if args.key?(:model)\n @model_display_name = args[:model_display_name] if args.key?(:model_display_name)\n end",
"def update\n update_annotations(params[:tag_list], @model)\n update_sharing_policies @model\n update_relationships(@model, params)\n respond_to do |format|\n if @model.update(model_params)\n flash[:notice] = \"#{t('model')} metadata was successfully updated.\"\n format.html { redirect_to model_path(@model) }\n format.json {render json: @model, include: [params[:include]]}\n else\n format.html { render action: 'edit' }\n format.json { render json: json_api_errors(@model), status: :unprocessable_entity }\n end\n end\n end",
"def update\n @idea = Idea.find(params[:id])\n # get user to add comment, for now use dummy user\n user = User.first\n comment_body = params[:comment_body]\n unless comment_body.nil? or comment_body.empty?\n comment = Comment.build_from(@idea, user.id, comment_body)\n comment.save\n end\n old_keywords = @idea.keywords\n \n \n if(params.has_key?(:idea))\n keyword_ids = params[:idea][:keyword_ids]\n keywords =\n Keyword.select do |k|\n keyword_ids.include? k.id.to_s\n end\n keywords.each do |kw|\n unless old_keywords.include? kw\n @idea.keywords << kw\n end\n end\n old_keywords.each do |old|\n IdeaKeyword.find_by_keyword_id_and_idea_id(old.id, @idea.id).destroy unless keywords.include? old\n end\n respond_to do |format|\n if @idea.update(idea_params)\n format.html { redirect_to @idea, notice: 'Idea was successfully updated.' }\n format.json { head :no_content }\n else\n @keywords = Keyword.all\n \t\t\t@all = Keyword.all\n # Any other options to set comments? It shows now idea's comments after trying to update unvalid idea.\n \t\t\tset_comments\n format.html { render action: 'edit' }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to @idea\n end\n end",
"def update\n\n @title = Title.find(activity_params[:title_id])\n @event = Event.find(@title[:event_id])\n @activity = Activity.new(activity_params)\n @title.activities << @activity\n \n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to \"/events/#{@event.id}\", notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(model_data)\n end",
"def update!(**args)\n @model = args[:model] if args.key?(:model)\n end",
"def update\n respond_to do |format|\n if @idea.update(idea_params)\n format.html { redirect_to @idea, notice: 'Idea was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @main_event = MainEvent.find(params[:id])\n\n respond_to do |format|\n if @main_event.update_attributes(params[:main_event])\n format.html { redirect_to @main_event, notice: 'Main event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @main_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @idea.update(idea_params)\n format.html { redirect_to @idea, notice: 'Idea was successfully updated.' }\n format.json { render :show, status: :ok, location: @idea }\n else\n format.html { render :edit }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @idea.update(idea_params)\n format.html { redirect_to @idea, notice: 'Idea was successfully updated.' }\n format.json { render :show, status: :ok, location: @idea }\n else\n format.html { render :edit }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @idea.update(idea_params)\n format.html { redirect_to @idea, notice: 'Idea was successfully updated.' }\n format.json { render :show, status: :ok, location: @idea }\n else\n format.html { render :edit }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @idea.update(idea_params)\n format.html { redirect_to @idea, notice: 'Idea was successfully updated.' }\n format.json { render :show, status: :ok, location: @idea }\n else\n format.html { render :edit }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @idea.update(idea_params)\n format.html { redirect_to @idea, notice: 'Idea was successfully updated.' }\n format.json { render :show, status: :ok, location: @idea }\n else\n format.html { render :edit }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n if params[:issue][:title] == ''\n flash[:notice] = 'Please make sure you entered a title.'\n redirect_to request.referrer\n else\n \n @issue_titles = Issue.where('title = ?', params[:issue][:title_from])\n @issues_by_parent = @issue_titles.where('i_parent = ?', current_user.u_parent).pluck(:id)\n\n @issues_by_parent.each do |x|\n Issue.find(x).update_attributes(:title => params[:issue][:title])\n end\n\n flash[:notice] = 'Issue has been successfully updated.'\n redirect_to request.referrer\n \n end\n \n end",
"def update\n @event.title = event_params['title']\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @remodeling = args[:remodeling] if args.key?(:remodeling)\n end",
"def update\n respond_to do |format|\n if @idea.update(idea_params)\n format.html { redirect_to @idea, notice: \"Idea was successfully updated.\" }\n format.json { render :show, status: :ok, location: @idea }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find_by_id(params[:id])\n\n @event.title = params[:event][:title]\n @event.location = params[:event][:location]\n @event.calendar_id = params[:event][:calendar_id]\n @event.all_day = params[:event][:all_day]\n @event.notes = params[:event][:notes]\n parse_params\n\n if @event.save\n redirect_to request.referer\n else\n flash[:error] = \"Event update failed!\"\n redirect_to request.referer\n end\n end",
"def update\n @faq = Faq.find(params[:id])\n\n @faq.assign_attributes(params[:faq])\n\n add_missing_translation_content(@faq.faq_translations)\n\n respond_to do |format|\n if @faq.save\n format.html { redirect_to admin_faq_path(@faq), notice: t('app.msgs.success_updated', :obj => t('activerecord.models.faq')) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def do_update\n do_edit\n update_save\n end",
"def update\n respond_to do |format|\n if @idea.update(idea_params)\n format.html { redirect_to @idea } #, notice: 'Idea was successfully updated.'\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @idea = Idea.find(params[:id])\n respond_with(@idea) do |format|\n if @idea.update_attributes(params[:idea])\n format.json { render json: @idea, status: :created, location: @idea }\n else\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @idea = Idea.find(params[:id])\n if @idea.user = current_user\n respond_to do |format|\n if @idea.update_attributes(params[:idea])\n format.html { redirect_to @idea, notice: 'Idea was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n @question.update\n @cancel.update\n end",
"def update\n @event = Event.find(params[:id])\n if current_user.is_admin? or current_user.editor?(@event) \n process_params_for_tags 'event', 'cause' \n process_params_for_tags 'event', 'skill' \n\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to(@event) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n else\n flash[:error] = 'You are not an editor for this event.'\n redirect_to @event\n end\n end",
"def update\n if event.save\n update_songs\n redirect_to event, notice: 'Event was successfully updated.'\n else\n render :edit\n end\n end",
"def update \n params[:subject][:title].strip! if !params[:subject][:title].nil?\n params[:subject][:content].strip! if !params[:subject][:content].nil?\n @subject.title = params[:subject][:title]\n @subject.content = params[:subject][:content]\n @subject.for_correctors = params[:subject][:for_correctors] if !params[:subject][:for_correctors].nil?\n @subject.important = params[:subject][:important] if !params[:subject][:important].nil?\n @subject.for_wepion = params[:subject][:for_wepion] if !params[:subject][:for_wepion].nil?\n \n @subject.for_wepion = false if @subject.for_correctors # We don't allow Wépion if for correctors\n \n if @subject.valid?\n\n @subject.title = @subject.title.slice(0,1).capitalize + @subject.title.slice(1..-1)\n\n # Set associated object (category, section, chapter, exercise, problem)\n err = set_associated_object\n error_update([err]) and return if !err.empty?\n\n # Attached files\n @error_message = \"\"\n update_files(@subject)\n error_update([@error_message]) and return if !@error_message.empty?\n \n @subject.save\n flash[:success] = \"Votre sujet a bien été modifié.\"\n session[\"successSubject\"] = \"ok\"\n redirect_to subject_path(@subject, :q => @q)\n else\n error_update(@subject.errors.full_messages) and return\n end\n end",
"def update!(**args)\n @new_title = args[:new_title] if args.key?(:new_title)\n @old_title = args[:old_title] if args.key?(:old_title)\n end",
"def update!(**args)\n @articles = args[:articles] if args.key?(:articles)\n @create_time = args[:create_time] if args.key?(:create_time)\n @faq_answers = args[:faq_answers] if args.key?(:faq_answers)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @attribution_model = args[:attribution_model] if args.key?(:attribution_model)\n @data_driven_model_status = args[:data_driven_model_status] if args.key?(:data_driven_model_status)\n end",
"def update\n @event = Event.find(params[:id])\n\t@event.attributes = params[:event]\n\t@branch = Branch.find(params[:branch_id])\t #This is needed in case the edit action has to rendered again\n\t\n\t\tt_ids = params[:teachers].split(\",\") || []\n\t\tsec_ids = params[:section_ids] || []\n\t\tteachers = []\n\t\tsections = []\n\t\tbranches = []\n\t\tif t_ids.include?(\"0\")\n\t\t\tteachers = Branch.find(params[:branch_id]).teachers\n\t\telse\n\t\t\tt_ids.each do |tid|\n\t\t\t\tteachers << Teacher.find(tid)\n\t\t\tend\n\t\tend\n\t\tsec_ids.each do |sid|\n\t\t\tsections << Section.find(sid)\n\t\tend\n\t\tif params[:branch_event]\n\t\t\tbranches << Branch.find(params[:branch_id])\n\t\tend\n\t\t@event.teachers = teachers\n\t\t@event.sections = sections\n\t\t@event.branches = branches\n\t\t\n\t\tif @event.valid? && @event.schedules.all?(&:valid?)\n\t\t\t@event.save!\n\t\t\t@event.schedules.each(&:save!)\t\n\t\t\tredirect_to(@event, :notice => 'Event was successfully updated.')\n\t\telse\n\t\t\tflash[:notice] = 'Cannot create Event'\t\n\t\t\trender :action => 'edit'\n\t\tend\t\n end",
"def update\n @event= Event.find(params[:id])\n\n @stage = Stage.find(params[:stage_id], :include => :festival)\n\n respond_to do |format|\n if @event.update_attributes(params[:event].merge(:artist_name =>@event.band.name))\n format.html { redirect_to( stage_path(@event.stage), :notice => 'Event was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n raise \"YO\".inspect\n @event = Event.find(params[:id])\n @event.organisation = Organisation.find(params[:organisation_id])\n \n respond_to do |format|\n if @event.update_attributes!(params[:event])\n format.html { redirect_to(event_path(@event), :notice => 'Event was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n @intake.title = @intake.course.title + \": \" + @intake.start_date.strftime(\"%b, %Y\")\n respond_to do |format|\n if @intake.update_attributes(params[:intake])\n format.html { redirect_to @intake, notice: 'Intake was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @intake.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @title.update(title_params)\n format.html { redirect_to \"/events/#{@event.id}\", notice: 'Title was successfully updated.' }\n format.json { render :show, status: :ok, location: @title }\n else\n format.html { render :edit }\n format.json { render json: @title.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n @event.survey_question = params[:survey_question]\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to(admin_event_path(@event)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_change\n return unless page_number\n return unless story_number\n\n current_article_id = working_article_id\n page = Page.where(issue_id: issue_id, page_number: page_number).first\n unless page\n puts \"we don't have page!!!\"\n return\n end\n new_article = WorkingArticle.where(page_id: page.id, order: story_number).first\n unless new_article\n puts \"we don't the article with story number!!!\"\n return\n end\n puts \"new_article.id:#{new_article.id}\"\n if new_article && new_article.id != current_article_id\n puts 'change to different article'\n self.working_article_id = new_article.id\n self.used_in_layout = false\n save\n place_image\n # clear image from current_article, if it exits\n end\n # if working_article\n # working_article.generate_pdf\n # working_article.update_page_pdf\n # end\n end",
"def update\n\t@desktop_override = true\n\t@event.title = nilify(params[:event][:title])\n\t@event.description = nilify(params[:event][:description])\n\t@event.start_time = nilify(params[:event][:start_time]).nil? ? nil : Time.parse(nilify(params[:event][:start_time])).getutc.iso8601\n\t@event.end_time = nilify(params[:event][:end_time]).nil? ? nil : Time.parse(nilify(params[:event][:end_time])).getutc.iso8601\n\t@event.recurrence = nilify(params[:event][:recurrence])\n\t@event.event_type = nilify(params[:event][:event_type])\n\t@event.updated_by = \"RestNapForm\"\n\n\tif @event.valid?\n\t @event.save\n\t #redirect_to country_region_locality_event_path(@country, @region, @locality, @event)\n\t redirect_to country_region_locality_events_path(@country, @region, @locality)\n\telse\n\t @errors = true\n\t respond_to do |format|\n\t\tformat.html do\n\t\t render :layout => \"restlessnapkin\", :action => :edit\n\t\tend\n\t end\n\tend\n end",
"def update!\n @model.columns.each do |column|\n if row = @attrs.find {|x| x[:name] == column.name}\n if row[:type] != type_str(column)\n puts \" M #{@model}##{column.name} [#{row[:type]} -> #{type_str(column)}]\"\n row[:type] = type_str(column)\n elsif row[:desc] == InitialDescription::DEFAULT_DESCRIPTION\n new_desc = InitialDescription.for(@model, column.name)\n if row[:desc] != new_desc\n puts \" M #{@model}##{column.name} description updated\"\n row[:desc] = new_desc\n end\n end\n else\n puts \" A #{@model}##{column.name} [#{type_str(column)}]\"\n @attrs << {\n :name => column.name,\n :type => type_str(column),\n :desc => InitialDescription.for(@model, column.name)\n }\n end\n end\n\n # find columns that no more exist in db\n orphans = @attrs.map{|x| x[:name]} - @model.columns.map(&:name)\n unless orphans.empty?\n orphans.each do |orphan|\n puts \" D #{@model}##{orphan}\"\n @attrs = @attrs.select {|x| x[:name] != orphan}\n end\n end\n\n @attrs\n end",
"def update!(**args)\n @model_type = args[:model_type] if args.key?(:model_type)\n end",
"def update!(**args)\n @model_type = args[:model_type] if args.key?(:model_type)\n end",
"def update!(**args)\n @model_type = args[:model_type] if args.key?(:model_type)\n end",
"def update\n @admin_article = Admin::Article.find(params[:id])\n @admin_article.format_title = @admin_article.title.gsub(/ /,\"_\").downcase\n\n respond_to do |format|\n if @admin_article.update_attributes(params[:admin_article])\n format.html { redirect_to @admin_article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @event.update(event_params)\n redirect_to @event, notice: 'lesson was successfully updated.'\n else\n render action: 'edit'\n end\n end",
"def create\n @doi = Doi.new(doi_params)#create a new doi\n @doi.user_id = current_user.id\n @update = @doi.updates.build(update_params) #create a new update associated to @doi \n @update.description = @doi.description #set the new update's description\n if @doi.save\n redirect_to :action => 'index'\n else\n render :action => 'new'\n end\n end",
"def update\n \t@conference = Conference.find(params[:conference_id])\n @abstract = Abstract.find(params[:id])\n\n respond_to do |format|\n if @abstract.update_attributes(params[:abstract])\n format.html { redirect_to(conference_abstract_url, :notice => 'Abstract was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @abstract.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def controller_issues_edit_before_save(context={ })\n\n issue = context[:issue]\n time_entry = context[:time_entry]\n\n if issue && time_entry\n # insere os dados no atributo auxiliar\n issue.ayty_before_time_entry = time_entry\n end\n\n end",
"def update\n @article = Article.find(params[:id])\n @article.update(title: params[:article][:title], description: params[:article][:description])\n redirect_to article_path(@article)\n end",
"def update\n @event = Event.find(params[:id])\n if @event.searchable==nil\n @event.searchable = \" \"\n end\n if @event.analyst_id != nil\n @event.searchable = @event.searchable + \" \" + @event.analyst.analyst\n end\n # @event.searchable = @event.searchable+ \" \" + @event.idstring\n if @event.description != nil\n @event.searchable = @event.searchable+\" \"+@event.description\n end\n if @event.address!=nil\n @event.searchable=@event.searchable+\" \"+@event.address\n end\n if @event.locality_id!=nil\n @event.searchable=@event.searchable+\" \"+@event.locality.locality\n end\n if @event.area_id!=nil\n @event.searchable=@event.searchable+\" \"+@event.area.description\n end\n if @event.crime_id!=nil\n @event.searchable=@event.searchable+\" \"+@event.crime.crime\n end\n\n if @event.observations!=nil\n @event.searchable=@event.searchable+\" \"+@event.observations\n end\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Evento actualizado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n puts \"*******ON UPDATE ************\"\n @event = Event.find(params[:id])\n\n #check if user is trying to change the name\n puts \"#{@event.name} == @event.name #{params[:event][:name]} = params[:name]\"\n if (@event.name != params[:event][:name])\n new_event = @event.dup\n new_event.name = params[:event][:name]\n if new_event.save!\n redirect_to(new_event, :notice => \"Event updated succesfully\") \n @event.destroy\n else\n render :action => \"edit\"\n end\n \n else\n if @event.update_attributes!(params[:event])\n redirect_to(@event, :notice => \"Event updated succesfully\")\n else\n render :action => \"edit\"\n end\n end\n end",
"def update\n @idea.update(idea_params)\n redirect_to action: :show, id: params[:id]\n end",
"def update\n o = Designation.find(params[:id])\n \n if o.update_attributes(:title => params[:title], :desc => params[:desc], \n :note => params[:note])\n render :json => { :success => 1, \n :message => 'Job Title was successfully updated.' }\n \n else\n render :json => DesignationHelper.get_errors(o.errors)\n end\n end",
"def update!(**args)\n @annotation = args[:annotation] if args.key?(:annotation)\n @dynamite_placeholder_metadata = args[:dynamite_placeholder_metadata] if args.key?(:dynamite_placeholder_metadata)\n @event_otr_status = args[:event_otr_status] if args.key?(:event_otr_status)\n @group_link_sharing_modification_event = args[:group_link_sharing_modification_event] if args.key?(:group_link_sharing_modification_event)\n @hangout_event = args[:hangout_event] if args.key?(:hangout_event)\n @invite_accepted_event = args[:invite_accepted_event] if args.key?(:invite_accepted_event)\n @membership_change_event = args[:membership_change_event] if args.key?(:membership_change_event)\n @otr_chat_message_event = args[:otr_chat_message_event] if args.key?(:otr_chat_message_event)\n @otr_modification_event = args[:otr_modification_event] if args.key?(:otr_modification_event)\n @rename_event = args[:rename_event] if args.key?(:rename_event)\n end",
"def update\n respond_to do |format|\n if @action_idea.update(action_idea_params)\n format.html { redirect_to @action_idea, notice: 'Action idea was successfully updated.' }\n format.json { render :show, status: :ok, location: @action_idea }\n else\n format.html { render :edit }\n format.json { render json: @action_idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def prepare_for_updating\n @thread = @entity.a_thread\n @thread.articles.build @entity.responder.attributes\n preparation_for_altering\n end",
"def update_task(id, title, description)\n task = Task.find(id)\n task.title = title\n task.description = description\n task.save\nend",
"def update\n @event_event = Event::Event.find(params[:id])\n\n respond_to do |format|\n if @event_event.update_attributes(params[:event_event])\n format.html { redirect_to @event_event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_attributes\n find_postlike.update_attributes(\n name: request_body[\"title\"],\n description: request_body[\"body\"],\n date: request_body[\"date\"],\n start_time: request_body[\"starts_at\"],\n end_time: request_body[\"ends_at\"],\n venue: request_body[\"venue\"],\n address: request_body[\"address\"],\n tag_list: request_body[\"tags\"])\n end",
"def update\n respond_to do |format|\n if @sabstract.update(sabstract_params)\n format.html { redirect_to @sabstract, notice: 'Sabstract was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sabstract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @title = t 'view.teaches.edit_title'\n\n respond_to do |format|\n if @teach.update(teach_params)\n format.html { redirect_to @teach, notice: t('view.teaches.correctly_updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @teach.errors, status: :unprocessable_entity }\n end\n end\n\n rescue ActiveRecord::StaleObjectError\n flash.alert = t 'view.teaches.stale_object_error'\n redirect_to edit_teach_url(@teach)\n end",
"def update\n respond_to do |format|\n if todo_params[:assign_user_id].present? and not todo_params[:assign_user_id].empty?\n @todo.assign_by_user = current_user\n end\n\n old_title = @todo.title\n old_user = @todo.assign_user\n old_deadline = @todo.deadline\n if todo_params[:assign_user_id].present? and todo_params[:assign_user_id].empty?\n @todo.assign_user_id = nil\n @todo.assign_user = nil\n end\n if @todo.update(todo_params)\n # 修改任务\n TodoEvent.create_todo_update(current_user, old_title, @todo) if @todo.title != old_title\n # 指派任务\n TodoEvent.create_todo_assign_to_user(current_user, @todo.assign_user, @todo) if !old_user.present? and @todo.assign_user.present?\n # 修改任务完成者\n TodoEvent.create_todo_update_assigned_user(current_user, old_user, @todo.assign_user, @todo) if old_user.present? and old_user != @todo.assign_user\n # 修改任务完成时间\n TodoEvent.create_todo_update_deadline(current_user, old_deadline, @todo) if old_deadline != @todo.deadline\n\n format.html { redirect_to @todo.project, notice: 'Todo was successfully updated.' }\n format.json { render :show, status: :ok, location: @todo }\n else\n format.html { render :edit }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @idea = Idea.find(params[:id])\n stock = Stock.find(params[:stock_id])\n @idea.stock = stock\n \n respond_to do |format|\n if @idea.update_attributes(params[:idea])\n format.html { redirect_to(@idea, :notice => 'Idea was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @idea.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @issue_models = args[:issue_models] if args.key?(:issue_models)\n @phrase_matchers = args[:phrase_matchers] if args.key?(:phrase_matchers)\n @run_entity_annotator = args[:run_entity_annotator] if args.key?(:run_entity_annotator)\n @run_intent_annotator = args[:run_intent_annotator] if args.key?(:run_intent_annotator)\n @run_interruption_annotator = args[:run_interruption_annotator] if args.key?(:run_interruption_annotator)\n @run_issue_model_annotator = args[:run_issue_model_annotator] if args.key?(:run_issue_model_annotator)\n @run_phrase_matcher_annotator = args[:run_phrase_matcher_annotator] if args.key?(:run_phrase_matcher_annotator)\n @run_sentiment_annotator = args[:run_sentiment_annotator] if args.key?(:run_sentiment_annotator)\n @run_silence_annotator = args[:run_silence_annotator] if args.key?(:run_silence_annotator)\n @run_summarization_annotator = args[:run_summarization_annotator] if args.key?(:run_summarization_annotator)\n @summarization_config = args[:summarization_config] if args.key?(:summarization_config)\n end",
"def update!(**args)\n @issue_models = args[:issue_models] if args.key?(:issue_models)\n @phrase_matchers = args[:phrase_matchers] if args.key?(:phrase_matchers)\n @run_entity_annotator = args[:run_entity_annotator] if args.key?(:run_entity_annotator)\n @run_intent_annotator = args[:run_intent_annotator] if args.key?(:run_intent_annotator)\n @run_interruption_annotator = args[:run_interruption_annotator] if args.key?(:run_interruption_annotator)\n @run_issue_model_annotator = args[:run_issue_model_annotator] if args.key?(:run_issue_model_annotator)\n @run_phrase_matcher_annotator = args[:run_phrase_matcher_annotator] if args.key?(:run_phrase_matcher_annotator)\n @run_sentiment_annotator = args[:run_sentiment_annotator] if args.key?(:run_sentiment_annotator)\n @run_silence_annotator = args[:run_silence_annotator] if args.key?(:run_silence_annotator)\n @run_summarization_annotator = args[:run_summarization_annotator] if args.key?(:run_summarization_annotator)\n @summarization_config = args[:summarization_config] if args.key?(:summarization_config)\n end",
"def update\n @support_case = SupportCase.find(params[:id])\n support_case_changed = @support_case\n\n if(params[:support_case][:employee_id]!=nil)\n @support_case.employee = Employee.find(params[:support_case][:employee_id])\n else\n @support_case.employee = nil\n end\n\n support_case_changed.attributes =params[:support_case]\n\n createEvents(support_case_changed)\n\n respond_to do |format|\n if (@support_case.update_attributes(params[:support_case]))\n format.html { redirect_to @support_case, notice: 'Support case was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @support_case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @annotations = args[:annotations] if args.key?(:annotations)\n @entities = args[:entities] if args.key?(:entities)\n @intents = args[:intents] if args.key?(:intents)\n @issue_model_result = args[:issue_model_result] if args.key?(:issue_model_result)\n @phrase_matchers = args[:phrase_matchers] if args.key?(:phrase_matchers)\n @sentiments = args[:sentiments] if args.key?(:sentiments)\n end",
"def update!(**args)\n @annotations = args[:annotations] if args.key?(:annotations)\n @entities = args[:entities] if args.key?(:entities)\n @intents = args[:intents] if args.key?(:intents)\n @issue_model_result = args[:issue_model_result] if args.key?(:issue_model_result)\n @phrase_matchers = args[:phrase_matchers] if args.key?(:phrase_matchers)\n @sentiments = args[:sentiments] if args.key?(:sentiments)\n end",
"def update\n @event = Event.find(params[:id])\n\t @events = Event.find(:all)\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html {\n\n flash[:notice] = 'Event was successfully updated.'\n redirect_to \"/admin/events/2010/4\"\n \n }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(...)\n assign_attributes(...)\n save\n end",
"def update\n setup_variables\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to(admin_event_path(@event)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @explanation_spec = args[:explanation_spec] if args.key?(:explanation_spec)\n @explanation_type = args[:explanation_type] if args.key?(:explanation_type)\n end",
"def update\n @event = EventPost.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event_post])\n track_activity @event\n format.html { redirect_to @event, notice: 'Event post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n if @faq.update_attributes(params[:faq])\n format.html { redirect_to @faq, notice: 'FAQ atualizada com sucesso.' }\n format.json { head :no_content }\n else\n @subjects = Subject.all\n format.html { render action: \"edit\" }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6033221",
"0.5766155",
"0.5753449",
"0.5753449",
"0.5720658",
"0.56744754",
"0.5643645",
"0.56246233",
"0.561939",
"0.5604081",
"0.5591615",
"0.5591615",
"0.5591615",
"0.5591615",
"0.5579878",
"0.55676687",
"0.5543988",
"0.55154854",
"0.55154854",
"0.551388",
"0.5500097",
"0.54868054",
"0.5468187",
"0.5468187",
"0.5458213",
"0.54148495",
"0.53969765",
"0.53969765",
"0.5376571",
"0.5375165",
"0.5369608",
"0.5367246",
"0.53542054",
"0.53530705",
"0.53397286",
"0.53345054",
"0.53345054",
"0.53345054",
"0.53345054",
"0.53345054",
"0.5332572",
"0.53294426",
"0.5323088",
"0.53107196",
"0.5306215",
"0.52951473",
"0.52939117",
"0.5290674",
"0.529044",
"0.5281183",
"0.52665216",
"0.52650625",
"0.5261927",
"0.5259646",
"0.52590173",
"0.52357024",
"0.52173537",
"0.5214852",
"0.52143455",
"0.5212123",
"0.5199853",
"0.5160468",
"0.51550525",
"0.515448",
"0.51532865",
"0.51526517",
"0.5147138",
"0.5147138",
"0.5147138",
"0.51435053",
"0.51404667",
"0.51403666",
"0.5136127",
"0.51308984",
"0.51293546",
"0.5129203",
"0.5124543",
"0.51233745",
"0.51205146",
"0.51156324",
"0.5100984",
"0.5098447",
"0.5088201",
"0.5078515",
"0.5077433",
"0.5077024",
"0.5076453",
"0.5073401",
"0.50704473",
"0.5064707",
"0.5064707",
"0.50623846",
"0.5061404",
"0.5061404",
"0.5060689",
"0.5057784",
"0.5056108",
"0.50516856",
"0.504672",
"0.50463986"
] |
0.6241192
|
0
|
This will read a given test case and pass that into the test_case_processor. A test case is defined as the number of lines_per_test_case Can optionally pass in a line_processor that will process a line before adding it to the buffer. Will stop reading after we hit the number of test cases defined in the file Assumption: Number of test cases is defined in the first line
|
def parse(test_case_processor, line_processor = nil)
(raise ArgumentError.new('Missing input filename to parse')) unless @filename
line_counter = -1
test_cases_read = 0
test_cases = 0
line_buffer = []
IO.foreach(@filename) do |line|
line.strip!
# read number of cases
if line_counter == -1
test_cases = line.to_i
# if unable to parse or we get 0, blow up
raise ArgumentError.new('Missing number of test cases on first line') if test_cases == 0
line_counter = 0
# process the test case
elsif line_counter == (lines_per_test_case - 1)
line = line_processor.call(line) if line_processor
line_buffer << line
test_cases_read += 1
test_case_processor.call(line_buffer, test_cases_read)
line_buffer = []
line_counter = 0
return if test_cases_read == test_cases
# keep reading
else
line = line_processor.call(line) if line_processor
line_buffer << line
line_counter += 1
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def process_testcase(line_buffer)\n line_buffer\n end",
"def process_block(line_buffer, test_number)\n if (@custom_processor && @custom_processor.class.method_defined?(:process_testcase))\n @custom_processor.process_testcase line_buffer\n else\n line_buffer\n end\n end",
"def scan_file (file_name)\n #for each line\n File.open(file_name).each do |line|\n parsed_line = parse_line line\n raise \"Invalid spec format:\\n\" + line if parsed_line.class == InvalidLine\n update_on_new_line parsed_line\n end \n @test_suite.add_test_case current_test_case if current_test_case && @state.class == AddingTestCases\n @test_suite\n end",
"def collect_next_line\n line = @io.gets\n return nil unless line\n\n if line =~ ONE_LINE_TEST_RESULT_REGEX\n process_test_result $1\n\n elsif line.include? TEST_RESULT_START_TOKEN\n @partial_test_result << line.sub(TEST_RESULT_START_TOKEN, '')\n\n elsif line.include? TEST_RESULT_END_TOKEN\n @partial_test_result << line.sub(TEST_RESULT_END_TOKEN, '')\n process_test_result @partial_test_result\n @partial_test_result = ''\n\n elsif !@partial_test_result.empty?\n # Middle of a test result\n @partial_test_result << line\n\n else\n @on_non_test_result_line_block.call(line) if @on_non_test_result_line_block\n\n end\n\n line\n end",
"def test_lines(pr)\n count_lines(test_files(pr))\n end",
"def read_test_cases\n Integer(@file.gets)\n end",
"def process_lines(input_file)\n for line in input_file\n process_line(line)\n end\n end_of_file\n end",
"def find_test_case(file_info, line_nr)\n last_tc = nil \n file_info[:testcases].each do |tc|\n last_tc = tc unless last_tc\n break if tc[:line_nr] > line_nr\n last_tc = tc\n end\n last_tc\nend",
"def process_input_file \n File.open(@file, 'r') do |f|\n f.each_line do |line|\n parse_line(line)\n end\n end\n end",
"def process\r\n in_loop = false\r\n in_example = false\r\n\r\n fh = File.open(@source_file, 'r:utf-8')\r\n fh.each do |line|\r\n line.chomp!\r\n line.gsub!(\"\\t\", \" \") # convert tab to 2 spaces\r\n \r\n # ensure first line as driver definition\r\n unless @driver\r\n if matches = /^#{regex_proc_head}DRIVER#{regex_proc_end}(?<dname_>\\w+)\\s*$/.match(line)\r\n @driver = Driver.create(matches[\"dname_\"]) \r\n self.dump(@driver.setup)\r\n next\r\n else\r\n raise \"You must specify a driver on the first line\"\r\n end\r\n end\r\n \r\n # interrupt for loops\r\n if matches = /#{regex_loop_line}/.match(line)\r\n in_loop = true\r\n @loop_start_ln = $.\r\n next\r\n end\r\n\r\n # expand and end current loop \r\n if in_example\r\n unless /#{regex_example_head}/.match(line)\r\n self.expand_loop\r\n in_example = false\r\n in_loop = false\r\n end\r\n end\r\n\r\n # end a loop template and start a loop example\r\n if in_loop\r\n in_example = true if /#{regex_example_head}/.match(line)\r\n end\r\n\r\n # dispatch the current line to different holders\r\n if in_example\r\n self.add_example_line line\r\n elsif in_loop\r\n @loop_template = @loop_template ? @loop_template + \"\\n\" + line : line\r\n else\r\n self.process_line line, $.\r\n end\r\n end\r\n fh.close\r\n\r\n # do not forget expand last loop if it reaches over EOF.\r\n self.expand_loop if @loop_start_ln > 0\r\n\r\n # close all remain stacks\r\n self.close_stack 0\r\n\r\n self.dump(@driver.exit)\r\n @output.close if @output_file\r\n self\r\n end",
"def run(test_cases, options = {})\n fire_event :start\n\n if options[:line_numbers]\n test_groups = nearest_test_groups(test_cases, options[:line_numbers])\n else\n test_groups = test_cases.zip(test_cases.map(&:tests))\n end\n\n test_groups.each do |test_case, tests|\n fire_event :enter, test_case\n tests.each { |test| report(test) }\n fire_event :exit, test_case\n end\n rescue Interrupt\n $stderr.puts \"Interrupted!\"\n ensure\n fire_event :end\n end",
"def n_lines(filename); end",
"def parse_test_result(line, thread)\n if(@inside_test_result)\n if(line.index(@@test_result_post_delimiter))\n @inside_test_result = false\n write_test_result(test_result)\n close\n examine_test_result test_result\n return true\n else\n test_result << line\n end\n end\n\n if(line.index(@@test_result_pre_delimiter))\n @inside_test_result = true\n end\n \n return @inside_test_result\n end",
"def _test_text ; process_test_case(\"text\") ; end",
"def _test_numbers ; process_test_case(\"numbers\") ; end",
"def file_run(args, line_num)\n file_read = true\n args.each do |the_file|\n f = handle_file(the_file)\n exit 5 unless f\n f.each_line do |line|\n line_num += 1\n run_eval(line, line_num, file_read)\n end\n f.close\n end\n end",
"def analyze_file\n line_number = 0\n File.foreach('test.txt') do |line|\n @analyzers << LineAnalyzer.new(line.chomp, line_number += 1)\n end\n end",
"def test_read_file_many_blocks\r\n hash_calc = Minitest::Mock.new('test_hash_calculator')\r\n block_checker = Minitest::Mock.new('test_block_checker')\r\n account_tracker = Minitest::Mock.new('account_tracker')\r\n def block_checker.read_next_line; \"1|2|3|4|5|6\"; end\r\n def block_checker.parse(string, char); [\"1\",\"2\",\"3\",\"4\",\"5\",\"6\"]; end\r\n output = \"Line 0: Too many '|' in the block '1|2|3|4|5|6'\"\r\n assert_equal output, @g.read_file(hash_calc, block_checker, account_tracker)\r\n end",
"def _test_message ; process_test_case(\"message\") ; end",
"def test_file_io\n mock_file = flexmock(\"file\")\n mock_file.should_receive(:gets).and_return(\"line 1\", \"line 2\", nil)\n assert_equal 2, count_lines(mock_file)\n end",
"def test_read_lines\n IO.readlines(__FILE__).each do |line|\n print line\n end\nend",
"def process_grouped_examples(lines, pattern, lineno = 1)\n chunks = lines.slice_before(pattern)\n chunks = chunks.map { |chunk| v = [chunk, lineno]; lineno += chunk.size; v }\n chunks.map do |chunk, chunk_lineno|\n trimmed_chunk = chunk.trim_blank\n [trimmed_chunk, chunk_lineno + chunk.index(trimmed_chunk.first)]\n end\n chunks.each { |chunk, chunk_lineno| process_example(chunk, chunk_lineno) }\n self\n end",
"def enqueue_lines(fh, numlines)\n vc = 0 # valid count \n lc = 0 # line count\n while line = fh.gets\n vc += 1 if enqueue_url(line)\n lc += 1\n break if numlines and lc >= numlines\n end\n [lc, vc]\n end",
"def test_preprocessor(preprocessor,input,expected)\n # Prepare the output and the input streams\n puts \"Preparing the input and ouput streams...\"\n output = StringIO.new(\"\")\n # Process the input and exepected arguments.\n if !input.respond_to?(:each_line) or input.is_a?(String) then\n # input is actually a file name, open it.\n input = File.open(input.to_s,\"r\")\n end\n if !expected.respond_to?(:each_line) or expected.is_a?(String) then\n # expected is actually a file name, open it.\n expected = StringIO.new(File.read(expected.to_s))\n end\n\n # Apply the preprocessor\n puts \"Applying the preprocessor...\"\n preprocessor.preprocess(input,output)\n\n # Check the result\n puts \"Checking the result...\"\n output.rewind\n check = output.string == expected.read\n\n unless check\n puts \"*Error*: invalid expansion result.\"\n iline = output.string.each_line\n expected.rewind\n expected.each_line.with_index do |exp_line,i|\n line = iline.next\n puts \"exp_line=#{exp_line}\"\n puts \"line=#{line}\"\n if exp_line != line then\n puts \"Expected line #{i+1}:\\n#{exp_line}\"\n puts \"got:\\n#{line}\"\n end\n end\n return false\n end\n return true\nend",
"def handle_source_file params\n filepath = find_source_file(params)\n\n return false unless File.exists?(filepath)\n\n file = File.open(filepath, 'r')\n\n _started = false\n _data = []\n _return_val = false\n\n file.each_line do |line|\n if mch = /^[[:blank:]]*def ([a-z0-9_]+)/.match(line)\n if _data.blank? # current method has no mock data\n next\n else\n if mch[1] == params[:action] # hit\n key = MockCache.cache_key(params)\n MockCache.write_mock_response(key, _data.join)\n _return_val = true\n else # miss, but there exists a mock\n key = MockCache.cache_key(controller: params[:controller],\n action: mch[1])\n MockCache.write_mock_response(key, _data.join)\n end\n _data = []\n next\n end\n end\n\n if line =~ mock_tokenizer\n _started = !_started\n next\n end\n if _started\n _data << line.gsub(/^[[:blank:]]*\\#/, \"\")\n end\n end\n file.close\n _return_val\n end",
"def test_line_at\n @proc.settings[:directory] = ''\n assert_equal(nil, @proc.resolve_file_with_dir(@file))\n if File.expand_path(Dir.pwd) == File.expand_path(File.dirname(__FILE__))\n line = @proc.line_at(@file, __LINE__)\n assert_match(/line = @proc.line_at/, line)\n else\n assert_equal(nil, @proc.line_at(@file, __LINE__))\n end\n dir = @proc.settings[:directory] = File.dirname(__FILE__)\n assert_equal(File.join(dir, @file), \n @proc.resolve_file_with_dir('test-proc-location.rb'))\n test_line = 'test_line'\n line = @proc.line_at(@file, __LINE__-1)\n assert_match(/#{line}/, line)\n end",
"def print_some_lines(line_count, f)\n\tputs \"How many lines of the file would you like to print?\"\n\tnum_of_lines = $stdin.gets.chomp.to_i\n\tlines_printed = 0\n\twhile lines_printed < num_of_lines\n\t\tprint_a_line(line_count, f)\n\t\tlines_printed += 1\n\t\tline_count += 1\n\tend\nend",
"def run\n begin\n yield @first_line if block_given?\n while (size = File::Stat.new(@filename).size) >= @next_start\n size = @file.stat.size\n reset_buffer_size\n begin\n line = \"\"\n @file.seek(@next_start, File::SEEK_SET)\n @file.read(@buf_size, @buffer)\n buffer_start = @next_start\n found_new_line = false\n 0.upto(@buffer.size - 1) do |index|\n line << @buffer[index]\n if @buffer[index].chr == \"\\n\"\n yield(line) if block_given?\n line = \"\"\n found_new_line = true\n @next_start = buffer_start + index + 1\n end\n end\n unless found_new_line || @buffer.empty?\n raise BufferError\n end\n rescue BufferError\n increment_buffer_size\n retry\n end\n\t sleep 0.01\n end\n rescue Errno::ENOENT\n # Wait until the file is recreated\n while !File.exists?(@filename)\n sleep 0.05\n end\n end\n end",
"def load_test(data_set)\n\t\tFile.open(data_set, \"r\") do |f|\n\t\t\tf.each_line do |line|\n\t\t\t\t@@line_array = line.split(' ')\n\t\t\t\t@test_set.push([@@line_array[0].to_i, @@line_array[1].to_i, @@line_array[2].to_i])\n\t\t\tend\n\t\tend\n\tend",
"def process_file\n @line_lengths = []\n @total_lines = 0\n\n Rails.logger.info(\"Begin processing file: #{@file_path}\" )\n\n time = Benchmark.realtime do\n File.open(@file_path, \"r\") do |file|\n loop do\n line = file.gets(\"\\n\")\n break if line.nil?\n @line_lengths[@total_lines] = line.length\n @total_lines += 1\n end\n end\n end\n\n Rails.logger.info(\"File processing done, duration: #{time}\" )\n end",
"def initialize(file_name)\n super(file_name)\n @type = \"Feature\"\n @scenarios = []\n @scenarios_score = 0\n @total_score = 0\n @feature_lines = IO.readlines(file_name)\n split_feature(file_name, feature_lines) unless @feature_lines == []\n end",
"def process_test_cases\n raise NotImplementedError, 'You must implement this'\n end",
"def test_line_at\n @cmdproc.settings[:directory] = ''\n assert_equal(nil, @cmdproc.resolve_file_with_dir(@file))\n if File.expand_path(Dir.pwd) == File.expand_path(File.dirname(__FILE__))\n line = @cmdproc.line_at(@file, __LINE__)\n assert_match(/line = @cmdproc.line_at/, line)\n else\n assert_equal(nil, @cmdproc.line_at(@file, __LINE__))\n end\n dir = @cmdproc.settings[:directory] = File.dirname(__FILE__)\n assert_equal(File.join(dir, @file), \n @cmdproc.resolve_file_with_dir('test-proc-location.rb'))\n test_line = 'test_line'\n line = @cmdproc.line_at(@file, __LINE__-1)\n assert_match(/#{line}/, line)\n end",
"def process_line(line)\n if (@custom_processor && @custom_processor.class.method_defined?(:process_line))\n @custom_processor.process_line line\n else\n line.split ' '\n end\n end",
"def read(start: 0, num: 10)\n f = open(@filename, 'r')\n # Iterate to start line\n start.times { f.gets }\n \n # Read lines start to last\n data = ''\n num.times {\n chunk = f.gets\n data << chunk unless chunk.nil?\n }\n \n f.close()\n return data\n end",
"def extract_test_from_file(file)\n return nil if ! File.file?(file)\n tests = \"\"; inside = false\n fstr = File.read(file)\n fstr.split(/\\n/).each do |l|\n if l =~ /^=begin[ ]*test/i\n tests << \"\\n\"\n inside = true\n next\n elsif inside and l =~ /^=[ ]*end/\n inside = false\n next\n end\n if inside\n tests << l << \"\\n\"\n end\n end\n tests\n end",
"def process_skipped_lines(lines); end",
"def run_test(num = -1)\n\t\tpred_list = []\n\t\tcount = 0\n\t\ttest_file.each_line do |line|\n\t\t\tsplited = line.split(\" \")\n\t\t\tuser_id = splited[0].to_i\n\t\t\tmovie_id = splited[1].to_i\n\t\t\trating = splited[2].to_i\n\t\t\tpredict = predict(user_id,movie_id)\n\t\t\terror = (rating - predict).abs\n\t\t\tpred_list << {user_id: user_id, movie_id: movie_id, rating: rating, predict: predict,error: error}\n\t\t\tcount += 1\n\t\t\t#if num is -1 the default value, then run all of the tests\n\t\t\t#if num is positive then check to stop\n\t\t\tif count >= num and num > 0\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\treturn MovieTest.new(pred_list)\n\tend",
"def read(aFile)\n count = aFile.gets\n if (is_numeric?(count))\n count = count.to_i + 1\n count.times do\n line = aFile.gets\n puts \"Line read: \" + line\n end\n else\n puts \"Error: first line of file is not a number\"\n end\nend",
"def processor(testcase, report, mlogger, filter)\n\n $count += 1 #increment serial number\n sleep(2)\n begin\n load testcase\n rescue LoadError => e\n mlogger.startTestCase(testcase)\n mBacktrace = e.backtrace.join(\"\\n\")\n mlogger.logDesc(\"Load test case failure #{testcase}\")\n mlogger.logDesc(e.to_s)\n mlogger.logDesc(mBacktrace)\n class << testcase\n attr :check, true\n attr :pass, true\n attr :response, true\n end\n testcase.check = true\n testcase.pass = false\n testcase.response = e.backtrace.join(\"\\n\")\n report.action += 1\n report.fail_action += 1\n report.fail_testcases[testcase] = 1\n processReport({:timeStamp => Time.now, :result => testcase, :monitor => []}, mlogger)\n mlogger.endTestCase(testcase)\n return\n rescue => e\n mlogger.startTestCase(testcase)\n mBacktrace = e.backtrace.join(\"\\n\")\n mlogger.logDesc(\"Load test case failure #{testcase}\")\n mlogger.logDesc(e.to_s)\n mlogger.logDesc(mBacktrace)\n class << testcase\n attr :check, true\n attr :pass, true\n attr :response, true\n end\n testcase.check = true\n testcase.pass = false\n testcase.response = e.backtrace.join(\"\\n\")\n report.action += 1\n report.fail_action += 1\n report.fail_testcases[testcase] = 1\n processReport({:timeStamp => Time.now, :result => testcase, :monitor => []}, mlogger)\n mlogger.endTestCase(testcase)\n return\n end\n\n curTest = Model::TestCase.instance\n mlogger.startTestCase(testcase)\n mlogger.logDesc(curTest.description)\n monitors = curTest.monitor || []\n rData = []\n enviornment = {:file => mlogger.log_path}\n\n monitors.each do |y|\n begin\n Timeout::timeout(y.timeOut) do\n y.set(enviornment) if y.respond_to?(:set)\n y.run\n end\n rescue Timeout::Error\n end\n end # set monitor\n\n [curTest.setup, curTest.action, curTest.teardown].flatten.compact.each do |x|\n report.action += 1\n mlogger.startAction\n\n begin\n next if (filter && filter.include?(x.class))\n\n begin\n Timeout::timeout(x.timeOut) { x.run }\n rescue Timeout::Error\n class << x\n attr :check, true\n attr :pass, true\n attr :response, true\n end\n x.check = true\n x.pass = false\n x.response = \"Step time out #{x.timeOut}\"\n rescue => detail\n class << x\n attr :check, true\n attr :pass, true\n attr :response, true\n end\n x.check = true\n x.pass = false\n x.response = detail.message + detail.backtrace.join(\"\\n\")\n ensure\n rData.push({:timeStamp => Time.now, :result => x, :monitor => []})\n end # execution\n\n # push system verfication\n #systemCheck.map. each do |z|\n # rData.push({:timeStamp => Time.now, :result => z, :monitor => []})\n #end\n rescue\n puts $!\n end\n end\n\n need_to_dump = has_error?(rData)\n monitors.each do |y|\n begin\n y.set(:dump => true) if (need_to_dump && y.respond_to?(:set))#always report for now\n Timeout::timeout(y.timeOut) { y.fetch }\n rescue Timeout::Error\n end\n end\n if need_to_dump then\n rData.select do |mfilter|\n begin\n mfilter[:result].check && !mfilter[:result].pass\n rescue NoMethodError\n false\n end\n end.each do |z|\n report.fail_action += 1\n report.fail_testcases[testcase] = 1\n processReport(z,mlogger)\n end\n end\n\n mlogger.endTestCase\n report\nend",
"def process_lines(io)\n counter = 0\n io.each_line do |line|\n yield @redis, line\n counter = counter + 1\n end\n return counter \n end",
"def import test_cases\n raise TypeError, \"File list must be an Array, got #{test_cases.class}\" unless test_cases.is_a? Array\n test_cases.each do |test_case|\n puts \"%20s : %s\" % ['Adding ' + self.class.type, test_case] if RubyUnit.debug\n require test_case\n end\n end",
"def count_lines()\n start_time = Time.now\n @file_lines = 0 \n last_block_position = 0\n prev_block_position = -1\n Rula.log(Logger::DEBUG,\"Reading file #{@filename} lines count\",self)\n file_handle = File.open(@filename,'rb')\n while data = file_handle.read(@@BLOCK_SIZE)\n original_size = data.length\n last_occurence = data.rindex(Rula.options[:line_separator])\n difference_in_size = original_size - last_occurence\n\n if data.length==1 then\n break\n end\n\n if !last_occurence.nil? then\n data = data[0..last_occurence]\n file_handle.pos -= difference_in_size\n end\n @file_lines += data.scan(/([^|#{Rula.options[:line_separator]}].*)#{Rula.options[:line_separator]}/).length\n \n (0...@@BUFFERS).each {|i| \n @buffers[i].add_hash(last_block_position, prev_block_position, file_handle.pos, @file_lines)\n }\n prev_block_position = last_block_position \n last_block_position = file_handle.pos\n end\n Rula.log(Logger::DEBUG,\"Counted #{@file_lines} lines for file #{@filename}\",self)\n ensure\n Rula.log(Logger::DEBUG,\"Counting lines ran #{(Time.now - start_time) * 1000} ms\",self)\n file_handle.close()\n load_buffer_data(0)\n end",
"def test_cases(*args, **kwargs, &block)\n if block_given?\n process_block(&block)\n elsif kwargs.length.positive?\n process_kwargs(**kwargs)\n elsif args.length.positive?\n add_tests(*args)\n else\n @tests || {}\n end\n end",
"def line_maker\n @lines = File.readlines(path, chomp: true)\n end",
"def check_line(filename, line_number, line_content)\n\t\tend",
"def count_lines(file)\n n = 0\n while file.gets\n n += 1\n end\n n\n end",
"def readlines(*several_variants)\n #This is a stub, used for indexing\n end",
"def use_file(file_arg, line)\n read = true\n file_arg.each do |file|\n f = check_file(file)\n exit 5 unless f\n f.each_line do |num|\n line += 1\n work_prompt(num, line, read)\n end\n f.close\n end\n end",
"def process(source)\n\t\t\t@source = source.respond_to?(:path) ? File.basename(source.path) : 'unknown'\n\t\t\t@line_no = 0\n\t\t\t@last_if = nil\n\t\t\t@outputting = true\n\t\t\tout_lines = []\n\t\t\tsource.each_line do |line|\n\t\t\t\t@line_no += 1\n\t\t\t\tif is_from_preprocessor?(line)\n\t\t\t\t\tparse(line)\n\t\t\t\telse\n\t\t\t\t\tif @outputting\n\t\t\t\t\t\tout_lines << line\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tif @last_if\n\t\t\t\traise PreprocessorError, \"#@source:#@last_if:error: unmatched #if\"\n\t\t\tend\n\t\t\tFakeIO.new(out_lines)\n\t\tend",
"def read_testing_data\n File.open(@testing_file) {|file|\n file.each do |line|\n next if line.strip == ''\n data_id, *snp_list = line.strip.split\n raise Nimbus::InputFileError, \"There are individuals with no ID, please check data in Testing file.\" unless (!data_id.nil? && data_id.strip != '')\n raise Nimbus::InputFileError, \"Individual ##{data_id} from testing set has no value for all #{@tree_SNP_total_count} SNPs.\" unless snp_list.size == @tree_SNP_total_count\n individual_test = Nimbus::Individual.new(data_id.to_i, nil, snp_list.map{|snp| snp.to_i})\n yield individual_test\n end\n }\n end",
"def add_test(filepath, testcases = nil)\n @tests << Test.new(filepath, testcases, @options)\n end",
"def run_test(number_of_records = nil)\n\t\ttest_file_exists?\n\t\tmovie_test = MovieTest.new\n\t\tcount = 1\n\t\tCSV.foreach(@data_file_path+'/'+@test_file_name, {col_sep: \"\\t\"}) do |row|\n\t\t\tuser_id, movie_id, rating, timestamp = row\n\t\t\trating = rating.to_f\n\t\t\tpredicted_rating = predict(user_id, movie_id)\n\t\t\tmovie_test.add_prediction Prediction.new(user_id, movie_id, rating, predicted_rating)\n\t\t\tcount += 1\n\t\t\tbreak if count == number_of_records\n\t\tend\n\t\tmovie_test\n\tend",
"def load_test(tc)\n data = Hash.new\n File.open(tc, \"r\") do |infile|\n while (line = infile.gets)\n #test = /^.*\\/(.*\\.rb)/.match(tc)[1]\n test = /^.*\\/([A-Za-z0-9_-]*[T|t]est.*)/.match(tc)[1]\n data['execute_class'] = /^([A-Za-z0-9_-]*[T|t]est.*)/.match(tc)[1]\n data['path'] = /(.*)\\/#{test}/.match(tc)[1]\n data['execute_args'] = /^#[\\s]*@executeArgs[\\s]*(.*)/.match(line)[1] if /^#[\\s]*@executeArgs/.match(line)\n data['author'] = /^#[\\s]*@author[\\s]*(.*)/.match(line)[1] if /^#[\\s]*@author/.match(line)\n data['keywords'] = /^#[\\s]*@keywords[\\s]*(.*)/.match(line)[1].gsub(/,/,'').split if /^#[\\s]*@keywords/.match(line)\n data['description'] = /^#[\\s]*@description[\\s]*(.*)/.match(line)[1] if /^#[\\s]*@description/.match(line)\n end\n end\n @tests << Test.new(data, @test_data) if data['keywords'] != nil and data['keywords'] != \"\"\nend",
"def print_a_line(line_count, f)\n # calling f.gets.chomp on the file must get the first line?\n puts \"#{line_count}, #{f.gets.chomp}\"\nend",
"def line_processor\n open(\"tmp/insert_YourFileName_lines.txt\") do |f|\n f.each do |line| \n unless line =~ /^$/\n puts line.to_s.to_textual\n end\n end\n end\n \nend",
"def process_externals_lines\n File.open(file_name, \"r\") do |f|\n #File.open(\"./lib/externals/externals_table_data_input_lines.txt\", \"r\") do |f|\n f.each_line do |line|\n puts line.to_textual\n sleep(0.01)\n end\n end\n end",
"def initialize(filename, starting_line_number, number_of_suggestions=2)\n self.possible_suggestions = []\n\n # Build up our collection of suggestions for this test case\n self.invalid_word = read_line_number(filename, starting_line_number)\n number_of_suggestions.times do |i|\n self.possible_suggestions << Suggestion.new(self.invalid_word, read_line_number(filename, starting_line_number + i + 1))\n end\n end",
"def pbCompilerEachPreppedLine(filename)\r\n File.open(filename,\"rb\") { |f|\r\n FileLineData.file = filename\r\n lineno = 1\r\n f.each_line { |line|\r\n if lineno==1 && line[0].ord==0xEF && line[1].ord==0xBB && line[2].ord==0xBF\r\n line = line[3,line.length-3]\r\n end\r\n line.force_encoding(Encoding::UTF_8)\r\n line = prepline(line)\r\n if !line[/^\\#/] && !line[/^\\s*$/]\r\n FileLineData.setLine(line,lineno)\r\n yield line, lineno\r\n end\r\n lineno += 1\r\n }\r\n }\r\n end",
"def run_test(amount = 20000) #if no amount specified, run all 20000 tests. \n if @testfile == nil #if originally no test file was specified, indicate and exit.\n puts \"No data to test!\"\n exit(0)\n end\n results_array = Array.new\n target_data = open(@testfile, \"r\")\n target_data.take(amount).each do |line| #reading in specified amount of data to test.\n reviewer_val, movie_val, rating_val, timestamp_val = line.split\n prediction = prediction_data(reviewer_val, movie_val).round(2) #calls prediction on user from the test_set.\n results = [reviewer_val, movie_val, rating_val, prediction]\n results_array.push(results)\n end \n analyze_data(results_array)\n end",
"def process_file(offset = 0)\n batch = Array.new\n idx = 0\n IO.readlines(@logfile).each do |line|\n if (idx += 1) <= offset\n next\n end\n\n m = line.match(@regex)\n if !m\n $stderr.puts \"Dropping logline '#{line}' because it does not match the parsing regex: #{@regex}\"\n next\n end\n\n if batch.size >= @batch_size\n enqueue_batch(batch.dup)\n batch.clear()\n end\n\n batch.push(m)\n end\n\n if batch.size > 0\n enqueue_batch(batch)\n end\n\n return idx\n end",
"def next_lines(lines, number)\n lines.slice!(0, number)\n end",
"def test_file_must_contain_contains()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \"second line\")\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(@multilinefilecontents.split(\"\\n\").length, lines.length)\n\t\t}\n\tend",
"def read\n @fileobj = File.open(@fname,\"r\")\n parse_header_line(@fileobj.readline) unless @fileobj.eof?\n\n while (!@fileobj.eof?)\n yield(parse_data_line(@fileobj.readline))\n end\n end",
"def readline(file, line_number)\n current_line = 0\n File.open(file).each do |line_text|\n current_line += 1\n return line_text.strip if current_line == line_number\n end\n end",
"def readline(file, line_number)\n current_line = 0\n File.open(file).each do |line_text|\n current_line += 1\n return line_text.strip if current_line == line_number\n end\n end",
"def process_line(line, &block)\n return enum_for(:process_line, line) unless block\n\n if @row_index < header_lines\n consume_header_line(line, @columns)\n else\n transform_line(line, @row_index, &block)\n end\n\n @row_index += 1\n\n # We've now seen enough lines to have consumed a valid header; is this the case?\n fail_unless_header_complete(@columns) if @row_index == header_lines\n\n @notifier.try(:processed, @row_index)\n end",
"def print_test_suite_section(options={})\n options = {\n }.merge(options)\n\n in_test_suite_section = false\n\n # go thru file data\n @testflow_lines.each_index do |linenum|\n line = @testflow_lines[linenum]\n line.gsub!(/\\r/,\"\"); line.gsub!(/\\n/,\"\")\n\n if line =~ /^------/ && in_test_suite_section\n in_test_suite_section = false\n end\n\n if in_test_suite_section\n print \"#{line}\\n\"\n end\n\n if line =~ /^test_suites/\n in_test_suite_section = true\n end\n end\n\nend",
"def result\n rows = File.readlines(file)\n\n result = Result.new\n unless rows.empty?\n row_number = 0\n row_number += 1 while rows[row_number].chomp.empty?\n\n result.cols = rows[row_number].chomp.split(';')\n result.col_count = result.cols.size\n\n row_number += 1\n row_number += 1 while rows[row_number].chomp.empty?\n\n result.row_count = rows.size - 1\n result.sample_row = rows[row_number].chomp\n end\n\n result\n end",
"def get_lines(filename); end",
"def readlines(&block)\n loop do\n if @lines.size < 3 && !@f.eof?\n @lines << @f.readline\n elsif @lines.size == 0 && @f.eof?\n break\n else\n yield @lines.shift\n end\n end\n end",
"def run_test(lines=nil)\n\t\t@movTest = MovieTest.new\n\t\tload_data(@test_file, @test_data, lines)\n\n\t\t@test_data.each_key do |k|\n\t\t\t@test_data[k].movie_and_rating.each_key do |key|\n\t\t\t\tmovTest.push_results(k,key,@test_data[k].movie_and_rating[key],predict(k, @test_data[k].movie_and_rating[key]))\n\t\t\tend\n\t\tend\n\tend",
"def num_matches_in_file(fname, match_regexp)\n\n num_lines_per_batch = 5000\n\n num_matched = 0\n\n if File.exist? fname\n File.open(fname, \"r\") do |f|\n\n # use an enumerator to read just (num_lines_per_batch) lines at a time\n f.lazy.each_slice(num_lines_per_batch) do |lines|\n\n num_matched += lines.select { |line| line.match(match_regexp) }.count\n\n end\n\n end\n else\n num_matched = 0\n end\n\n num_matched\n end",
"def get_file_data(options={})\n options={ file_type: :testflow \n }.merge(options)\n fp = FileParser.new\n fp.open(filename: @filename)\n if options[:file_type] == :testflow\n @testflow_lines = fp.readlines\n elsif options[:file_type] == :limits\n @limits_lines = fp.readlines\n else\n fail \"Invalid type '#{options[:type]}' passed to 'get_file_data'!\"\n end\n fp.close()\nend",
"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_test(component)\n test_path = File.expand_path __dir__\n IO.popen(\"ruby #{test_path}/#{component}_spec.rb\") do |data|\n while line = data.gets\n puts line\n end\n end\n $?.exitstatus\nend",
"def get_tests(file:, lineno:)\n tests = Set.new\n read_mapping.each do |test, spectra|\n lines = spectra[file]\n next unless lines\n n = lines.bsearch { |x| x >= lineno }\n if n == lineno\n tests << test\n end\n end\n tests\n end",
"def analyze_file()\n arrayLinAnaly=[]\n linenum=0\n File.foreach('test.txt') do |line|\n arrayLinAnaly << LineAnalyzer.new(line, linenum)\n linenum+=linenum\n end\n return arrayLinAnaly\n end",
"def run\n runner = self\n @test_cases.each do |path|\n next if ENV['TEST_CASE'] && !File.basename(path).match(ENV['TEST_CASE'])\n\n Aws::ModelValidators.load_json(path).tap do |test_case|\n\n models = test_case.inject({}) { |h,(k,v)| h[k.to_sym] = v; h }\n errors = models.delete(:errors)\n\n @group.it(File.basename(path[0..-6])) do\n pending unless errors\n results = described_class.new.validate(models, apply_schema: false)\n unless runner.results_match?(results, errors)\n expect(results).to eq(errors)\n end\n end\n\n end\n end\n end",
"def count_with_file(filename)\n return if ::ServiceMock.disable_stubs\n yield self if block_given?\n content = File.open(filename, 'rb') { |file| file.read }\n count(content)\n end",
"def sample_from_fixture(fixture_name, line)\n path = path_to_fixture(fixture_name)\n File.readlines(path)[line]\n end",
"def read_input_line line_in, line_number\n\t\tinput_params = line_in.split(\" \")\n\t\tunless input_params.empty? \n\t\t\tbegin\t \n\t\t\t\tcase input_params[0]\n\t\t\t\twhen \"Driver\"\n\t\t\t\t\tself.handle_driver_command input_params\t\t\n\t\t\t\twhen \"Trip\"\n\t\t\t\t\tself.handle_trip_command input_params\t\t\n\t\t\t\telse\n\t\t\t\t\tputs \"#{input_params[0]} id not a supported command\"\n\t\t\t\tend\n\t\t\trescue => err\n\t\t\t puts \"line #{line_number} not parsed, Incorrect input format #{line_in} - #{err}\"\n\t\t\t err\n\t\t\tend\t\t\t\n\t\tend\n\tend",
"def parse_line(line)\n case line\n when /^SF:(.+)/\n @current_filename = $~[1].gsub(/^\\.\\//, '')\n source_files[@current_filename] = []\n when /^DA:(\\d+),(\\d+)/\n line_no = $~[1]\n covered = $~[2]\n source_files[@current_filename] << [line_no.to_i, covered.to_i]\n when /^(BRF|BRH):(\\d+)/\n # branches found/hit; no-op\n when /^BRDA:(\\d+),(\\d+),(\\d+),(-|\\d+)/\n line_no = $~[1]\n block_no = $~[2]\n branch_no = $~[3]\n covered = ($~[4] == '-' ? '0' : $~[4])\n source_files[@current_filename] << [line_no.to_i, block_no.to_i, branch_no.to_i, covered.to_i]\n when /^end_of_record$/, /^$/\n @current_filename = nil\n else\n raise LcovParseError, \"could not recognise '#{line}' as valid LCOV\"\n end\n end",
"def generate_test_runner(context, test_filepath, runner_filepath)\n arg_hash = {:context => context, :test_file => test_filepath, :runner_file => runner_filepath}\n @plugin_manager.pre_runner_generate(arg_hash)\n\n # collect info we need\n module_name = File.basename(arg_hash[:test_file])\n test_cases = @generator_test_runner.find_test_cases( @file_finder.find_test_from_runner_path(runner_filepath) )\n mock_list = @test_includes_extractor.lookup_raw_mock_list(arg_hash[:test_file])\n\n @streaminator.stdout_puts(\"Generating runner for #{module_name}...\", Verbosity::NORMAL)\n\n test_file_includes = [] # Empty list for now, since apparently unused\n\n # build runner file\n begin\n @generator_test_runner.generate(module_name, runner_filepath, test_cases, mock_list, test_file_includes)\n rescue\n raise\n ensure\n @plugin_manager.post_runner_generate(arg_hash)\n end\n end",
"def each_line\n while line = self.gets do\n yield line\n end\n end",
"def method_source_lines(file, line_num, context=5)\n # Yeah, we're not memory efficient here.\n lines = Array(File.open(file))\n result = []\n\n min_index = line_num - context - 1\n max_index = line_num + context\n\n max_width = (max_index + 1).to_s.length\n\n (min_index...max_index).each do |index|\n result << [(index + 1).to_s.rjust(max_width), lines[index].rstrip, index == line_num - 1]\n end\n\n result\n end",
"def test_specific_classes_methods\n # Get a line\n line = \"LINE1: This is a simple text to check the DataRecords class\\n\"\n assert_equal(line, @test_records[0].get_line)\n end",
"def print_a_line(line_count, f)\n puts(\"#{line_count}. #{f.gets.chomp}\")\nend",
"def handle_inputs_from_file file_path\n File.open(file_path) do |file|\n file.lazy.each_slice(500) do |input_lines|\n input_lines = input_lines.delete_if { |line| line == \"\\n\" } # There can be empty lines\n iterate_over_lines_and_fetch_domain(input_lines)\n end\n end\n end",
"def insertline(testfile)\n original_file = Rails.root.to_s + \"/public/test/\" + testfile\n new_file = original_file[0..-3] + 'new.rb'\n coder_file = Rails.root.to_s + \"/public/code/\" + @coder.code\n\n File.open(new_file, 'w') do |f|\n # f.puts \"require_relative '../code/#{@coder.code}'\"\n\n # Stick full text of coder's file into your new.rb spec file\n File.open(coder_file, \"r\").each_line do |line|\n f.puts line\n end\n\n # Copy original RSpec file to new temp RSpec file, excluding all \"require_relative\" and \"spec_helper\" lines\n File.foreach(original_file) do |line|\n f.puts line if !line.include?(\"require_relative\") && !line.include?(\"spec_helper\")\n end \n end \n end",
"def initialize( file, *recs_num )\n raise HL7::FileError, \"No such file: #{file}\" unless File.exists?(file)\n \n @file = file\n @file_text = \"\"\n @records = @text_as_messages = []\n # @header_to_body = [] # an array of a hash, e.g. a two dimensional array with [header,body] pairs\n @max_records = recs_num.first\n \n read_message # updates @file_text\n break_into_messages # updates @text_as_messages\n get_records\n end",
"def print_a_line(line_count, f)\n # prints the line count variable value and then prints the line of the file\n puts \"#{line_count}, #{f.gets.chomp}\"\n # end of function block\nend",
"def potential_lines(filename); end",
"def return_lines\n arr = IO.readlines(@filepath)\n arr.each do |x|\n @@worth_processing[@@i] = x if x.include? \"PROFILER:132\" \n @@i += 1\n end\n @@worth_processing\n end",
"def assert_lines_starting_with(text, number, start_with)\n\tnumber = number.to_i if number.is_a? String\n\tcount = text.split(\"\\n\").count { |line| line.start_with? start_with }\n\texpect(count).to eq number\nend",
"def get_line(filename, lineno)\n File.open(filename) do |f|\n f.gets until f.lineno == lineno - 1\n f.gets\n end\n end",
"def test_wrapped_line_parse\n\n multiple_line_config = File.open(File.join(File.dirname(__FILE__), '../testData/split_line.conf'), File::RDONLY).read\n\n result = ApacheConfigParser.parse(multiple_line_config)\n\n assert_not_nil result\n\n end",
"def load_test(filename)\n datafile = open(filename)\n #three data structure to store the data\n @test_data=Array.new #array of arrays which stores each line of the the data\n @test_movies=Hash.new #map that for each unique movie id in the data file, stores its relevant records\n @test_users=Hash.new #map that for each unique user in the data file, stores its relevant records\n datafile.each_line do |line|\n linedata=line.split(\" \").map(&:to_i)\n @test_data.push(linedata)\n if !@test_users.has_key?(linedata[0])\n @test_users[linedata[0]]=[linedata]\n else\n @test_users[linedata[0]].push(linedata)\n end\n \n if !@test_movies.has_key?(linedata[1])\n @test_movies[linedata[1]]=[linedata]\n else\n @test_movies[linedata[1]].push(linedata)\n end\n end\n datafile.close\n end",
"def test_parser_recognizer_success\n assert_equal '4', @parser.recognizer(VALID_DIGIT.lines.to_a[1..3].map{|l| l.chomp})\n end",
"def read(assignments, options = {})\n line_count = options[:count]\n read_options = options.dup\n if assignments.is_a?(Array)\n read_options[:split] = true\n end\n lines = 1.upto(line_count || 1).map { read_line(file_handle, read_options) }\n lines = line_count.nil? ? lines.first : lines\n assign_results(assignments, lines)\n end"
] |
[
"0.6840313",
"0.6714628",
"0.61795497",
"0.6089046",
"0.56071186",
"0.5429095",
"0.53580374",
"0.5227789",
"0.51999575",
"0.5108008",
"0.5098291",
"0.5067358",
"0.5023306",
"0.5021187",
"0.498296",
"0.49813312",
"0.4975683",
"0.497382",
"0.49237415",
"0.4920486",
"0.4916869",
"0.4904998",
"0.48975864",
"0.4890805",
"0.48693076",
"0.485726",
"0.48397535",
"0.48252615",
"0.4813965",
"0.480352",
"0.48027402",
"0.48008305",
"0.47935644",
"0.4782856",
"0.47787642",
"0.47483727",
"0.47383752",
"0.4729621",
"0.47287112",
"0.47260204",
"0.47243792",
"0.47131217",
"0.470397",
"0.4701646",
"0.46972126",
"0.4689658",
"0.46693933",
"0.4658056",
"0.46528697",
"0.46396202",
"0.46387655",
"0.46355972",
"0.4619322",
"0.46167573",
"0.46101925",
"0.46051037",
"0.4600823",
"0.45972386",
"0.4589071",
"0.45864868",
"0.4572538",
"0.45663607",
"0.4549769",
"0.45391256",
"0.45359042",
"0.45359042",
"0.45322567",
"0.45307338",
"0.45246863",
"0.45223054",
"0.4520427",
"0.45079225",
"0.4500902",
"0.4495927",
"0.4488189",
"0.4484727",
"0.4465885",
"0.44647712",
"0.44641313",
"0.44609454",
"0.44606224",
"0.44559368",
"0.44542822",
"0.4450387",
"0.44501123",
"0.44498348",
"0.44486043",
"0.4444513",
"0.44431603",
"0.44409293",
"0.4439717",
"0.4437034",
"0.44367856",
"0.44362742",
"0.4434984",
"0.4432176",
"0.44272926",
"0.44219798",
"0.4418434",
"0.44135857"
] |
0.8160645
|
0
|
Method that takes a block
|
def block_print
puts "Before the block!"
yield(10)
puts "After the block!"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def with_block(&block)\n end",
"def block?; end",
"def callBlock\n yield\n yield\nend",
"def call_block(&block)\n block.call\nend",
"def blocks; end",
"def blocks; end",
"def blocks; end",
"def block_example(&block)\n does block\n end",
"def i_take_a_block\n yield\nend",
"def blocks() end",
"def block=(_arg0); end",
"def block=(_arg0); end",
"def run_block_proc\n yield\nend",
"def block_node; end",
"def block_node; end",
"def run(&block)\n end",
"def return(&block); end",
"def take_block(&block)\n block.call\nend",
"def take_block(&block)\n block.call\nend",
"def take_block(&block)\n block.call\nend",
"def take_block(&block)\n block.call\nend",
"def take_block(&block)\n block.call\nend",
"def take_block(&block)\n block.call\nend",
"def block_given?() end",
"def callBlock\n yield ,\n end",
"def run_block\n yield\nend",
"def run(&block); end",
"def create_block_object(&block)\n block\nend",
"def process(&block); end",
"def callBlock\n yield # Invokes block\n yield # Invokes block again\nend",
"def call_block \n yield('hello', 99) \nend",
"def call_block \n yield('hello', 99) \nend",
"def test(&block)\n block.call\nend",
"def test(&block)\n block.call\nend",
"def run\n block.call\n end",
"def execute(&block)\n\tblock\nend",
"def execute(&block)\n\tblock\nend",
"def execute(&block)\r\n block\r\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def block_to_proc(&p)\n\tp.call\nend",
"def call_block\n @_block.call(self) if @_block\n end",
"def foo(&block)\n a = 2\n block.call(a)\nend",
"def foo3(&block)\n block.call(1) \nend",
"def perform(&block); end",
"def captured_by_block; end",
"def i_take_an_explicit_block &block\n puts block.inspect\nend",
"def block(_hash)\n raise Sibit::NotSupportedError, 'block() doesn\\'t work here'\n end",
"def block\n true\n end",
"def method_that_takes_a_block(&blk)\n p blk.call(\"hello\")\n p blk.call(\"World!\")\nend",
"def captured_by_block?; end",
"def function\n block.function\n end",
"def block_class() Block; end",
"def execute(&block)\n # block\n block.call\nend",
"def my_method(&my_block)\n puts \"hello method\"\n my_block.call\n return my_block\nend",
"def my_method(&my_block)\n\n puts \"hello method\"\n\n my_block.call\n\n return my_block\n\nend",
"def call_block\n yield('hello', 99)\nend",
"def call_block\n yield('hello', 99)\nend",
"def call_block\n yield('hello', 99)\nend",
"def use_block(obj, &method)\n\tmethod.call\nend",
"def hola &block\n puts block.class.name #esta linea nos dice que esto es un proc\n block.call\nend",
"def block_method_3\n yield\nend",
"def block_method_3\n yield\nend",
"def block_method_3\n yield\nend",
"def block_method_3\n yield\nend",
"def block_method_3\n yield\nend",
"def execute_block(block)\n case\n when block.is_a?(Symbol)\n send(block)\n when block.respond_to?(:call) && (block.arity == 1 || block.arity == -1)\n block.call(self)\n else\n block\n end \n end",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend"
] |
[
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.8161674",
"0.80955875",
"0.77735215",
"0.7747232",
"0.7702454",
"0.7702454",
"0.7702454",
"0.76744866",
"0.76320434",
"0.7627058",
"0.76182127",
"0.76182127",
"0.75652206",
"0.7558993",
"0.7558993",
"0.75466394",
"0.75074506",
"0.7472521",
"0.7472521",
"0.7472521",
"0.7472521",
"0.7472521",
"0.7472521",
"0.74121535",
"0.74005646",
"0.7381865",
"0.7378761",
"0.73628294",
"0.7326444",
"0.7325286",
"0.7306553",
"0.7306553",
"0.73036224",
"0.73036224",
"0.7291244",
"0.7288548",
"0.7288548",
"0.72583383",
"0.7232098",
"0.7232098",
"0.7227941",
"0.7224213",
"0.72192484",
"0.7214847",
"0.7206024",
"0.72042143",
"0.71876115",
"0.7184267",
"0.7182281",
"0.7181119",
"0.71769327",
"0.7175711",
"0.71711457",
"0.71690917",
"0.7168229",
"0.71676433",
"0.7165015",
"0.7165015",
"0.7165015",
"0.7156327",
"0.7150303",
"0.7146476",
"0.7146476",
"0.7146476",
"0.7146476",
"0.7146476",
"0.7136785",
"0.71353674",
"0.71353674",
"0.71353674",
"0.71353674",
"0.71353674",
"0.71353674",
"0.71353674",
"0.71353674",
"0.71353674",
"0.71353674",
"0.71353674",
"0.71353674",
"0.71353674",
"0.71353674"
] |
0.0
|
-1
|
Creates a space based on space_form data and returns new space
|
def call(space_form)
Space.transaction do
space = build_space(space_form)
org_dxs = [space.host_dxorg, space.guest_dxorg].uniq.compact
create_orgs(org_dxs)
space.save!
add_leads(space, space_form)
if space.review?
create_reviewer_cooperative_project(space)
create_reviewer_confidential_space(space, space_form)
else
remove_pfda_admin_user(org_dxs)
end
send_emails(space)
space
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @space_form = Space::Form.new(space: current_team.spaces.new,\n user: current_user,\n attributes: space_params)\n\n authorize @space_form.space, :create?\n\n respond_to do |format|\n if @space_form.save\n format.html do\n redirect_to case\n when @space_form.space.access_control.private? then space_members_path(@space_form.space)\n else space_pages_path(@space_form.space)\n end\n end\n format.json { render :show, status: :created, location: @space_form.space }\n else\n format.html { render :new }\n format.json { render json: @space_form.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @space = Space.new\n end",
"def create\n @space = Space.new(params[:space])\n\n respond_to do |format|\n if @space.save\n format.html { redirect_to @space, notice: 'Space was successfully created.' }\n format.json { render json: @space, status: :created, location: @space }\n else\n format.html { render action: \"new\" }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @space = Space.new(space_params)\n\n respond_to do |format|\n if @space.save\n format.html { redirect_to @space, notice: 'Space was successfully created.' }\n format.json { render action: 'show', status: :created, location: @space }\n else\n format.html { render action: 'new' }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @space = Space.new(space_params)\n @space.user = current_user\n\n if !space_params.has_key? :is_private\n @space.is_private = @space.user.prefers_private?\n if @space.organization\n @space.is_private = @space.is_private || @space.organization.prefers_private?\n end\n end\n\n if @space.save\n render json: SpaceRepresenter.new(@space).to_json(user_options: {current_user_can_edit: true})\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end",
"def create\n @space = Space.new(space_params)\n\n respond_to do |format|\n if @space.save\n format.html { redirect_to root_path, notice: \"Space was successfully created.\" }\n format.json { render :show, status: :created, location: @space }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end",
"def space_params\n params.require(:space).permit(:name, :spaceType, :multiplier, :area)\n end",
"def create_space_with_http_info(create_space_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SpacesApi.create_space ...'\n end\n # verify the required parameter 'create_space_request' is set\n if @api_client.config.client_side_validation && create_space_request.nil?\n fail ArgumentError, \"Missing the required parameter 'create_space_request' when calling SpacesApi.create_space\"\n end\n # resource path\n local_var_path = '/video/v1/spaces'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(create_space_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'SpaceResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['accessToken']\n\n new_options = opts.merge(\n :operation => :\"SpacesApi.create_space\",\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: SpacesApi#create_space\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @newspace = current_user.created_spaces.new(space_params)\n\n respond_to do |format|\n if @newspace.save && update_subscription(@newspace)\n\n current_user.spaces << @newspace # Creates the join record to add the admin to this space\n\n format.html { redirect_to space_members_path(@newspace), notice: 'Space was successfully created.' }\n format.json { render :show, status: :created, location: @newspace }\n else\n format.html { render :new }\n format.json { render json: @mewspace.errors, status: :unprocessable_entity }\n end\n end\n end",
"def call(space_form)\n space = nil\n site_admins = nil\n\n Space.transaction do\n space = build_space(space_form)\n dxorgs = [space.host_dxorg, space.guest_dxorg].uniq.compact\n\n create_orgs(dxorgs)\n space.save!\n add_leads(space, space_form)\n invite_challenge_bot(space) if @for_challenge\n\n create_shared_or_private_project(space)\n\n if space.review?\n create_reviewer_confidential_space(space, space_form)\n elsif space.groups? || space.government? || space.administrator?\n remove_pfda_admin_user(space, space_form)\n elsif space.private_type?\n # Private Spaces have space_id set to it's own id\n space.update(space_id: space.id)\n end\n\n # For private, government and administrator spaces we accept the space automatically\n accept_space(space) if space.private_type? || space.government? || space.administrator?\n\n site_admins = User.site_admins - [space.host_lead]\n create_site_admin_invitations_to_space(space, site_admins) if space.administrator?\n end\n\n send_invitation_emails_to_site_admins(space, site_admins) if space.administrator?\n send_emails(space) unless space.private_type?\n\n space\n end",
"def create\n @spaces_mine = Space.mine(current_user.id)\n raise Space::NotAllowed, '공간 생성 한도를 초과했습니다.' if over_space_limit\n @space = Space.new(space_params.merge(user_id: current_user.id))\n @space.save\n flash.now[:error] = @space.errors.messages[:url] if @space.errors.any?\n broadcast_create_space(@space)\n end",
"def create\n @space = Space.new(space_params)\n @space.user = current_user\n if @space.save\n render json: @space\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end",
"def create\n @safe_space = SafeSpace.new(safe_space_params)\n\n respond_to do |format|\n if @safe_space.save\n format.html { redirect_to @safe_space, notice: 'Safe space was successfully created.' }\n format.json { render :show, status: :created, location: @safe_space }\n else\n format.html { render :new }\n format.json { render json: @safe_space.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @space = Space.new(space_params)\n\n respond_to do |format|\n if @space.save\n format.html { redirect_to spaces_path, notice: 'Friend was successfully created.' }\n format.json { render action: 'show', status: :created, location: @space }\n else\n format.html { render action: 'new' }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @myspace = Myspace.new(params[:myspace])\n\n respond_to do |format|\n if @myspace.save\n format.html { redirect_to @myspace, notice: 'Myspace was successfully created.' }\n format.json { render json: @myspace, status: :created, location: @myspace }\n else\n format.html { render action: \"new\" }\n format.json { render json: @myspace.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n group = Group.find(params[:group_id])\n unless @current_user.id == group.user_id\n return render json: { message: \"You are not permitted to perform this operation.\" }, status: :forbidden\n end\n @space = Space.new(space_params)\n if @space.save\n render json: @space, status: :created\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end",
"def create\n @office_space = OfficeSpace.new(office_space_params)\n\n respond_to do |format|\n if @office_space.save\n format.html { redirect_to @office_space, notice: 'Office space was successfully created.' }\n format.json { render :show, status: :created, location: @office_space }\n else\n format.html { render :new }\n format.json { render json: @office_space.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_space(organization, user)\n space_name = Figaro.env.respond_to?(:cf_space) ? Figaro.env.cf_space : DEFAULT_SPACE_NAME\n space = Space.new.get(space_name, organization)\n space = Space.new.create(space_name, organization) unless space\n\n Space.new.assign_roles(space, user, space_roles) if space_roles.any?\n\n space\n end",
"def set_space\n space_class = Thinkspace::Common::Space\n space_id = ENV['SPACE_ID']\n if space_id.present?\n @space = space_class.find_by(id: space_id)\n raise_error \"Space id #{space_id} not found.\" if space.blank?\n else\n create_space(space_class)\n end\n end",
"def space_params\n params.require(:space).permit(:name, :category, :address, :city, :state, :hours, :phone, :email, :website, :description)\n end",
"def add_space_type(template, clim, building_type, spc_type)\n #OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"Adding space type: #{template}-#{clim}-#{building_type}-#{spc_type}\")\n\n # Get the space type data\n data = self.find_object(self.standards['space_types'], {'template'=>template, 'building_type'=>building_type, 'space_type'=>spc_type})\n if !data\n OpenStudio::logFree(OpenStudio::Warn, 'openstudio.standards.Model', \"Cannot find data for space type: #{template}-#{clim}-#{building_type}-#{spc_type}, will not be created.\")\n return false #TODO change to return empty optional schedule:ruleset?\n end\n \n name = make_name(template, clim, building_type, spc_type)\n\n # Create a new space type and name it\n space_type = OpenStudio::Model::SpaceType.new(self)\n space_type.setName(name)\n\n # Set the standards building type and space type for this new space type\n space_type.setStandardsBuildingType(building_type)\n space_type.setStandardsSpaceType(spc_type)\n\n # Set the rendering color of the space type\n rgb = data['rgb']\n rgb = rgb.split('_')\n r = rgb[0].to_i\n g = rgb[1].to_i\n b = rgb[2].to_i\n rendering_color = OpenStudio::Model::RenderingColor.new(self)\n rendering_color.setRenderingRedValue(r)\n rendering_color.setRenderingGreenValue(g)\n rendering_color.setRenderingBlueValue(b)\n space_type.setRenderingColor(rendering_color)\n\n # Create the schedule set for the space type\n default_sch_set = OpenStudio::Model::DefaultScheduleSet.new(self)\n default_sch_set.setName(\"#{name} Schedule Set\")\n space_type.setDefaultScheduleSet(default_sch_set)\n\n # Lighting\n make_lighting = false\n lighting_per_area = data['lighting_per_area']\n lighting_per_person = data['lighting_per_person']\n unless lighting_per_area == 0 || lighting_per_area.nil? then make_lighting = true end\n unless lighting_per_person == 0 || lighting_per_person.nil? then make_lighting = true end\n\n if make_lighting == true\n\n # Create the lighting definition\n lights_def = OpenStudio::Model::LightsDefinition.new(self)\n lights_def.setName(\"#{name} Lights Definition\")\n lights_frac_to_return_air = data['lighting_fraction_to_return_air']\n lights_frac_radiant = data['lighting_fraction_radiant']\n lights_frac_visible = data['lighting_fraction_visible']\n unless lighting_per_area == 0 || lighting_per_area.nil?\n lights_def.setWattsperSpaceFloorArea(OpenStudio.convert(lighting_per_area, 'W/ft^2', 'W/m^2').get)\n lights_def.setReturnAirFraction(lights_frac_to_return_air)\n lights_def.setFractionRadiant(lights_frac_radiant)\n lights_def.setFractionVisible(lights_frac_visible)\n end\n unless lighting_per_person == 0 || lighting_per_person.nil?\n lights_def.setWattsperPerson(OpenStudio.convert(lighting_per_person, 'W/person', 'W/person').get)\n lights_def.setReturnAirFraction(lights_frac_to_return_air)\n lights_def.setFractionRadiant(lights_frac_radiant)\n lights_def.setFractionVisible(lights_frac_visible)\n end\n\n # Create the lighting instance and hook it up to the space type\n lights = OpenStudio::Model::Lights.new(lights_def)\n lights.setName(\"#{name} Lights\")\n lights.setSpaceType(space_type)\n\n # Additional Lighting\n additional_lighting_per_area = data['additional_lighting_per_area']\n if additional_lighting_per_area != nil\n # Create the lighting definition\n additional_lights_def = OpenStudio::Model::LightsDefinition.new(self)\n additional_lights_def.setName(\"#{name} Additional Lights Definition\")\n additional_lights_def.setWattsperSpaceFloorArea(OpenStudio.convert(additional_lighting_per_area, 'W/ft^2', 'W/m^2').get)\n additional_lights_def.setReturnAirFraction(lights_frac_to_return_air)\n additional_lights_def.setFractionRadiant(lights_frac_radiant)\n additional_lights_def.setFractionVisible(lights_frac_visible)\n\n # Create the lighting instance and hook it up to the space type\n additional_lights = OpenStudio::Model::Lights.new(additional_lights_def)\n additional_lights.setName(\"#{name} Additional Lights\")\n additional_lights.setSpaceType(space_type)\n end\n\n # Get the lighting schedule and set it as the default\n lighting_sch = data['lighting_schedule']\n unless lighting_sch.nil?\n default_sch_set.setLightingSchedule(add_schedule(lighting_sch))\n end\n end\n\n # Ventilation\n\n make_ventilation = false\n ventilation_per_area = data['ventilation_per_area']\n ventilation_per_person = data['ventilation_per_person']\n ventilation_ach = data['ventilation_air_changes']\n unless ventilation_per_area == 0 || ventilation_per_area.nil? then make_ventilation = true end\n unless ventilation_per_person == 0 || ventilation_per_person.nil? then make_ventilation = true end\n unless ventilation_ach == 0 || ventilation_ach.nil? then make_ventilation = true end\n\n\n if make_ventilation == true\n\n # Create the ventilation object and hook it up to the space type\n ventilation = OpenStudio::Model::DesignSpecificationOutdoorAir.new(self)\n ventilation.setName(\"#{name} Ventilation\")\n puts \"#{name}\"\n space_type.setDesignSpecificationOutdoorAir(ventilation)\n ventilation.setOutdoorAirMethod('Sum')\n unless ventilation_per_area.nil? || ventilation_per_area.to_f == 0\n ventilation.setOutdoorAirFlowperFloorArea(OpenStudio.convert(ventilation_per_area, 'ft^3/min*ft^2', 'm^3/s*m^2').get)\n end\n unless ventilation_per_person.nil? || ventilation_per_person.to_f == 0\n ventilation.setOutdoorAirFlowperPerson(OpenStudio.convert(ventilation_per_person, 'ft^3/min*person', 'm^3/s*person').get)\n end\n unless ventilation_ach.nil? || ventilation_ach.to_f == 0\n ventilation.setOutdoorAirFlowAirChangesperHour(ventilation_ach)\n end\n end\n\n # Occupancy\n\n make_people = false\n occupancy_per_area = data['occupancy_per_area']\n unless occupancy_per_area == 0 || occupancy_per_area.nil? then make_people = true end\n\n if make_people == true\n # create the people definition\n people_def = OpenStudio::Model::PeopleDefinition.new(self)\n people_def.setName(\"#{name} People Definition\")\n unless occupancy_per_area == 0 || occupancy_per_area.nil?\n people_def.setPeopleperSpaceFloorArea(OpenStudio.convert(occupancy_per_area / 1000.0, 'people/ft^2', 'people/m^2').get)\n end\n\n # create the people instance and hook it up to the space type\n people = OpenStudio::Model::People.new(people_def)\n people.setName(\"#{name} People\")\n people.setSpaceType(space_type)\n\n # get the occupancy and occupant activity schedules from the library and set as the default\n occupancy_sch = data['occupancy_schedule']\n unless occupancy_sch.nil?\n default_sch_set.setNumberofPeopleSchedule(add_schedule(occupancy_sch))\n end\n occupancy_activity_sch = data['occupancy_activity_schedule']\n unless occupancy_activity_sch.nil?\n default_sch_set.setPeopleActivityLevelSchedule(add_schedule(occupancy_activity_sch))\n end\n\n end\n\n # Infiltration\n\n make_infiltration = false\n infiltration_per_area_ext = data['infiltration_per_exterior_area']\n infiltration_per_area_ext_wall = data['infiltration_per_exterior_wall_area']\n infiltration_ach = data['infiltration_air_changes']\n unless (infiltration_per_area_ext == 0 || infiltration_per_area_ext.nil?) && (infiltration_per_area_ext_wall == 0 || infiltration_per_area_ext_wall.nil?) && (infiltration_ach == 0 || infiltration_ach.nil?) \n then make_infiltration = true\n end\n\n if make_infiltration == true\n\n # Create the infiltration object and hook it up to the space type\n infiltration = OpenStudio::Model::SpaceInfiltrationDesignFlowRate.new(self)\n infiltration.setName(\"#{name} Infiltration\")\n infiltration.setSpaceType(space_type)\n unless infiltration_per_area_ext == 0 || infiltration_per_area_ext.nil?\n infiltration.setFlowperExteriorSurfaceArea(OpenStudio.convert(infiltration_per_area_ext, 'ft^3/min*ft^2', 'm^3/s*m^2').get)\n end\n unless infiltration_per_area_ext_wall == 0 || infiltration_per_area_ext_wall.nil?\n infiltration.setFlowperExteriorWallArea(OpenStudio.convert(infiltration_per_area_ext_wall, 'ft^3/min*ft^2', 'm^3/s*m^2').get)\n end\n unless infiltration_ach == 0 || infiltration_ach.nil?\n infiltration.setAirChangesperHour(infiltration_ach)\n end\n\n # Get the infiltration schedule from the library and set as the default\n infiltration_sch = data['infiltration_schedule']\n unless infiltration_sch.nil?\n default_sch_set.setInfiltrationSchedule(add_schedule(infiltration_sch))\n end\n\n end\n\n # Electric equipment\n\n make_electric_equipment = false\n elec_equip_per_area = data['electric_equipment_per_area']\n elec_equip_frac_latent = data['electric_equipment_fraction_latent']\n elec_equip_frac_radiant = data['electric_equipment_fraction_radiant']\n elec_equip_frac_lost = data['electric_equipment_fraction_lost']\n unless elec_equip_per_area == 0 || elec_equip_per_area.nil? then make_electric_equipment = true end\n\n if make_electric_equipment == true\n\n # Create the electric equipment definition\n elec_equip_def = OpenStudio::Model::ElectricEquipmentDefinition.new(self)\n elec_equip_def.setName(\"#{name} Electric Equipment Definition\")\n unless elec_equip_per_area == 0 || elec_equip_per_area.nil?\n elec_equip_def.setWattsperSpaceFloorArea(OpenStudio.convert(elec_equip_per_area, 'W/ft^2', 'W/m^2').get)\n elec_equip_def.setFractionLatent(elec_equip_frac_latent)\n elec_equip_def.setFractionRadiant(elec_equip_frac_radiant)\n elec_equip_def.setFractionLost(elec_equip_frac_lost)\n end\n\n # Create the electric equipment instance and hook it up to the space type\n elec_equip = OpenStudio::Model::ElectricEquipment.new(elec_equip_def)\n elec_equip.setName(\"#{name} Electric Equipment\")\n elec_equip.setSpaceType(space_type)\n\n # Get the electric equipment schedule from the library and set as the default\n elec_equip_sch = data['electric_equipment_schedule']\n unless elec_equip_sch.nil?\n default_sch_set.setElectricEquipmentSchedule(add_schedule(elec_equip_sch))\n end\n\n end\n\n # Gas equipment\n\n make_gas_equipment = false\n gas_equip_per_area = data['gas_equipment_per_area']\n gas_equip_frac_latent = data['gas_equipment_fraction_latent']\n gas_equip_frac_radiant = data['gas_equipment_fraction_radiant']\n gas_equip_frac_lost = data['gas_equipment_fraction_lost']\n\n unless gas_equip_per_area == 0 || gas_equip_per_area.nil? then make_gas_equipment = true end\n\n if make_gas_equipment == true\n\n # Create the gas equipment definition\n gas_equip_def = OpenStudio::Model::GasEquipmentDefinition.new(self)\n gas_equip_def.setName(\"#{name} Gas Equipment Definition\")\n gas_equip_def.setFractionLatent(gas_equip_frac_latent)\n gas_equip_def.setFractionRadiant(gas_equip_frac_radiant)\n gas_equip_def.setFractionLost(gas_equip_frac_lost)\n unless gas_equip_per_area == 0 || gas_equip_per_area.nil?\n gas_equip_def.setWattsperSpaceFloorArea(OpenStudio.convert(gas_equip_per_area, 'Btu/hr*ft^2', 'W/m^2').get)\n end\n\n # Create the gas equipment instance and hook it up to the space type\n gas_equip = OpenStudio::Model::GasEquipment.new(gas_equip_def)\n gas_equip.setName(\"#{name} Gas Equipment\")\n gas_equip.setSpaceType(space_type)\n\n # Get the gas equipment schedule from the library and set as the default\n gas_equip_sch = data['gas_equipment_schedule']\n unless gas_equip_sch.nil?\n default_sch_set.setGasEquipmentSchedule(add_schedule(gas_equip_sch))\n end\n\n end\n\n thermostat = OpenStudio::Model::ThermostatSetpointDualSetpoint.new(self)\n thermostat.setName(\"#{name} Thermostat\")\n\n heating_setpoint_sch = data['heating_setpoint_schedule']\n unless heating_setpoint_sch.nil?\n thermostat.setHeatingSetpointTemperatureSchedule(add_schedule(heating_setpoint_sch))\n end\n\n cooling_setpoint_sch = data['cooling_setpoint_schedule']\n unless cooling_setpoint_sch.nil?\n thermostat.setCoolingSetpointTemperatureSchedule(add_schedule(cooling_setpoint_sch))\n end\n\n # componentize the space type\n space_type_component = space_type.createComponent\n\n # #TODO make this return BCL component space types?\n #\n # #setup the file names and save paths that will be used\n # file_name = \"nrel_ref_bldg_space_type\"\n # component_dir = \"#{Dir.pwd}/#{component_name}\"\n # osm_file_path = OpenStudio::Path.new(\"#{component_dir}/files/#{file_name}.osm\")\n # osc_file_path = OpenStudio::Path.new(\"#{component_dir}/files/#{file_name}.osc\")\n #\n # #OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"component_dir = #{component_dir}\")\n #\n # OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"creating directories\")\n # FileUtils.rm_rf(component_dir) if File.exists?(component_dir) and File.directory?(component_dir)\n # FileUtils.mkdir_p(component_dir)\n # FileUtils.mkdir_p(\"#{component_dir}/files/\")\n #\n # #save the space type as a .osm\n # #OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"saving osm to #{osm_file_path}\")\n # model.toIdfFile().save(osm_file_path,true)\n #\n # #save the componentized space type as a .osc\n # #OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"saving osc to #{osc_file_path}\")\n # space_type_component.toIdfFile().save(osc_file_path,true)\n #\n # #make the BCL component\n # OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"creating BCL component\")\n # component = BCL::Component.new(component_dir)\n # OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"created uid = #{component.uuid}\")\n #\n # #add component information\n # component.name = component_name\n # component.description = \"This space type represent spaces in typical commercial buildings in the United States. The information to create these space types was taken from the DOE Commercial Reference Building Models, which can be found at http://www1.eere.energy.gov/buildings/commercial_initiative/reference_buildings.html. These space types include plug loads, gas equipment loads (cooking, etc), occupancy, infiltration, and ventilation rates, as well as schedules. These space types should be viewed as starting points, and should be reviewed before being used to make decisions.\"\n # component.source_manufacturer = \"DOE\"\n # component.source_url = \"http://www1.eere.energy.gov/buildings/commercial_initiative/reference_buildings.html\"\n # component.add_provenance(\"dgoldwas\", Time.now.gmtime.strftime('%Y-%m-%dT%H:%M:%SZ'), \"\")\n # component.add_tag(\"Space Types\") # todo: what is the taxonomy string for space type? is there one?\n #\n # #add arguments as attributes\n # component.add_attribute(\"NREL_reference_building_vintage\", template, \"\")\n # component.add_attribute(\"Climate_zone\", clim, \"\")\n # component.add_attribute(\"NREL_reference_building_primary_space_type\", building_type, \"\")\n # component.add_attribute(\"NREL_reference_building_secondary_space_type\", spc_type, \"\")\n #\n # #openstudio type attribute\n # component.add_attribute(\"OpenStudio Type\", space_type.iddObjectType.valueDescription, \"\")\n #\n # #add other attributes\n # component.add_attribute(\"Lighting Standard\", data[\"lighting_standard\"], \"\")\n # component.add_attribute(\"Lighting Primary Space Type\", data[\"lighting_pri_spc_type\"], \"\")\n # component.add_attribute(\"Lighting Secondary Space Type\", data[\"lighting_sec_spc_type\"], \"\")\n #\n # component.add_attribute(\"Ventilation Standard\", data[\"ventilation_standard\"], \"\")\n # component.add_attribute(\"Ventilation Primary Space Type\", data[\"ventilation_pri_spc_type\"], \"\")\n # component.add_attribute(\"Ventilation Secondary Space Type\", data[\"ventilation_sec_spc_type\"], \"\")\n #\n # component.add_attribute(\"Occupancy Standard\", \"NREL reference buildings\", \"\")\n # component.add_attribute(\"Occupancy Primary Space Type\", building_type, \"\")\n # component.add_attribute(\"Occupancy Secondary Space Type\", spc_type, \"\")\n #\n # component.add_attribute(\"Infiltration, Gas Equipment, Electric Equipment, and Schedules Standard\", \"NREL reference buildings\", \"\")\n # component.add_attribute(\"Infiltration, Gas Equipment, Electric Equipment, and Schedules Primary Space Type\", building_type, \"\")\n # component.add_attribute(\"Infiltration, Gas Equipment, Electric Equipment, and Schedules Secondary Space Type\", spc_type, \"\")\n #\n # #add the osm and osc files to the component\n # component.add_file(\"OpenStudio\", \"0.9.3\", osm_file_path.to_s, \"#{file_name}.osm\", \"osm\")\n # component.add_file(\"OpenStudio\", \"0.9.3\", osc_file_path.to_s, \"#{file_name}.osc\", \"osc\")\n #\n # #OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"saving component to #{component_dir}\")\n # component.save_component_xml(component_dir)\n #\n # =e\n # return the space type and the componentized space type\n \n return space_type\n \n end",
"def create\n @space_type = SpaceType.new(space_type_params)\n authorize! :create, @space_type\n\n respond_to do |format|\n if @space_type.save\n format.html { redirect_to @space_type, notice: t('.create_ok') }\n format.json { render action: 'show', status: :created, location: @space_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @space_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def space_params\n params.require(:space).permit(:name, :cover, :access_control).to_h\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space(space_id = params[:id])\n @space = Space.find(space_id)\n end",
"def space_create_with_http_info(account_id, space_create_parameters, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SpacesApi.space_create ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling SpacesApi.space_create\"\n end\n # verify the required parameter 'space_create_parameters' is set\n if @api_client.config.client_side_validation && space_create_parameters.nil?\n fail ArgumentError, \"Missing the required parameter 'space_create_parameters' when calling SpacesApi.space_create\"\n end\n # resource path\n local_var_path = '/accounts/{account_id}/spaces'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\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(space_create_parameters) \n\n # return_type\n return_type = opts[:return_type] || 'Space' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\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: SpacesApi#space_create\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end",
"def space_params\n params.require(:space).permit(:company_name, :description)\n end",
"def space_params\n params.require(:space).permit(:name, :address, :phone, :fax, :website, :country, :postal, :timezone, :currency, :subdomain, :user_id, :plan, \n locations_attributes: [ :name, :address, :city, :state, :postal_code, :country, :timezone, :currency, :tax_rate ])\n end",
"def space_params\n params.require(:space).permit(:name, :description, :url, :is_public, :user_id)\n end",
"def reserve_space space\n return if self.last and self.last.id >= space\n\n o = self.new\n o.id= space\n o.save_without_alter_ego\n o.delete\n return\n end",
"def create_space(create_space_request, opts = {})\n data, _status_code, _headers = create_space_with_http_info(create_space_request, opts)\n data\n end",
"def space_params\n params.require(:space).permit(:calendar_frequency, \n :listing_weekly_price_native, \n :title, :summary,\n :bedrooms, :beds, :bathrooms, :bed_style, :home_style, :room_style, :person_capacity, \n :directions, \n :country_code, :street_address, :apt_ste_bld, :city, :state, :postal_code)\n end",
"def create_personal_space!\n if personal_space\n raise \"Personal space already exists\"\n else\n workflow = Workflow.find_by_id(Option[\"default_personal_space_workflow\"])\n workflow_create_role = Option[\"default_personal_space_owner_role\"]\n workflow_owner_role = Option[\"default_personal_space_creator_role\"]\n item_types = Option[\"default_personal_space_item_types\"].to_s.split(\",\")\n \n raise \"Default Personal Space Workflow not specified in preferences\" unless workflow && workflow_create_role && workflow_owner_role\n \n s = Space.create_with_workflow_and_owners(:code => personal_space_code, :name => \"Personal Space for #{name}\", :workflow => workflow, :enabled => true, :owners => self, :workflow_owner_role => workflow_owner_role, :workflow_create_role => workflow_create_role)\n \n item_types.collect { |it| ItemType.find_by_id(it)}.compact.each do |it|\n s.formats.create!(:item_type => it)\n end\n \n return s\n end\n \n\n end",
"def space_params\n params.require(:space).permit(:title, :space_setting_id, :num_of_people_id, :content, :address, :token,\n :atmosphere_id, :city_id, :price_hour, :price_day, :price_month, :price_year,\n :detailed_ids => [], :user_group_ids => [], :rent_env_ids => [], photos_attributes: [:data] )\n end",
"def space_params\n params.require(:space).permit(:group_id, :start_at, :end_at, :note)\n end",
"def set_space\n @space = Space.friendly.find(params[:id])\n redirect_to root_path unless @space.present?\n end",
"def createSpaceCity\n if !@haveSpaceCity\n others = []\n\n for station in @spaceStations\n if station != @currentStation\n others << station\n end\n end\n\n @currentStation = SpaceCity.new(@currentStation, others)\n @spaceStations[@currentStationIndex] = @currentStation\n @haveSpaceCity = true\n end\n end",
"def create\n space = ParkingSpace.new(user_id: current_user.id,cost: params[:cost], latitude: params[:latitude], longitude: params[:longitude], status: true, address: params[:address])\n space.save\n redirect_to \"/\"\n end",
"def create\n authorization(\"create\")\n\n @sharespace = Sharespace.new(sharespace_params)\n\n respond_to do |format|\n if @sharespace.save\n format.html { redirect_to @sharespace, notice: 'Sharespace was successfully created.' }\n format.json { render :show, status: :created, location: @sharespace }\n else\n format.html { render :new }\n format.json { render json: @sharespace.errors, status: :unprocessable_entity }\n end\n end\n end",
"def space_params\n params.require(:space).permit(:name, :image, :detail, :facility_id, :image_cache, :remove_image)\n end",
"def createSpaceCity\n stations = createSpaceStation\n base = stations[0]\n stations.delete_at(0)\n \n return SpaceCity.new(base,stations)\n end",
"def space_params\n params.require(:space).permit(:name, :description, :user_id, :is_private, graph: graph_structure)\n end",
"def createSpaceCity\n if not @haveSpaceCity\n @currentSpaceStation = SpaceCity.new(@currentSpaceStation, @spaceStations)\n @spaceStations.transformCurrentStation(@currentSpaceStation)\n @haveSpaceCity = true\n else\n @transform = Transformation::NOTRANSFORM\n end\n end",
"def set_space\n @space = @location.spaces.find_by_permalink(params[:space_id])\n raise ActiveRecord::RecordNotFound unless @space\n end",
"def create\n @space = current_user.spaces.build(space_params)\n @space.photos << Photo.where(space_token: @space.token)\n\n respond_to do |format|\n if @space.save\n flash[:success] = \"空间创建成功\"\n format.html { redirect_to @space }\n format.json { render :show, status: :created, location: @space }\n else\n format.html { render :new }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @space_cat = SpaceCat.new(params[:space_cat])\n\n respond_to do |format|\n if @space_cat.save\n format.html { redirect_to @space_cat, notice: 'Space cat was successfully created.' }\n format.json { render json: @space_cat, status: :created, location: @space_cat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @space_cat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spaceship = Spaceship.new(params[:spaceship])\n\n respond_to do |format|\n if @spaceship.save\n format.html { redirect_to @spaceship, notice: 'Spaceship was successfully created.' }\n format.json { render json: @spaceship, status: :created, location: @spaceship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spaceship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def space_params\n params.require(:space).permit(:title, :price, :size, :description, :address, :zipcode, :email, :active, :q, images_attributes: [:id, :file, :space_id])\n end",
"def add_space(space)\n raise \"Object was not an Innodb::Space\" unless space.is_a?(Innodb::Space)\n\n spaces[space.space_id.to_i] = space\n end",
"def office_space_params\n params.require(:office_space).permit(:name, :address, :zip, :city, :description)\n end",
"def create\n @space_cat = SpaceCat.new(space_cat_params)\n\n respond_to do |format|\n if @space_cat.save\n format.html { redirect_to @space_cat, notice: 'Space cat was successfully created.' }\n format.json { render action: 'show', status: :created, location: @space_cat }\n else\n format.html { render action: 'new' }\n format.json { render json: @space_cat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def space(space_id)\n return spaces[space_id] if spaces[space_id]\n\n unless (table_record = data_dictionary.table_by_space_id(space_id))\n raise \"Table with space ID #{space_id} not found\"\n end\n\n add_table(table_record[\"NAME\"])\n\n spaces[space_id]\n end",
"def create\n @space_reservation = SpaceReservation.new(space_reservation_params)\n\n respond_to do |format|\n if @space_reservation.save\n format.html { redirect_to @space_reservation, notice: 'Space reservation was successfully created.' }\n format.json { render :show, status: :created, location: @space_reservation }\n else\n format.html { render :new }\n format.json { render json: @space_reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @espace = Espace.new(espace_params)\n respond_to do |format|\n if @espace.save\n format.html { redirect_to @espace, notice: 'Espace was successfully created.' }\n format.json { render action: 'show', status: :created, location: @espace }\n else\n format.html { render action: 'new' }\n format.json { render json: @espace.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sharespace_params\n params.require(:sharespace).permit(:space_type, :description, :cost, :sharespace_venue_id)\n end",
"def update\n @space_form = Space::Form.new(space: @space,\n user: current_user,\n attributes: space_params)\n\n authorize @space, :update?\n\n respond_to do |format|\n if @space_form.save\n format.html { redirect_to space_pages_path(@space_form.space), notice: 'Space was successfully updated.' }\n format.json { render :show, status: :ok, location: @space_form.space }\n else\n format.html { render :edit }\n format.json { render json: @space_form.errors, status: :unprocessable_entity }\n end\n end\n end",
"def space_type_params\n params.require(:space_type).permit(:name)\n end",
"def set_space\n @space = current_user.spaces.friendly.find(params[:id])\n end",
"def create\n @space_scene = SpaceScene.new(space_scene_params)\n\n respond_to do |format|\n if @space_scene.save\n format.html { redirect_to @space_scene, notice: 'Space scene was successfully created.' }\n format.json { render :show, status: :created, location: @space_scene }\n else\n format.html { render :new }\n format.json { render json: @space_scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @space_amenity = SpaceAmenity.new(space_amenity_params)\n\n respond_to do |format|\n if @space_amenity.save\n format.html { redirect_to @space_amenity, notice: 'Space amenity was successfully created.' }\n format.json { render :show, status: :created, location: @space_amenity }\n else\n format.html { render :new }\n format.json { render json: @space_amenity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def safe_space_params\n params.require(:safe_space).permit(:contact_name, :contact_phone, :address, :suburb, :state, :postcode, :country, :latitude, :longitude, :contact_email)\n end",
"def spacecraft_params\n params.require(:spacecraft).permit(:name, :crew, :lat, :long)\n end",
"def create\n @spacecraft = Spacecraft.new(spacecraft_params)\n\n respond_to do |format|\n if @spacecraft.save\n format.html { redirect_to @spacecraft, notice: 'Spacecraft was successfully created.' }\n format.json { render action: 'show', status: :created, location: @spacecraft }\n else\n format.html { render action: 'new' }\n format.json { render json: @spacecraft.errors, status: :unprocessable_entity }\n end\n end\n end",
"def space_params\n # TODO(matthew): Clean up client so we don't need to nest previous_updated_at within space.\n params.require(:space).permit(:name, :description, :is_private, :previous_updated_at, :organization_id, graph: graph_structure)\n end",
"def create_reviewer_confidential_space(shared_space, space_form)\n space = shared_space.confidential_spaces.create!(\n name: shared_space.name,\n description: shared_space.description,\n space_type: shared_space.space_type,\n cts: shared_space.cts,\n state: shared_space.state,\n host_dxorg: shared_space.host_dxorg,\n restrict_to_template: space_form.restrict_to_template,\n )\n\n project_dxid = api.project_new(\n \"precisionfda-space-#{space.id}-REVIEWER-PRIVATE\",\n billTo: user.billto,\n )[\"id\"]\n\n space.host_project = project_dxid\n space.save!\n\n api.project_invite(\n project_dxid,\n space.host_dxorg,\n DNAnexusAPI::PROJECT_ACCESS_CONTRIBUTE,\n suppressEmailNotification: true,\n suppressAllNotifications: true,\n )\n\n api.project_invite(\n project_dxid,\n Setting.review_app_developers_org,\n DNAnexusAPI::PROJECT_ACCESS_CONTRIBUTE,\n suppressEmailNotification: true,\n suppressAllNotifications: true,\n )\n\n duplicate_space(space, space_form.source_space_id)\n end",
"def create_reviewer_confidential_space(shared_space, space_form)\n space = shared_space.confidential_spaces.create!(\n name: shared_space.name,\n description: shared_space.description,\n space_type: shared_space.space_type,\n cts: shared_space.cts,\n state: shared_space.state,\n host_dxorg: shared_space.host_dxorg,\n restrict_to_template: space_form.restrict_to_template,\n )\n\n project_dxid = api.call(\n \"project\", \"new\",\n name: \"precisionfda-space-#{space.id}-REVIEWER-PRIVATE\",\n billTo: user.billto,\n )[\"id\"]\n\n space.host_project = project_dxid\n space.save!\n\n api.call(\n project_dxid, \"invite\",\n invitee: space.host_dxorg,\n level: \"CONTRIBUTE\",\n suppressEmailNotification: true,\n suppressAllNotifications: true,\n )\n\n api.call(\n project_dxid, \"invite\",\n invitee: Setting.review_app_developers_org,\n level: \"CONTRIBUTE\",\n suppressEmailNotification: true,\n suppressAllNotifications: true,\n )\n\n apply_space_template(space)\n end",
"def create\n @open_space = current_user.open_spaces.new(params[:open_space])\n\n respond_to do |format|\n if (@open_space && @open_space.save)\n format.html { redirect_to(@open_space, :notice => 'Open space was successfully created.') }\n format.xml { render :xml => @open_space, :status => :created, :location => @open_space }\n format.js \n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @open_space.errors, :status => :unprocessable_entity }\n format.js { render :json => @open_space.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @space = Space.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @space }\n end\n end",
"def create\n @space_station = SpaceStation.new(space_station_params)\n\n if @space_station.save\n render json: @space_station, status: :created, location: @space_station\n else\n render json: @space_station.errors, status: :unprocessable_entity\n end\n end",
"def create\n @facility_space = FacilitySpace.new(facility_space_params)\n @facility_space.storage_facility = StorageFacility.find(params[:storage_facility_id])\n # @facility_space.storage_facility = current_storage\n\n respond_to do |format|\n if @facility_space.save\n format.html { redirect_to @facility_space, notice: 'Facility space was successfully created.' }\n format.json { render :show, status: :created, location: @facility_space }\n else\n format.html { render :new }\n format.json { render json: @facility_space.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @space_user = SpaceUser.new(params[:space_user])\n\n respond_to do |format|\n if @space_user.save\n format.html { redirect_to space_users_path, notice: 'Space user was successfully created.' }\n format.json { render json: @space_user, status: :created, location: @space_user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @space_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def space=(space)\n #This is a stub, used for indexing\n end",
"def space_type_params\n params.require(:space_type).permit(\n :name, :short_name, :spaces_count, :notes,\n equipment_items_attributes: [:id, :qty, :notes, :equipment_model_id, :_destroy] )\n end",
"def update_space_type_params\n params.require(:space_type).permit(:id, :name)\n end",
"def create\n new_word = Dinosaurus.new\n \n end",
"def set_default_space\n account = Factory.create :account\n \n Account.current = account\n Space.current = account.spaces.first \nend",
"def set_space_type\n @space_type = SpaceType.find(params[:id])\n end",
"def space_params\n params.require(:space).permit(:main_photo, :title)\n end",
"def create(space_id, entity, opts = {})\n data, _status_code, _headers = create_with_http_info(space_id, entity, opts)\n return data\n end",
"def space_reservation_params\n params.require(:space_reservation).permit(:person_id, :space_id, :reservation_beginning, :reservation_ending, :number_of_people)\n end",
"def space_amenity_params\n params.require(:space_amenity).permit(:amenity_id, :space_id)\n end",
"def create\n @space_picture = SpacePicture.new(space_picture_params)\n\n respond_to do |format|\n if @space_picture.save\n format.html { redirect_to @space_picture, notice: 'Space picture was successfully created.' }\n format.json { render action: 'show', status: :created, location: @space_picture }\n else\n format.html { render action: 'new' }\n format.json { render json: @space_picture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_space(sp)\n @spaces[sp]\n end",
"def set_space_type\n @space_type = SpaceType.find(params[:id])\n end",
"def set_space_type\n @space_type = SpaceType.find(params[:id])\n end",
"def update\n if @space.update(space_params)\n render json: @space, status: :ok\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end",
"def accept_space(space)\n space.active! if space.accepted? # always true for private_type spaces\n space.save!\n end",
"def create\n @game = Game.new(game_params)\n\n @game.save\n\n old_map = Map.find(params[:game][:map_id]) \n @game.map = old_map.dup\n old_map.spaces.each do |old_space|\n new_space = old_space.dup\n @game.map.spaces << new_space\n end\n @game.map.save\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render action: 'show', status: :created, location: @game }\n else\n format.html { render action: 'new' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def space_service_create_with_http_info(entity, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SpaceService.space_service_create ...\"\n end\n # verify the required parameter 'entity' is set\n fail ArgumentError, \"Missing the required parameter 'entity' when calling SpaceService.space_service_create\" if entity.nil?\n # resource path\n local_var_path = \"/space/create\".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;charset=utf-8']\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;charset=utf-8']\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 = @api_client.object_to_http_body(entity)\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 => 'Space')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SpaceService#space_service_create\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def duplicate_space(space, source_space_id)\n return if source_space_id.nil?\n\n source_space = Space.find(source_space_id)\n\n space_copier = CopyService::SpaceCopier.new(api: api, user: user)\n space_copier.copy(space, source_space)\n end",
"def boot_space\n @space = object_with_type Parfait::Space\n @space.classes = make_dictionary\n @space.types = make_dictionary\n Parfait::Space.set_object_space @space\n end",
"def create new_vals, *args\n raise \":create no longer accepts #{new_vals.inspect}\" if new_vals.is_a?(Symbol) \n\n @new_data = new_vals\n\n validate(:ip)\n validate(:pass_word).required('Pass phrase is required.')\n validate(:confirm_pass_word).required(\"Pass phrase confirmation is required.\")\n\n new_vals[:customer] = self\n sn = Screen_Name.create(new_data)\n\n rec = TABLE.\n returning(:id).\n insert({\n pswd_hash: encode_pass_word(clean_data[:pass_word]),\n id: clean_data[:id]\n }).first\n\n c = self.class.new rec\n c\n end"
] |
[
"0.755812",
"0.69455516",
"0.69427603",
"0.6942391",
"0.6913779",
"0.6910277",
"0.6823532",
"0.6768969",
"0.676327",
"0.6729226",
"0.6698937",
"0.6673427",
"0.65308267",
"0.6499143",
"0.6481824",
"0.6397734",
"0.6379258",
"0.63743234",
"0.63512933",
"0.6318011",
"0.62970346",
"0.6265508",
"0.6224844",
"0.6224844",
"0.6224844",
"0.6224844",
"0.6224844",
"0.622442",
"0.6216364",
"0.6210854",
"0.62088597",
"0.62088597",
"0.6187202",
"0.61766595",
"0.6144104",
"0.6109608",
"0.60961676",
"0.6094265",
"0.6067616",
"0.6046414",
"0.6033087",
"0.6027986",
"0.6024687",
"0.5980969",
"0.5976761",
"0.5976637",
"0.5970582",
"0.597041",
"0.596746",
"0.59466267",
"0.5943753",
"0.5892526",
"0.58922714",
"0.58838624",
"0.5879005",
"0.5867645",
"0.5851181",
"0.5843512",
"0.5834457",
"0.5832345",
"0.5809393",
"0.5797122",
"0.5793083",
"0.5786888",
"0.5754429",
"0.57531893",
"0.57453966",
"0.5731146",
"0.5728358",
"0.5727361",
"0.57202667",
"0.5698758",
"0.5690899",
"0.56892574",
"0.5676193",
"0.56708133",
"0.56614625",
"0.56408453",
"0.5624573",
"0.5609931",
"0.5553737",
"0.5534045",
"0.5513075",
"0.5506849",
"0.5481497",
"0.547899",
"0.5477753",
"0.54703027",
"0.5451637",
"0.54498404",
"0.54396534",
"0.5435749",
"0.5435749",
"0.5415389",
"0.54008985",
"0.5391515",
"0.53724307",
"0.53641695",
"0.53407925",
"0.53394365"
] |
0.6158449
|
34
|
Provision Host and Guest orgs
|
def create_orgs(orgs_dxs)
orgs_dxs.each { |dxorg| OrgService::Create.call(api, dxorg) }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def provision\n @logger.notify \"Provisioning OpenStack\"\n\n @hosts.each do |host|\n host[:vmhostname] = generate_host_name\n @logger.debug \"Provisioning #{host.name} (#{host[:vmhostname]})\"\n options = {\n :flavor_ref => flavor(host[:flavor]).id,\n :image_ref => image(host[:image]).id,\n :nics => [ {'net_id' => network(@options[:openstack_network]).id } ],\n :name => host[:vmhostname],\n :user_data => \"#cloud-config\\nmanage_etc_hosts: true\\n\",\n }\n options[:key_name] = key_name(host)\n vm = @compute_client.servers.create(options)\n\n #wait for the new instance to start up\n start = Time.now\n try = 1\n attempts = @options[:timeout].to_i / SLEEPWAIT\n\n while try <= attempts\n begin\n vm.wait_for(5) { ready? }\n break\n rescue Fog::Errors::TimeoutError => e\n if try >= attempts\n @logger.debug \"Failed to connect to new OpenStack instance #{host.name} (#{host[:vmhostname]})\"\n raise e\n end\n @logger.debug \"Timeout connecting to instance #{host.name} (#{host[:vmhostname]}), trying again...\"\n end\n sleep SLEEPWAIT\n try += 1\n end\n\n # Associate a public IP to the server\n # Create if there are no floating ips available\n #\n # Do we already have an address?\n @logger.debug vm.addresses\n address=nil\n begin\n # Here we try and assign an address from a floating IP pool\n # This seems to fail on some implementations (FloatingIpPoolNotFound)\n ip = @compute_client.addresses.find { |ip| ip.instance_id.nil? }\n if ip.nil?\n @logger.debug \"Creating IP for #{host.name} (#{host[:vmhostname]})\"\n ip = @compute_client.addresses.create\n end\n ip.server = vm\n address = ip.ip\n\n rescue Fog::Compute::OpenStack::NotFound\n # Here, we fail to just trying to use an address that's already assigned if there is one\n # There may be better logic, but this worked in the original implementation\n # There might be an argument for checking whether an address is reachable a la\n # port_open? logic in host.rb but maybe race conditions\n\n begin\n if vm.addresses[@options[:openstack_network]]\n address = vm.addresses[@options[:openstack_network]].map{ |network| network['addr'] }.first\n end\n rescue NoMethodError\n @logger.debug \"No current address retrievable from OpenStack data\"\n end\n\n end\n\n raise 'Could not find or assign an address to the instance' unless address\n host[:ip] = address\n\n @logger.debug \"OpenStack host #{host.name} (#{host[:vmhostname]}) assigned ip: #{host[:ip]}\"\n\n #set metadata\n vm.metadata.update({:jenkins_build_url => @options[:jenkins_build_url].to_s,\n :department => @options[:department].to_s,\n :project => @options[:project].to_s })\n @vms << vm\n\n #enable root if user is not root\n enable_root(host)\n\n provision_storage(host, vm)\n end\n\n hack_etc_hosts @hosts, @options\n\n end",
"def provision\n end",
"def provision(vm, node_num)\n node_os = (ENV[\"DISTRO_#{node_num}\"] || DISTRO)\n vm.box = (ENV[\"BOX_#{node_num}\"] || ENV[\"BOX\"] || \"#{BOX_REPO}/#{node_os}\")\n vm.hostname = \"#{PROJECT}-#{node_num}-#{vm.box.gsub(/^.*\\//,\"\")}\"\n vm.network \"private_network\", ip: \"#{NETWORK_PREFIX}.#{100+node_num}\"\n vm.provision \"shell\",\n path: VAGRANT_PROVISION,\n env: { 'HOME' => PROJ_HOME, 'GOPATH' => ENV['GOPATH'], 'BOX' => vm.box }\nend",
"def provision_system(node)\n node.vm.provision :hosts, :sync_hosts => true\n node.vm.provision :ansible do |ansible|\n ansible.playbook = 'ansible/site.yml'\n ansible.become = true\n ansible.verbose = false\n ansible.limit = :all\n ansible.groups = {\n 'master' => [fqdn(1)],\n 'node' => [fqdn(2)]\n }\n end\nend",
"def provision!; end",
"def provision\n attempts = @options[:timeout].to_i / SLEEPWAIT\n start = Time.now\n\n test_group_identifier = \"beaker-#{start.to_i}-\"\n\n # get machineType resource, used by all instances\n machineType = @gce_helper.get_machineType(start, attempts)\n\n # set firewall to open pe ports\n network = @gce_helper.get_network(start, attempts)\n @firewall = test_group_identifier + generate_host_name\n @gce_helper.create_firewall(@firewall, network, start, attempts)\n\n @logger.debug(\"Created Google Compute firewall #{@firewall}\")\n\n\n @hosts.each do |host|\n if host[:image]\n gplatform = host[:image]\n elsif host[:platform]\n gplatform = Platform.new(host[:platform])\n else\n raise('You must specify either :image or :platform, or both as necessary')\n end\n\n img = @gce_helper.get_latest_image(gplatform, start, attempts)\n\n unique_host_id = test_group_identifier + generate_host_name\n\n host['diskname'] = unique_host_id\n disk = @gce_helper.create_disk(host['diskname'], img, start, attempts)\n @logger.debug(\"Created Google Compute disk for #{host.name}: #{host['diskname']}\")\n\n # create new host name\n host['vmhostname'] = unique_host_id\n #add a new instance of the image\n instance = @gce_helper.create_instance(host['vmhostname'], img, machineType, disk, start, attempts)\n @logger.debug(\"Created Google Compute instance for #{host.name}: #{host['vmhostname']}\")\n\n # add metadata to instance, if there is any to set\n mdata = format_metadata\n unless mdata.empty?\n @gce_helper.setMetadata_on_instance(host['vmhostname'], instance['metadata']['fingerprint'],\n mdata,\n start, attempts)\n @logger.debug(\"Added tags to Google Compute instance #{host.name}: #{host['vmhostname']}\")\n end\n\n # get ip for this host\n host['ip'] = instance['networkInterfaces'][0]['accessConfigs'][0]['natIP']\n\n # configure ssh\n default_user = host['user']\n host['user'] = 'google_compute'\n\n copy_ssh_to_root(host, @options)\n enable_root_login(host, @options)\n host['user'] = default_user\n\n # shut down connection, will reconnect on next exec\n host.close\n\n @logger.debug(\"Instance ready: #{host['vmhostname']} for #{host.name}}\")\n end\n end",
"def provision\n ssh_user = machine.ssh_info[:username]\n sync_dir = Vagrant::Openshift::Constants.sync_dir\n ## pause to stabilize environment to try to correct odd sudo error on aws\n sleep 2\n sudo(machine, \"mkdir -p #{sync_dir} && chown -R #{ssh_user}:#{ssh_user} #{sync_dir}\")\n end",
"def provision_storage host, vm\n if host['volumes']\n # Lazily create the volume client if needed\n volume_client_create\n host['volumes'].keys.each_with_index do |volume, index|\n @logger.debug \"Creating volume #{volume} for OpenStack host #{host.name}\"\n\n # The node defintion file defines volume sizes in MB (due to precedent\n # with the vagrant virtualbox implementation) however OpenStack requires\n # this translating into GB\n openstack_size = host['volumes'][volume]['size'].to_i / 1000\n\n # Create the volume and wait for it to become available\n vol = @volume_client.volumes.create(\n :size => openstack_size,\n :display_name => volume,\n :description => \"Beaker volume: host=#{host.name} volume=#{volume}\",\n )\n vol.wait_for { ready? }\n\n # Fog needs a device name to attach as, so invent one. The guest\n # doesn't pay any attention to this\n device = \"/dev/vd#{('b'.ord + index).chr}\"\n vm.attach_volume(vol.id, device)\n end\n end\n end",
"def shell_provisioners_once(vm, host)\n if host.has_key?('shell_once')\n host['shell_once'].each do |script|\n vm.provision \"shell\", inline: script['cmd']\n end\n end\nend",
"def post_provision_configure\n add_stack_to_resource\n link_orchestration_template\n assign_vms_owner\n apply_provisioning_tags\n end",
"def provision_ansible(box, key, ansible_config, vm_config)\n box.vm.provision :ansible_local do |ansible|\n properties = [\n 'ask_become_pass',\n 'ask_sudo_pass',\n 'ask_vault_pass',\n 'force_remote_user',\n 'host_key_checking',\n 'raw_ssh_args'\n ]\n properties.each do | property_name |\n set_instance_variable(ansible_config, ansible, property_name )\n end\n provision_ansible_common(ansible, key, ansible_config, vm_config)\n end\nend",
"def provision\n FileUtils.rm_f('.env')\n FileUtils.ln_s(\"#{compose_dir}/#{Ros.env}.env\", '.env')\n # return unless gem_version_check\n # TODO: make build its own rake task and method\n if options.build\n services.each_pair do |name, config|\n next if config&.enabled.eql? false\n compose(\"build #{name}\")\n end\n return\n end\n if options.initialize\n compose(\"up wait\")\n services.each do |name, config|\n next if config&.enabled.eql? false\n prefix = config.ros ? 'app:' : ''\n compose(\"run --rm #{name} rails #{prefix}ros:db:reset:seed\")\n end\n end\n compose_options = options.daemon ? '-d' : ''\n compose(\"up #{compose_options}\")\n if options.initialize\n %x(cat ros/services/iam/tmp/#{Settings.platform.environment.partition_name}/postman/222_222_222-Admin_2.json)\n end\n end",
"def provision\n Souffle::Log.info \"#{@node.log_prefix} Provisioning node...\"\n provider.provision(@node)\n end",
"def run_provisioner(env)\n env[:provisioner].provision\n end",
"def config_provision(vm, conf)\n vm.provision :shell, run: \"always\", inline: \"setenforce 0\"\n vm.provision :shell, run: \"always\", inline: \"sed -i 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config\"\n vm.provision :shell, run: \"always\", inline: \"yum -y install net-tools expect\"\n vm.provision :shell, run: \"always\", path: \"setrootpasswd.sh\"\n vm.provision :shell, run: \"always\", inline: \"ifup eth1\"\n vm.provision :shell, run: \"always\", inline: \"eval `route -n|awk '{ if ($8 ==\\\"eth0\\\" && $2 != \\\"0.0.0.0\\\") print \\\"route del default gw \\\" $2; }'`\"\n vm.provision :shell, run: \"always\", inline: \"sed -i 's/^#PermitRootLogin/PermitRootLogin/' /etc/ssh/sshd_config\"\n vm.provision :shell, run: \"always\", inline: \"sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config && systemctl restart sshd\"\n #vm.provision :ansible do |ansible|\n # ansible.host_key_checking = false\n # ansible.playbook = \"ansible/playbook.yml\"\n # ansible.verbose = \"vv\"\n # #ansible.extra_vars = {}\n #end\n #vm.provision :shell, :inline => \"cd /opt/devstack; sudo -u ubuntu env HOME=/home/ubuntu ./stack.sh\"\n # interface should match external_interface var in devstack.yml\n #vm.provision :shell, :inline => \"ovs-vsctl add-port br-ex enp0s9\"\n #vm.provision :shell, :inline => \"virsh net-destroy default\"\nend",
"def provision_iscsi_client(config)\n config.vm.provision 'iscsi-client', type: 'shell', inline: <<-SHELL\n yum -y install iscsi-initiator-utils lsscsi\n echo \"InitiatorName=iqn.2015-01.com.whamcloud:disks\" > /etc/iscsi/initiatorname.iscsi\n iscsiadm --mode discoverydb --type sendtargets --portal 10.0.40.10:3260 --discover\n iscsiadm --mode node --targetname iqn.2015-01.com.whamcloud.lu:disks --portal 10.0.40.10:3260 -o update -n node.startup -v automatic\n iscsiadm --mode node --targetname iqn.2015-01.com.whamcloud.lu:disks --portal 10.0.40.10:3260 -o update -n node.conn[0].startup -v automatic\n iscsiadm --mode node --targetname iqn.2015-01.com.whamcloud.lu:disks --portal 10.0.50.10:3260 -o update -n node.startup -v automatic\n iscsiadm --mode node --targetname iqn.2015-01.com.whamcloud.lu:disks --portal 10.0.50.10:3260 -o update -n node.conn[0].startup -v automatic\n systemctl start iscsi\n SHELL\nend",
"def shell_provisioners_always(vm, host)\n if host.has_key?('shell_always')\n host['shell_always'].each do |script|\n vm.provision \"shell\", inline: script['cmd'], run: \"always\"\n end\n end\nend",
"def setup_dns(node)\n # Set up /etc/hosts\n node.vm.provision \"setup-hosts\", :type => \"shell\", :path => \"ubuntu/vagrant/setup-hosts.sh\" do |s|\n s.args = [\"enp0s8\", node.vm.hostname]\n end\n # Set up DNS resolution\n node.vm.provision \"setup-dns\", type: \"shell\", :path => \"ubuntu/update-dns.sh\"\nend",
"def provision_mpath(config)\n config.vm.provision 'mpath', type: 'shell', inline: <<-SHELL\n yum -y install device-mapper-multipath\n cp /usr/share/doc/device-mapper-multipath-*/multipath.conf /etc/multipath.conf\n systemctl start multipathd.service\n systemctl enable multipathd.service\n SHELL\nend",
"def run_provisioner(env, p)\n env[:ui].info(I18n.t(\"vagrant.actions.vm.provision.beginning\",\n :provisioner => p.class))\n\n p.provision\n end",
"def shell_provisioners(vm, host, global)\n if scripts = get_config_parameter(host, global, 'scripts')\n scripts.each do |script|\n vm.provision :shell do |s|\n s.path = script['script']\n s.args = script['args']\n s.name = script['name']\n end\n end\n end\nend",
"def shell_provisioners_always(vm, host)\n if host.key?('shell_always')\n scripts = host['shell_always']\n\n scripts.each do |script|\n vm.provision 'shell', inline: script['cmd'], run: 'always'\n end\n end\nend",
"def configure(vm_config, number)\n vm_config.vm.network \"public_network\", ip: \"192.168.1.24#{number}\"\n vm_config.vm.host_name = \"level0#{number}.seoshop.net\"\n \n vm_config.vm.provision :puppet do |puppet|\n puppet.manifests_path = \"puppet\"\n puppet.module_path = \"puppet/modules\"\n puppet.manifest_file = \"site.pp\"\n end\nend",
"def join_cluster(config)\n\n config.vm.provision \"shell\", inline: <<-SHELL\n sshpass -p 'vagrant' scp -o StrictHostKeyChecking=no vagrant@master:join-command.sh /home/vagrant\n chmod +x /home/vagrant/join-command.sh\n ./join-command.sh \n SHELL\n\nend",
"def begin_provisioning\n @provisioner = Souffle::Provisioner::System.new(@system, @provider)\n end",
"def run_provisioner(env)\n if env[:machine].config.vm.guest == :windows\n case env[:provisioner].class.to_s\n when \"VagrantPlugins::Shell::Provisioner\"\n VagrantPlugins::VagrantHyperV::Provisioner::Shell.new(env).provision_for_windows\n when \"VagrantPlugins::Puppet::Provisioner::Puppet\"\n VagrantPlugins::VagrantHyperV::Provisioner::Puppet.new(env).provision_for_windows\n when \"VagrantPlugins::Chef::Provisioner::ChefSolo\"\n VagrantPlugins::VagrantHyperV::Provisioner::ChefSolo.new(env).provision_for_windows\n end\n else\n original_run_provisioner(env)\n end\n end",
"def create_host_cmd(options,passwd)\n hammer_cmd = \"hammer\"\n if options[:debug] == true\n hammer_cmd = hammer_cmd + \" --debug\"\n end\n if passwd !=nil\n hammer_cmd = hammer_cmd + \" --password #{passwd}\"\n end\n hammer_cmd = hammer_cmd + \" host create --name #{options[:name]}\"\n if options[:build] == true\n hammer_cmd = hammer_cmd + \" --build true\"\n else\n hammer_cmd = hammer_cmd + \" --build false\"\n end\n hammer_cmd = hammer_cmd + \" --hostgroup-id #{options[:host_group]}\"\n hammer_cmd = hammer_cmd + \" --architecture-id #{options[:arch]}\"\n hammer_cmd = hammer_cmd + \" --operatingsystem-id #{options[:os]}\"\n hammer_cmd = hammer_cmd + \" --medium-id #{options[:media]}\"\n hammer_cmd = hammer_cmd + \" --partition-table-id #{options[:ptable]}\"\n hammer_cmd = hammer_cmd + \" --compute-resource-id #{options[:compute_resource]}\"\n hammer_cmd = hammer_cmd + \" --compute-attributes guest_id='#{options[:guest_type]}',cpus=#{options[:cpus]},memory_mb=#{options[:memory]},cluster='#{options[:cluster]}',path='#{options[:path]}',start=#{options[:start]}\"\n if options[:nic_ip] != nil\n hammer_cmd = hammer_cmd + \" --ip #{options[:nic_ip]}\"\n end\n if options[:nic_mac] != nil\n hammer_cmd = hammer_cmd + \" --mac #{options[:nic_mac]}\"\n end\n hammer_cmd = hammer_cmd + \" --interface=compute_type=#{options[:nic_type]},compute_network=#{options[:nic_network]},name=#{options[:name]},primary=true,identifier=#{options[:nic_name]},managed=#{options[:nic_managed]},provision=true\"\n hammer_cmd = hammer_cmd + \" --volume datastore=#{options[:volume_datastore]},size_gb=#{options[:volume_size]},name=#{options[:name]}\"\n\n return hammer_cmd\nend",
"def provision\n method_proxy(:provision)\n\n true\n end",
"def handle_host(config, host, master_ip, bridge)\n config.vm.define host[\"name\"] do |node|\n node.vm.provider \"virtualbox\" do |vb|\n vb.name = host[\"name\"]\n end\n node.vm.box = host[\"box\"]\n node.vm.hostname = host[\"name\"]\n if host[\"private_net\"]\n node.vm.network \"private_network\", ip: host[\"ip\"]\n else\n node.vm.network \"public_network\", bridge: bridge, ip: host[\"ip\"]\n end\n node.vm.provision :salt do |salt|\n # The Salt minion_id config is currently ignored and Salt bootstrap\n # uses one of the hostnames that it finds. This is not necessarily\n # the hostnam set here. It worked on the test box that was used\n # originally that did not have a hostname previously set. But,\n # failed on public boxes that already had set a separate hostname.\n # For now, set it in bootstrap_options.\n #salt.minion_id = \"testminionname\"\n salt.install_type = \"stable\"\n bootstrap_options = \"-D -A #{master_ip} -i #{host[\"name\"]}\"\n salt.minion_key = File.join(KEY_DIR, host[\"name\"]) + \".pem\"\n salt.minion_pub = File.join(KEY_DIR, host[\"name\"]) + \".pub\"\n master_cfg = {}\n if host[\"minions\"]\n # There are relative minions of this node, so set up salt-master and\n # salt-minion. Preseed this nodes master with keys for those minions.\n minion_keys = {}\n host[\"minions\"].each do |minion|\n minion_name = minion[\"name\"]\n minion_keys[minion_name] = File.join(KEY_DIR, \"#{minion_name}.pub\")\n end\n master_cfg[\"syndic_master\"] = master_ip\n salt.seed_master = minion_keys\n salt.install_master = true\n salt.install_syndic = true\n end\n if not master_cfg.empty?\n syndic_cfg = JSON.generate(master_cfg)\n bootstrap_options << \" -J '\" << syndic_cfg << \"'\"\n end\n salt.bootstrap_options = bootstrap_options\n end\n end\n if host[\"minions\"]\n # Now set up any nodes listed as minions to this node.\n host[\"minions\"].each do |minion|\n handle_host(config, minion, host[\"ip\"], bridge)\n end\n end\nend",
"def provision() \n log($logClientMessage, \"Initiating provision\")\n \n config = getUserConfig()\n if !config.nil?\n log($logClientMessage, \"Creating a MongoLab db of type: #{config['plan']}\")\n\n # assemble proper inputs\n @partnerName = 'openshift'\n @partnerPassword = 'password'\n @appId = 'blah'\n @plan = config['plan']\n \n result = doProvision(@partnerName, @partnerPassword, @appId, @plan)\n\n log($logClientMessage, \"Provisioning complete\")\n end\nend",
"def configure_ssh(vm)\n vm.provision \"shell\", inline: <<-SHELL\n mkdir -p /home/vagrant/.ssh\n rm -rf /home/vagrant/.ssh/id_rsa*\n chown vagrant:vagrant /home/vagrant/.ssh\n SHELL\n vm.provision \"file\", source: '~/.ssh/id_rsa', destination: '~/.ssh/id_rsa'\n vm.provision \"file\", source: '~/.ssh/id_rsa.pub', destination: '~/.ssh/id_rsa.pub'\n vm.provision \"file\", source: '~/.ssh/id_rsa.pub', destination: '~/.ssh/authorized_keys'\n vm.provision \"file\", source: '~/.screenrc', destination: '~/' if File.exists? \"~/.screnrc\"\nend",
"def ansible_provision(vm_object)\n vm_object.vm.provision :ansible_local do |ansible|\n ansible.install_mode = \"pip\"\n ansible.version = \"2.3\"\n ansible.playbook = \"provision.yml\"\n # ansible.verbose = \"-vvvv\"\n ansible.extra_vars = {\n :backend => vm_object.vm.hostname\n }\n end\nend",
"def vagrant_provision\n if @env\n puts \"Running vagrant provision.\"\n @env.cli(\"provision\") && FileUtils.touch('.vagrant_last_provisioned')\n else\n puts \"Setting up vagrant environment.\"\n setup_vagrant && FileUtils.touch('.vagrant_last_provisioned')\n end\nend",
"def start_cloud(resource, vm_ips, vm_ip_roles)\n\n puts \"Starting the cloud\"\n \n # SSH keys have already been distributed when machines were monitorized,\n # so we do not have to distribute them again\n \n # Start torque cloud\n return torque_cloud_start(resource, vm_ip_roles)\n\nend",
"def shell_provision(node, command)\n node.vm.provision \"shell\", inline: command\nend",
"def provision\n @hosts.each do | host |\n\n @logger.notify \"Provisioning lxc cotainer #{host}\"\n container = LXC::Container.new(host)\n\n template = host['template']\n arch = host['arch'] || \"amd64\"\n\n # Get template from config and divide it into image and release tag.\n if match = template.match(/(.*):(.*)/)\n image = match.captures[0]\n release = match.captures[1]\n end\n\n begin\n # Creating the lxc\n @logger.notify \"Creating lxc #{host} with #{template}\"\n container.create(\"download\", nil, {}, 0, [\"-d\", \"#{image}\", \"-r\", \"#{release}\", \"-a\", \"#{arch}\"])\n rescue Exception\n @logger.error \"lxc containter with name #{host} is already present, Please remove it before provisioning.\"\n exit\n end\n\n # Config setting, because systemd wont work\n @logger.notify \"Setting up config #{host}\"\n container.set_config_item('lxc.autodev', '1')\n container.set_config_item('lxc.kmsg', '0')\n container.set_config_item('lxc.aa_profile', 'unconfined')\n\n # Mount /lib/modules because lxc centos6 fail, with firewall/iptables error on puppet runs\n # But keeping it under all the lxc\n # under lxc, we need the /lib/modules to be created first\n if release =~ /6/\n system \"mkdir -p /var/lib/lxc/#{host}/rootfs/lib/modules\"\n container.set_config_item('lxc.mount.entry', \"/lib/modules /var/lib/lxc/#{host}/rootfs/lib/modules none bind 0 0\")\n end\n\n # Save the config file\n container.save_config\n\n # Starting the lxc\n @logger.notify \"Starting Lxc #{host}\"\n container.start\n\n sleep 30\n if container.running?\n # Run this command on the newly created lxc\n @logger.notify \"Attaching Lxc to #{host}\"\n container.attach(:wait => true) do\n case host['platform']\n when /ubuntu/, /debian/\n bash(\"apt-key update\")\n bash(\"apt-get update\")\n bash(\"apt-get install --force-yes -y apt-utils\")\n bash(\"apt-get install --force-yes -y wget apt-utils openssh-server openssh-client #{Beaker::HostPrebuiltSteps::DEBIAN_PACKAGES.join(' ')}\")\n bash(\"sed -ri 's/^#?PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config\")\n bash(\"sed -ri 's/^#?PasswordAuthentication .*/PasswordAuthentication yes/' /etc/ssh/sshd_config\")\n bash(\"echo root:#{root_password} | chpasswd\")\n if image =~ /ubuntu/\n bash(\"systemctl restart ssh\")\n end\n if image =~ /debian/\n bash(\"systemctl restart sshd\")\n end\n when /^el-/, /centos/, /fedora/, /redhat/, /eos/\n # HACK to fix lxc issue\n if release =~ /7/\n # /run needs to be fix for centos7 lxc\n system \"cp -fr /var/run/* /run/ && rm -frv /var/run >/dev/null && ln -s /run /var/run\"\n end\n bash(\"yum clean all\")\n bash(\"yum install -y sudo initscripts openssh-server openssh-clients shadow-utils #{Beaker::HostPrebuiltSteps::UNIX_PACKAGES.join(' ')}\")\n bash(\"echo root:#{root_password} | /usr/sbin/chpasswd\")\n bash(\"service sshd start\")\n when /opensuse/, /sles/\n bash(\"zypper -n in openssh #{Beaker::HostPrebuiltSteps::SLES_PACKAGES.join(' ')}\")\n bash(\"ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key\")\n bash(\"ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key\")\n bash(\"sed -ri 's/^#?UsePAM .*/UsePAM no/' /etc/ssh/sshd_config\")\n bash(\"echo root:#{root_password} | chpasswd\")\n else\n # TODO add more platform steps here\n raise \"platform #{host['platform']} not yet supported on lxc\"\n end\n end\n end\n\n host['lxc_container'] = container\n # somehow this is not working in cron\n sleep 30\n ip = container.ip_addresses.join(\",\")\n\n if !ip.empty?\n @logger.notify \"Adding hostname #{host} and ip #{ip} in /etc/hosts\"\n system \"echo \\\"#{ip} #{host}\\\" >> /etc/hosts\"\n end\n\n # Update host metadata\n host['ip'] = ip\n\n # Check whether password is passed or not under ssh hash\n if ! options[:ssh].has_key?(:password)\n ssh_password = { :password => root_password }\n # Append the hash with default \"root:root\" password\n host['ssh'].merge!(ssh_password)\n end\n #hack_etc_hosts @hosts, @options\n end\n end",
"def configure_providers(host,vmcfg)\n providers = [ 'virtualbox', 'vmware_fusion' ]\n vmcfg['vm']['gui'] ||= false\n providers.each do |p|\n host.vm.provider p do |pcfg|\n pcfg.gui = true if vmcfg['vm']['gui']\n end\n begin\n send(\"configure_#{p}\",host,vmcfg)\n rescue NoMethodError\n # do nothing\n end\n end\nend",
"def provision_ssh(args)\n env = config.env.map { |k,v| \"#{k}=#{quote_and_escape(v.to_s)}\" }\n env = env.join(\" \")\n\n command = \"chmod +x '#{config.upload_path}'\"\n command << \" &&\"\n command << \" #{env}\" if !env.empty?\n command << \" #{config.upload_path}#{args}\"\n\n with_script_file do |path|\n # Upload the script to the machine\n @machine.communicate.tap do |comm|\n # Reset upload path permissions for the current ssh user\n info = nil\n retryable(on: Vagrant::Errors::SSHNotReady, tries: 3, sleep: 2) do\n info = @machine.ssh_info\n raise Vagrant::Errors::SSHNotReady if info.nil?\n end\n\n user = info[:username]\n comm.sudo(\"chown -R #{user} #{config.upload_path}\",\n error_check: false)\n\n comm.upload(path.to_s, config.upload_path)\n\n if config.name\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: \"script: #{config.name}\"))\n elsif config.path\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: path.to_s))\n else\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: \"inline script\"))\n end\n\n # Execute it with sudo\n comm.execute(\n command,\n sudo: config.privileged,\n error_key: :ssh_bad_exit_status_muted\n ) do |type, data|\n handle_comm(type, data)\n end\n end\n end\n end",
"def deployEnv(host, env)\n mc = rpcclient \"deploop\"\n\n h = Socket.gethostbyname(host)\n mc.identity_filter \"#{h[1][0]}\"\n mc.progress = false\n\n mc.puppet_environment(:env => env)\n\n mc.disconnect \n end",
"def configure_ssh(vm)\n vm.provision \"shell\", inline: <<-SHELL\n mkdir -p /home/vagrant/.ssh\n rm -rf /home/vagrant/.ssh/id_rsa*\n chown vagrant:vagrant /home/vagrant/.ssh\n SHELL\n vm.provision \"file\", source: '~/.ssh/id_rsa', destination: '~/.ssh/id_rsa'\n vm.provision \"file\", source: '~/.ssh/id_rsa.pub', destination: '~/.ssh/id_rsa.pub'\nend",
"def provision_kubernetes_node(node)\n # Set up kernel parameters, modules and tunables\n node.vm.provision \"setup-kernel\", :type => \"shell\", :path => \"ubuntu/setup-kernel.sh\"\n # Restart\n node.vm.provision :shell do |shell|\n shell.privileged = true\n shell.inline = \"echo Rebooting\"\n shell.reboot = true\n end\n # Set up DNS\n setup_dns node\n # Install cert verification script\n node.vm.provision \"shell\", inline: \"ln -s /vagrant/ubuntu/cert_verify.sh /home/vagrant/cert_verify.sh\"\nend",
"def configure_virtualbox(host,vmcfg)\n host.vm.provider \"virtualbox\" do |pcfg|\n pcfg.memory = vmcfg['vm']['memory'] if vmcfg['vm']['memory']\n pcfg.customize [\"modifyvm\", :id, \"--cpus\", vmcfg['vm']['cpu']] if vmcfg['vm']['cpu'] \n end\nend",
"def provision(node)\n node_inventory = node.inventory\n node_ipaddress_fact = @config.settings[\"target\"][\"ipaddress_fact\"] || \"ipaddress\"\n master_ipaddress_fact = @config.settings[\"master\"][\"ipaddress_fact\"] || \"ipaddress\"\n\n raise \"Could not determine node ip address from fact #{node_ipaddress_fact}\" unless node_inventory[:facts].include?(node_ipaddress_fact)\n\n steps = @config.settings[\"steps\"].keys.select{|s| @config.settings[\"steps\"][s] }\n MCProvision.info(\"Provisioning #{node.hostname} / #{node_inventory[:facts][node_ipaddress_fact]} with steps #{steps.join ' '}\")\n\n\n chosen_master, master_inventory = pick_master_from(@config.settings[\"master\"][\"criteria\"], node_inventory[:facts])\n\n raise \"Could not determine master ip address from fact #{master_ipaddress_fact}\" unless master_inventory[:facts].include?(master_ipaddress_fact)\n master_ip = master_inventory[:facts][master_ipaddress_fact]\n\n MCProvision.info(\"Provisioning node against #{chosen_master.hostname} / #{master_ip}\")\n\n node.lock if @config.settings[\"steps\"][\"lock\"]\n\n node.set_puppet_host(master_ip) if @config.settings[\"steps\"][\"set_puppet_hostname\"]\n\n # Only do certificate management if the node is clean and doesnt already have a cert\n unless node.has_cert?\n @master.clean_cert(node.hostname.downcase) if @config.settings[\"steps\"][\"clean_node_certname\"]\n\n node.send_csr if @config.settings[\"steps\"][\"send_node_csr\"]\n\n @master.sign(node.hostname.downcase) if @config.settings[\"steps\"][\"sign_node_csr\"]\n else\n MCProvision.info(\"Skipping SSL certificate management for node - already has a cert\")\n end\n\n node.bootstrap if @config.settings[\"steps\"][\"puppet_bootstrap_stage\"]\n node.run_puppet if @config.settings[\"steps\"][\"puppet_final_run\"]\n node.unlock if @config.settings[\"steps\"][\"unlock\"]\n node.flag if @config.settings[\"steps\"][\"flag\"]\n @notifier.notify(\"Provisioned #{node.hostname} against #{chosen_master.hostname}\", \"New Node\") if @config.settings[\"steps\"][\"notify\"]\n end",
"def shell_provisioners_always(vm, host, global)\n if scripts = get_config_parameter(host, global, 'scripts_always')\n scripts.each do |script|\n vm.provision :shell, run: \"always\" do |s|\n s.path = script['script']\n s.args = script['args']\n s.name = script['name']\n end\n end\n end\nend",
"def create_vm(vms, vm_type, config)\n vms.each do | vm |\n hostname = vm.get_hostname\n \n # cpu & memory\n cpu = vm.get_cpu\n memory = vm.get_memory\n \n # nat port\n ssh_nat_port = vm.get_ssh_nat_port\n http_nat_port = vm.get_http_nat_port\n novnc_nat_port = vm.get_novnc_nat_port \n \n # list of interfaces\n interfaces = vm.get_interfaces\n bridged_interface = vm.get_bridged_interface\n \n # box info\n box_name = vm.box.name\n box_user = vm.box.user\n box_pass = vm.box.pass\n \n switch_type = vm.switch_type\n switch_ver = vm.switch_ver \n \n # IMPORTANT: use your own link_prefix to avoid duplication error with other vagrant instances\n link_prefix=File.basename(Dir.getwd)\n \n interface_count = interfaces.length\n if bridged_interface != \"\"\n interface_count += 1\n end\n \n config.vm.define \"#{hostname}\" do |cfg|\n cfg.vm.box = box_name\n cfg.vm.boot_timeout = 90\n \n cfg.ssh.username = box_user\n cfg.ssh.password = box_pass\n \n for i in interfaces\n cfg.vm.network \"private_network\", auto_config: false, virtualbox__intnet: \"#{link_prefix}_switch_interface_#{i}\" \n end\n \n # bridged interface to have external network connectivity\n if bridged_interface != \"\"\n cfg.vm.network \"public_network\", auto_config: false, bridge: \"#{bridged_interface}\"\n end\n \n #if switch_type != \"\"\n # cfg.vm.provision :shell, :path => \"../common/install_#{switch_type}_#{switch_ver}.sh\"\n #end\n \n if File.exist?(\"init_node_#{hostname}.sh\")\n cfg.vm.provision :shell, :path => \"init_node_#{hostname}.sh\"\n end\n \n cfg.vm.provider \"virtualbox\" do |v|\n v.cpus = cpu\n v.memory = memory\n v.customize [\"modifyvm\", :id, \"--hpet\", \"on\"]\n \n # 스위칭에 이용하는 인터페이스에 대해서 promiscuous mode를 allow vms로 설정해줌\n for i in 2..(interface_count + 1)\n v.customize [\"modifyvm\", :id, \"--nicpromisc#{i}\", \"allow-all\"] \n end\n v.gui = true\n end\n \n if ssh_nat_port != -1\n cfg.vm.network :forwarded_port, guest: 22, host: \"#{ssh_nat_port}\", id: \"ssh\"\n end\n \n if http_nat_port != -1\n cfg.vm.network :forwarded_port, guest: 80, host: \"#{http_nat_port}\", id: \"http\" \n end\n \n if novnc_nat_port != -1\n cfg.vm.network :forwarded_port, guest: 6080, host: \"#{novnc_nat_port}\", id: \"novnc\" \n end\n \n cfg.vm.synced_folder \"../common\", \"/root/common\", disabled: false\n end\n end\nend",
"def basic_config(vm)\n hosts = NODES.map { |hostname, array| \"#{array[0]} #{hostname}\" }.join(\"\\n\")\n bashrc=\"/home/vagrant/.bashrc\"\n vm.provision \"shell\", inline: <<-SHELL\n if ! grep -q \"git-core\" #{bashrc} ; then \n echo \"customizing ~/bashrc\"\n echo \"\\n\\n# Customizations from Vagrantfile:\" >> #{bashrc}\n echo \"export PS1='\\\\[\\\\033[31;1m\\\\]\\\\h\\\\[\\\\033[0;32m\\\\] \\\\w\\\\[\\\\033[00m\\\\]: '\" >> #{bashrc}\n echo export PATH=\"\\$PATH:/usr/lib/git-core:/home/vagrant/teleport/build\" >> #{bashrc}\n echo export GREP_OPTIONS=\"--color=auto\" >> #{bashrc}\n echo \"alias ll='ls -lh'\" >> #{bashrc}\n echo \"alias tsh='tsh --insecure'\" >> #{bashrc}\n fi\n if ! grep -q \"Teleport\" /etc/hosts ; then \n echo \"# Teleport entries added by Vagrant:\" >> /etc/hosts\n echo -e \"#{hosts}\" >> /etc/hosts\n fi\n mkdir -p /var/lib/teleport\n chown vagrant:vagrant /var/lib/teleport\n SHELL\nend",
"def define_vm config, role, index, ip, memory = 512\n id = (index + 1).to_s.rjust(3, '0')\n config.vm.define \"#{role}_#{id}\" do |box|\n box.vm.customize [ \"modifyvm\", :id, \"--memory\", memory ]\n box.vm.box = \"centos_6_3\"\n box.vm.box_url = \"https://dl.dropbox.com/u/7225008/Vagrant/CentOS-6.3-x86_64-minimal.box\"\n box.vm.network :hostonly, \"192.168.34.#{ip}\", :netmask => \"255.255.255.0\"\n box.vm.host_name = \"#{role.downcase.gsub(/[^a-z0-9]+/, '-')}-#{id}.esi.dev\"\n #box.vm.provision :shell, :path => \"script/bootstrap-vm.sh\"\n box.vm.provision :puppet, :module_path => \"modules\" do |p|\n p.manifests_path = \"manifests\"\n p.manifest_file = \"site.pp\"\n end\n end\nend",
"def provision_ansible_local(box, key, ansible_config, vm_config)\n box.vm.provision :ansible_local do |ansible|\n provision_ansible_common(ansible, key, ansible_config, vm_config)\n properties = [\n 'install',\n 'install_mode',\n 'provisioning_path',\n 'tmp_path',\n 'playbook'\n ]\n properties.each do | property_name |\n set_instance_variable(ansible_config, ansible, property_name )\n end\n end\nend",
"def ansible_provision c\n c.vm.provision \"ansible\" do |ansible|\n ansible.verbose = \"v\"\n ansible.playbook = \"playbook.yml\"\n end\n end",
"def create_pg(one_vnet, esx_host)\n begin\n # Get parameters needed to create the network\n pnics = one_vnet['TEMPLATE/PHYDEV']\n pg_name = one_vnet['TEMPLATE/BRIDGE']\n sw_name = one_vnet['TEMPLATE/VCENTER_SWITCH_NAME']\n mtu = one_vnet['TEMPLATE/MTU']\n vlan_id = one_vnet['VLAN_ID'] || 0\n\n if one_vnet['TEMPLATE/VCENTER_SWITCH_NPORTS']\n nports = one_vnet['TEMPLATE/VCENTER_SWITCH_NPORTS']\n else\n nports = 128\n end\n esx_host.lock # Exclusive lock for ESX host operation\n\n pnics_available = nil\n pnics_available = esx_host.get_available_pnics if pnics\n\n # Get port group if it exists\n pg = esx_host.pg_exists(pg_name)\n\n # Disallow changes of switch name for existing pg\n if pg && esx_host.pg_changes_sw?(pg, sw_name)\n err_msg = 'The port group already exists in this host '\\\n 'for a different vCenter standard switch and '\\\n 'this kind of hange is not supported.'\n raise CreateNetworkError, err_msg\n end\n\n # Pg does not exist\n if !pg\n # Get standard switch if it exists\n vs = esx_host.vss_exists(sw_name)\n\n if !vs\n sw_name = esx_host.create_vss(sw_name,\n pnics,\n nports,\n mtu,\n pnics_available)\n end\n\n new_pg = esx_host.create_pg(pg_name, sw_name, vlan_id)\n else\n err_msg = \"Port group #{pg_name} already exists\"\n raise CreateNetworkError, err_msg\n end\n new_pg\n ensure\n esx_host.unlock if esx_host # Remove lock\n end\nend",
"def provision_chef_client(box, key, chef_config, vm_config)\n box.vm.provision \"chef_client\" do |chef|\n set_instance_variable(chef_config, chef, 'chef_server_url')\n set_instance_variable(chef_config, chef, 'validation_key_path')\n set_instance_variable(chef_config, chef, 'delete_node', true)\n set_instance_variable(chef_config, chef, 'delete_client', true)\n provision_chef_common(chef, key, chef_config, vm_config)\n end\nend",
"def set_hostname(server)\r\n\tserver.vm.provision 'shell', inline: \"hostname #{server.vm.hostname}\"\r\nend",
"def create_hostfile(config)\n open('hosts', 'w') do |f|\n f.puts <<-__EOF\n127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4\n::1 localhost localhost.localdomain localhost6 localhost6.localdomain6\n\n10.0.10.10 device-scanner1.local device-scanner1\n10.0.10.11 device-scanner2.local device-scanner2\n10.0.30.10 device-aggregator.local device-aggregator\n10.0.40.10 iscsi.local iscsi\n10.0.50.10 iscsi2.local iscsi2\n __EOF\n end\n\n config.vm.provision 'shell', inline: 'cp -f /vagrant/hosts /etc/hosts'\nend",
"def stdopt(\n config, hostname:, cpus: 1, memory_mb: 1024, box: \"ubuntu/focal64\"\n)\n config.vm.box = box\n config.vm.hostname = hostname\n\n config.ssh.forward_agent = true\n\n config.vm.synced_folder \".\", \"/host_share\"\n\n config.vm.provider \"virtualbox\" do |vbox|\n vbox.linked_clone = true\n vbox.cpus = cpus\n vbox.memory = memory_mb\n # Force allocation of all specified VM memory at start. Change the 1 below\n # to 0 to allow for \"as needed allocation\".\n vbox.customize [\"setextradata\", :id, \"VBoxInternal/RamPreAlloc\", 1]\n end\nend",
"def create\n begin\n enterMaintenanceMode\n rescue\n Puppet.err 'Could not find Host system.Either Host is not exist or disconnected'\n end\n end",
"def enable_root(host)\n host['ssh'] = {:password => host['instance'].id}\n @logger.notify(\"netscaler: nsroot password is #{host['instance'].id}\")\n #if host['user'] != 'root'\n # host.exec(Command.new(\"modify sys db systemauth.disablerootlogin value false\"), :acceptable_exit_codes => [0,1])\n # for tries in 1..10\n # begin\n # #This command is problematic as the netscaler is not always done loading\n # if host.exec(Command.new(\"modify sys global-settings gui-setup disabled\"), :acceptable_exit_codes => [0,1]).exit_code == 0 and host.exec(Command.new(\"save sys config\"), :acceptable_exit_codes => [0,1]).exit_code == 0\n # backoff_sleep(tries)\n # break\n # elsif tries == 10\n # raise \"Instance was unable to be configured\"\n # end\n # rescue Beaker::Host::CommandFailure => e\n # @logger.debug(\"Instance not yet configured (#{e})\")\n # end\n # backoff_sleep(tries)\n # end\n # host['user'] = 'root'\n # host.close\n # sha256 = Digest::SHA256.new\n # password = sha256.hexdigest((1..50).map{(rand(86)+40).chr}.join.gsub(/\\\\/,'\\&\\&'))\n # host['ssh'] = {:password => password}\n # host.exec(Command.new(\"echo -e '#{password}\\\\n#{password}' | tmsh modify auth password admin\"))\n # @logger.notify(\"netscaler: Configured admin password to be #{password}\")\n # host.close\n #end\n end",
"def vm(config, name, *roles)\n roles << name\n config.vm.define name do |m|\n m.vm.host_name = name\n\n #m.vm.provision :shell, :inline => \"apt-get update\"\n #m.vm.provision :shell, :inline => \"apt-get upgrade -y\"\n m.vm.provision :puppet, :module_path => \"modules\" do |puppet|\n puppet.manifests_path = \"manifests\"\n puppet.manifest_file = \"site.pp\"\n\n puppet.facter = {}\n ENV.each do |key, value|\n next unless key =~ /^FACTER_/\n puppet.facter[key.gsub(/^FACTER_/, \"\")] = value\n end\n puppet.facter[\"roles\"] = roles.join(\",\")\n end\n end\nend",
"def set_hostname(server)\n server.vm.provision 'shell', inline: \"hostname #{server.vm.hostname}\"\nend",
"def file_provisioners(vm, host, global)\n if fps = get_config_parameter(host, global, 'file_provisioning')\n fps.each do |fp|\n vm.provision :file, source: fp['source'], destination: fp['destination']\n end\n end\nend",
"def inline_shell_provisioners(vm, host, global)\n if scripts = get_config_parameter(host, global, 'inline_shell')\n scripts.each do |script|\n vm.provision :shell do |s|\n s.inline = script['inline']\n s.args = script['args']\n s.name = script['name']\n end\n end\n end\nend",
"def create_esb_server (config, hostname, ip1, ip2)\n config.vm.define hostname do |esb|\n esb.vm.provider \"virtualbox\" do |provider|\n provider.customize [\"modifyvm\", :id, \"--memory\", 2048]\n end\n\n esb.vm.network \"private_network\", ip: ip1\n esb.vm.host_name = hostname\n\n esb.vm.network \"private_network\", ip: ip2\n end\nend",
"def provision(blueprint)\n @blueprint = blueprint\n # return if project_data_path.join('Vagrantfile').exist?\n File.open(project_data_path.join('Vagrantfile'), 'w') { |f| f.write(template_contents) }\n vagrant_group_vars_path.mkpath unless vagrant_group_vars_path.exist?\n File.open(vagrant_group_vars_path.join('db_instance.yml'), 'w') { |f| f.write(ansible_db_instance_vars.to_yaml) }\n end",
"def execute\n log.info 'Creating the Basic VM'\n placement_spec = VMPlacementHelper.get_placementspec_vm(service_manager.vapi_config, datacenter_name, folder_name, datastore_name)\n standard_network = NetworkHelper.get_standard_network_mapping(service_manager.vapi_config, @datacenter_name, standard_portgroup_name)\n boot_disk = VCENTER_HARDWARE_DISK_CLASS::CreateSpec.new('type' => VCENTER_HARDWARE_DISK_CLASS::HostBusAdapterType::SCSI,\n 'scsi' => VCENTER_HARDWARE_MODULE::ScsiAddressSpec.new('bus'=>0,'unit'=>0),\n 'new_vmdk' => VCENTER_HARDWARE_DISK_CLASS::VmdkCreateSpec.new() )\n data_disk = VCENTER_HARDWARE_DISK_CLASS::CreateSpec.new('new_vmdk' => VCENTER_HARDWARE_DISK_CLASS::VmdkCreateSpec.new())\n ethernet_nic_0 = VCENTER_HARDWARE_ETHERNET_CLASS::CreateSpec.new('start_connected' => true,\n 'backing' => VCENTER_HARDWARE_ETHERNET_CLASS::BackingSpec.new(\n 'type' => VCENTER_HARDWARE_ETHERNET_CLASS::BackingType::STANDARD_PORTGROUP,\n 'network' => standard_network))\n boot_device_order = [VCENTER_HARDWARE_BOOT_DEVICE_CLASS::EntryCreateSpec.new('type' => VCENTER_HARDWARE_BOOT_DEVICE_CLASS::Type::ETHERNET),\n VCENTER_HARDWARE_BOOT_DEVICE_CLASS::EntryCreateSpec.new('type' => VCENTER_HARDWARE_BOOT_DEVICE_CLASS::Type::DISK)]\n vm_create_spec = VCENTER_VM_CLASS::CreateSpec.new('name' => vm_name,\n 'guest_OS' => VCENTER_VM_GUESTOS_CLASS::WINDOWS_8_64,\n 'placement' => placement_spec,\n 'disks' => [boot_disk, data_disk],\n 'nics' => [ethernet_nic_0],\n 'boot_devices' => boot_device_order)\n log.info 'The CreateVM Spec is '\n #Pretty print the create spec of the VM.\n pp vm_create_spec\n vm_id = vm_svc.create(vm_create_spec)\n log.info \"Created vm #{vm_name} with the VM Identifier #{vm_id}\"\n end",
"def generate_deployment_file(provision)\n @hosts = provision.info_objects('hosts')\n end",
"def puppet_client(vmdef, vmobj)\n # Start with the basics\n basic(vmdef,vmobj)\n\n puppet_server = vmobj[\"pup_server\"]\n puppet_environment = vmobj[\"pup_env\"]\n\n # Set the puppet server\n vmdef.vm.provision \"shell\",\n inline: \"puppet config set server #{puppet_server}\"\n\n # Set the puppet environment\n vmdef.vm.provision \"shell\",\n inline: \"puppet config set --section agent environment #{puppet_environment}\"\n\n # Use a local puppetmaster\n vmdef.vm.provision 'puppet_server' do |puppet|\n puppet.puppet_server = puppet_server\n puppet.options = '--test'\n end\n\n # Remove puppet certificate on destroy\n # NOTE: this requires that you're able to run this sudo command\n # without supplying a password. This is left for demonstration\n # purposes\n vmdef.trigger.after :destroy do |trigger|\n trigger.info = \"Cleaning node #{vmdef.vm.hostname}.localdomain from #{puppet_server}\"\n trigger.run = {\n inline: \"ssh #{puppet_server} sudo puppet node clean #{vmdef.vm.hostname}.localdomain\"\n }\n end\n vmdef.trigger.before :up do |trigger|\n hostname = vmdef.vm.hostname\n trigger.info = \"Starting up #{hostname}\"\n end\nend",
"def boot_openstack_inception_vm\n say \"\" # glowing whitespace\n\n unless settings[\"inception\"] && settings[\"inception\"][\"server_id\"]\n username = \"ubuntu\"\n say \"Provisioning server for inception VM...\"\n settings[\"inception\"] ||= {}\n\n # Select OpenStack flavor\n if settings[\"inception\"][\"flavor_id\"]\n inception_flavor = fog_compute.flavors.find { |f| f.id == settings[\"inception\"][\"flavor_id\"] }\n settings[\"inception\"][\"flavor_id\"] = nil if inception_flavor.nil?\n end\n unless settings[\"inception\"][\"flavor_id\"]\n say \"\"\n hl.choose do |menu|\n menu.prompt = \"Choose OpenStack flavor: \"\n fog_compute.flavors.each do |flavor|\n menu.choice(flavor.name) do\n inception_flavor = flavor\n settings[\"inception\"][\"flavor_id\"] = inception_flavor.id\n save_settings!\n end\n end\n end\n end\n say \"\"\n confirm \"Using flavor #{inception_flavor.name} for Inception VM\"\n\n # Select OpenStack image\n if settings[\"inception\"][\"image_id\"]\n inception_image = fog_compute.images.find { |i| i.id == settings[\"inception\"][\"image_id\"] }\n settings[\"inception\"][\"image_id\"] = nil if inception_image.nil?\n end\n unless settings[\"inception\"][\"image_id\"]\n say \"\"\n hl.choose do |menu|\n menu.prompt = \"Choose OpenStack image (Ubuntu): \"\n fog_compute.images.each do |image|\n menu.choice(image.name) do\n inception_image = image\n settings[\"inception\"][\"image_id\"] = inception_image.id\n save_settings!\n end\n end\n end\n end\n say \"\"\n confirm \"Using image #{inception_image.name} for Inception VM\"\n\n key_name = settings[\"inception\"][\"key_pair\"][\"name\"]\n\n # Boot OpenStack server\n server = fog_compute.servers.create(\n :name => \"Inception VM\",\n :key_name => key_name,\n :private_key_path => inception_vm_private_key_path,\n :flavor_ref => inception_flavor.id,\n :image_ref => inception_image.id,\n :security_groups => [settings[\"inception\"][\"security_group\"]],\n :username => username\n )\n server.wait_for { ready? }\n unless server\n error \"Something mysteriously cloudy happened and fog could not provision a VM. Please check your limits.\"\n end\n\n settings[\"inception\"].delete(\"create_new\")\n settings[\"inception\"][\"server_id\"] = server.id\n settings[\"inception\"][\"username\"] = username\n save_settings!\n end\n\n server ||= fog_compute.servers.get(settings[\"inception\"][\"server_id\"])\n\n unless settings[\"inception\"][\"ip_address\"]\n say \"Provisioning IP address for inception VM...\"\n ip_address = acquire_ip_address\n associate_ip_address_with_server(ip_address, server)\n\n settings[\"inception\"][\"ip_address\"] = ip_address\n save_settings!\n end\n\n # TODO: Hack\n unless server.public_ip_address\n server.addresses[\"public\"] = [settings[\"inception\"][\"ip_address\"]]\n end\n unless server.private_key_path\n server.private_key_path = inception_vm_private_key_path\n end\n server.username = settings[\"inception\"][\"username\"]\n Fog.wait_for(60) { server.sshable? }\n\n unless settings[\"inception\"][\"disk_size\"]\n disk_size = prompt_for_disk_space(\"Inception VM\", DEFAULT_INCEPTION_VOLUME_SIZE)\n device = \"/dev/vdc\"\n provision_and_mount_volume(server, disk_size, device)\n\n settings[\"inception\"][\"disk_size\"] = disk_size\n settings[\"inception\"][\"disk_device\"] = device\n save_settings!\n end\n\n # settings[\"inception\"][\"host\"] is used externally to determine\n # if an inception VM has been assigned already; so we leave it\n # until last in this method to set this setting.\n # This way we can always rerun the CLI and rerun this method\n # and idempotently get an inception VM\n unless settings[\"inception\"][\"host\"]\n settings[\"inception\"][\"host\"] = settings[\"inception\"][\"ip_address\"]\n save_settings!\n end\n\n confirm \"Inception VM has been created\"\n display_inception_ssh_access\n end",
"def provision_execute(s, commands)\n errors = []\n return errors if (commands.nil? or commands.empty?)\n \n if (!get_field(\"cloud_ips\").nil? and !get_field(\"cloud_ips\").empty?)\n host = get_field(\"cloud_ips\")[0]\n elsif (!get_field(\"cloud_private_ips\").nil? and !get_field(\"cloud_private_ips\").empty?)\n host = get_field(\"cloud_private_ips\")[0]\n else\n msg = \"No IP address associated to the machine #{host} - cannot run SSH command\"\n errors << msg\n log_output(msg, :info)\n return errors\n end\n \n ssh_password = get_field('ssh_password')\n ssh_options = {}\n msg = \"Running SSH Commands On New Machine #{s.username}@#{host}\"\n msg_options = {}\n if (ssh_password and !ssh_password.empty?)\n ssh_options[:password] = ssh_password\n msg_options[:password] = \"*\" * ssh_password.size\n end\n msg_options[:private_key_path] = s.private_key_path if s.private_key_path\n msg_options[:private_key] = mask_private_key(s.private_key.strip) if s.private_key # show only last 5 chars\n log_output(\"#{msg} using #{msg_options}: #{commands.join(\", \")}\", :info)\n\n for i in 1..10\n begin\n log_output(\"[#{host}] Running Commands:\\n #{commands.join(\"\\n \")}\\n\")\n responses = s.ssh(commands, ssh_options) do |data, extended_data|\n write_output(data, :buffer => true) unless data.empty? #stdout\n write_output(extended_data, :buffer => true) unless extended_data.empty? #stderr\n end\n\n responses.each do |result|\n if result.status != 0\n msg = \"[#{host}] Command '#{result.command}' failed with status #{result.status}\"\n errors << msg\n log_output(msg, :info)\n end\n end unless responses.nil?\n break\n rescue Errno::EHOSTUNREACH, Timeout::Error, Errno::ECONNREFUSED, Errno::ETIMEDOUT, Net::SSH::Disconnect => e\n log_output(\"[#{host}] Try #{i} - failed to connect: #{e}, retrying...\", :info)\n if i+1 > 10\n msg = \"[#{host}] Could not connect to remote machine after 10 attempts\"\n errors << msg\n log_output(msg, :warn)\n else\n sleep 5\n next\n end\n rescue Net::SSH::AuthenticationFailed => e\n log_output(\"[#{host}] Try #{i} - failed to connect: authentication failed for user #{e.message}, retrying...\", :info)\n if i+1 > 10\n msg = \"[#{host}] Could not connect to remote machine after 10 attempts, authentication failed for user #{e.message}\"\n errors << msg\n log_output(msg, :warn)\n else\n sleep 5\n next\n end\n end\n end\n return errors\n end",
"def virtual_guest_template\n template = {\n \"startCpus\" => @cores.to_i,\n \"maxMemory\" => @memory.to_i * 1024, # we let the user specify memory in GB, but the API expects maxMemory in MB.\n \"hostname\" => @hostname,\n \"domain\" => @domain,\n\n # Note : for the values below, we want to use the constants \"true\" and \"false\" not nil\n # the nil value (while false to Ruby) will not translate to XML properly\n \"localDiskFlag\" => !!@use_local_disk,\n \"hourlyBillingFlag\" => !!@hourly\n }\n\n template['dedicatedAccountHostOnlyFlag'] = true if @dedicated_host_only\n template['privateNetworkOnlyFlag'] = true if @private_network_only\n\n template['datacenter'] = {\"name\" => @datacenter.name} if @datacenter\n template['userData'] = [{'value' => @user_metadata}] if @user_metadata\n template['networkComponents'] = [{'maxSpeed'=> @max_port_speed}] if @max_port_speed\n template['postInstallScriptUri'] = @provision_script_URI.to_s if @provision_script_URI\n template['postInstallScriptUri'] = @provision_script_uri.to_s if @provision_script_uri\n template['primaryNetworkComponent'] = { \"networkVlan\" => { \"id\" => @public_vlan_id.to_i } } if @public_vlan_id\n template['primaryBackendNetworkComponent'] = { \"networkVlan\" => {\"id\" => @private_vlan_id.to_i } } if @private_vlan_id\n template['sshKeys'] = @ssh_key_ids.collect { |ssh_key_id| {'id'=> ssh_key_id.to_i } } if @ssh_key_ids\n template['supplementalCreateObjectOptions'] = @supplementalCreateObjectOptions if @supplementalCreateObjectOptions\n\n if @image_template\n template['blockDeviceTemplateGroup'] = {\"globalIdentifier\" => @image_template.global_id}\n elsif @os_reference_code\n template['operatingSystemReferenceCode'] = @os_reference_code\n end\n\n if @disks && !@disks.empty?\n template['blockDevices'] = []\n\n # According to the documentation for +createObject+,\n # device number 1 is reserved for the SWAP disk of the computing instance.\n # So we assign device 0 and then assign the rest starting at index 2.\n @disks.each_with_index do |disk, index|\n device_id = (index >= 1) ? index + 1 : index\n template['blockDevices'].push({\"device\" => \"#{device_id}\", \"diskImage\" => {\"capacity\" => disk}})\n end\n end\n\n template\n end",
"def provision_winssh(args)\n with_script_file do |path|\n # Upload the script to the machine\n @machine.communicate.tap do |comm|\n env = config.env.map{|k,v| comm.generate_environment_export(k, v)}.join\n upload_path = config.upload_path.to_s\n if File.extname(upload_path).empty?\n remote_ext = @machine.config.winssh.shell == \"powershell\" ? \"ps1\" : \"bat\"\n upload_path << \".#{remote_ext}\"\n end\n if remote_ext == \"ps1\"\n # Copy powershell_args from configuration\n shell_args = config.powershell_args\n # For PowerShell scripts bypass the execution policy unless already specified\n shell_args += \" -ExecutionPolicy Bypass\" if config.powershell_args !~ /[-\\/]ExecutionPolicy/i\n # CLIXML output is kinda useless, especially on non-windows hosts\n shell_args += \" -OutputFormat Text\" if config.powershell_args !~ /[-\\/]OutputFormat/i\n command = \"#{env}\\npowershell #{shell_args} #{upload_path}#{args}\"\n else\n command = \"#{env}\\n#{upload_path}#{args}\"\n end\n\n # Reset upload path permissions for the current ssh user\n info = nil\n retryable(on: Vagrant::Errors::SSHNotReady, tries: 3, sleep: 2) do\n info = @machine.ssh_info\n raise Vagrant::Errors::SSHNotReady if info.nil?\n end\n\n comm.upload(path.to_s, upload_path)\n\n if config.name\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: \"script: #{config.name}\"))\n elsif config.path\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: path.to_s))\n else\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: \"inline script\"))\n end\n\n # Execute it with sudo\n comm.execute(\n command,\n sudo: config.privileged,\n error_key: :ssh_bad_exit_status_muted\n ) do |type, data|\n handle_comm(type, data)\n end\n end\n end\n end",
"def provision_winrm(args)\n if @machine.guest.capability?(:wait_for_reboot)\n @machine.guest.capability(:wait_for_reboot)\n end\n\n with_script_file do |path|\n @machine.communicate.tap do |comm|\n # Make sure that the upload path has an extension, since\n # having an extension is critical for Windows execution\n upload_path = config.upload_path.to_s\n if File.extname(upload_path) == \"\"\n upload_path += File.extname(path.to_s)\n end\n\n # Upload it\n comm.upload(path.to_s, upload_path)\n\n # Build the environment\n env = config.env.map { |k,v| \"$env:#{k} = #{quote_and_escape(v.to_s)}\" }\n env = env.join(\"; \")\n\n # Calculate the path that we'll be executing\n exec_path = upload_path\n exec_path.gsub!('/', '\\\\')\n exec_path = \"c:#{exec_path}\" if exec_path.start_with?(\"\\\\\")\n\n # Copy powershell_args from configuration\n shell_args = config.powershell_args\n\n # For PowerShell scripts bypass the execution policy unless already specified\n shell_args += \" -ExecutionPolicy Bypass\" if config.powershell_args !~ /[-\\/]ExecutionPolicy/i\n\n # CLIXML output is kinda useless, especially on non-windows hosts\n shell_args += \" -OutputFormat Text\" if config.powershell_args !~ /[-\\/]OutputFormat/i\n\n command = \"\\\"#{exec_path}\\\"#{args}\"\n if File.extname(exec_path).downcase == \".ps1\"\n command = \"powershell #{shell_args.to_s} -file #{command}\"\n else\n command = \"cmd /q /c #{command}\"\n end\n\n # Append the environment\n if !env.empty?\n command = \"#{env}; #{command}\"\n end\n\n if config.name\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: \"script: #{config.name}\"))\n elsif config.path\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.runningas\",\n local: config.path.to_s, remote: exec_path))\n else\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: \"inline PowerShell script\"))\n end\n\n # Execute it with sudo\n comm.sudo(command, { elevated: config.privileged, interactive: config.powershell_elevated_interactive }) do |type, data|\n handle_comm(type, data)\n end\n end\n end\n end",
"def register_vbox_vm(client_name,client_os)\n message = \"Registering:\\tVM \"+client_name\n command = \"VBoxManage createvm --name \\\"#{client_name}\\\" --ostype \\\"#{client_os}\\\" --register\"\n execute_command(message,command)\n return\nend",
"def config_local_docker_registry(config)\n\n config.vm.provision \"shell\", inline: <<-SHELL\n mkdir /etc/docker/certs.d/util.io\n sshpass -p 'vagrant' scp -o StrictHostKeyChecking=no util.io:/etc/docker/certs.d/util.io/ca.crt /etc/docker/certs.d/util.io\n docker login --username=testuser --password=testpassword util.io\n SHELL\n\nend",
"def create_vm(vms, vm_type, config)\n vms.each do | vm |\n hostname = vm.get_hostname\n \n # cpu & memory\n cpu = vm.get_cpu\n memory = vm.get_memory\n \n # nat port\n nat_map = vm.get_nat_map\n \n # list of interfaces\n interfaces = vm.get_interfaces\n bridged_interface = vm.get_bridged_interface\n \n # synced_folder\n synced_folders = vm.get_synced_folders\n \n # box info\n box_name = vm.box.name\n box_user = vm.box.user\n box_pass = vm.box.pass\n \n switch_type = vm.switch_type\n switch_ver = vm.switch_ver \n \n link_prefix=Link.instance.link_prefix\n \n interface_count = interfaces.length\n if bridged_interface != \"\"\n interface_count += 1\n end\n \n config.vm.define \"#{hostname}\" do |cfg|\n cfg.vm.box = box_name\n cfg.vm.boot_timeout = 90\n \n cfg.ssh.username = box_user\n cfg.ssh.password = box_pass\n \n for i in interfaces\n cfg.vm.network \"private_network\", auto_config: false, virtualbox__intnet: \"#{link_prefix}_switch_interface_#{i}\" \n end\n \n # bridged interface to have external network connectivity\n # VBoxManage list bridgedifs 로 확인 가능\n if bridged_interface != \"\"\n cfg.vm.network \"public_network\", auto_config: false, bridge: \"#{bridged_interface}\"\n end\n \n #if switch_type != \"\"\n # cfg.vm.provision :shell, :path => \"../common/install_#{switch_type}_#{switch_ver}.sh\"\n #end\n if File.exist?(\"init_node_#{hostname}.sh\")\n cfg.vm.provision :shell, :path => \"init_node_#{hostname}.sh\"\n end\n \n cfg.vm.provider \"virtualbox\" do |v|\n v.cpus = cpu\n v.memory = memory\n v.customize [\"modifyvm\", :id, \"--hpet\", \"on\"]\n \n # 스위칭에 이용하는 인터페이스에 대해서 promiscuous mode를 allow vms로 설정해줌\n for i in 2..(interface_count + 1)\n v.customize [\"modifyvm\", :id, \"--nicpromisc#{i}\", \"allow-all\"] \n end\n #v.gui = true\n end\n \n # nat_map = {1 => {\"ssh\" => 2222 }, 2 => {\"web\" => 2280}}\n # TODO: avoid port collision\n if (defined? nat_map)\n nat_map.each do |port_name, port_map| \n port_map.each do |guest_port, host_port|\n cfg.vm.network :forwarded_port, guest: guest_port, host: \"#{host_port}\", id: \"#{port_name}\" \n end\n end\n end\n \n if (defined? synced_folders)\n synced_folders.each do |host_folder, gst_folder|\n cfg.vm.synced_folder \"#{host_folder}\", \"#{gst_folder}\", disabled: false\n end\n end \n \n end\n end\nend",
"def provision_chef_zero(box, key, chef_config, vm_config)\n box.vm.provision \"chef_zero\" do |chef|\n set_instance_variable(chef_config, chef, 'cookbooks_path')\n set_instance_variable(chef_config, chef, 'data_bags_path')\n set_instance_variable(chef_config, chef, 'environments_path')\n set_instance_variable(chef_config, chef, 'nodes_path')\n set_instance_variable(chef_config, chef, 'roles_path')\n set_instance_variable(chef_config, chef, 'synced_folder_type')\n provision_chef_common(chef, key, chef_config, vm_config)\n end\nend",
"def add_to_host\n raise \"Unknown guest host! You must set current_host_id before creating\" unless current_host_id > 0\n user = User.find(current_host_id) # Raise error if not found\n user.add_guest(self, @circle)\n self.is_emergency_contact_for(user) if @emergency_contact\n true\n end",
"def start_cloud(resource, vm_ips, vm_ip_roles)\n\n puts \"Starting the cloud\"\n \n # ...\n\n end",
"def setup(machine)\n\n machine.bindfs.debug = true\n \n machine.vm.provider :virtualbox do |provider, _|\n provider.memory = 512\n provider.cpus = 2\n end\n\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-symbol\", chown_ignore: true\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-string\", \"chown-ignore\" => true\n\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-with-option\", owner: \"root\"\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-with-flag\", \"create-as-user\" => true\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-with-short-option\", r: true\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-without-explicit-owner\", owner: nil\n\n # This should fail\n machine.bindfs.bind_folder \"/etc3\", \"/etc-nonexit\"\n\n # These should also fail\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-with-nonexistent-user\", user: \"nonuser\", after: :provision\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-with-nonexistent-group\", group: \"nongroup\", after: :provision \n\nend",
"def provision_on(config)\n check_compatibility!(config)\n\n return if config.commands.nil?\n\n # this will initialize the SSH tunnel based on the connection settings\n @tunnel = Tunnel.new($connection.settings.to_h)\n @errors = []\n\n @results = nil\n\n stdout = []\n @sftp = nil\n @tunnel.on_shh do |session|\n while config.commands.count > 0\n cmd = config.commands.shift\n \n if cmd.type.eql? Command::DOWNLOAD_FILE\n catch_sftp_exception do\n @sftp = init_sftp\n DevOn::print({:title => \"Preparing SFTP Download\", :value => cmd.value})\n @sftp.download!(cmd.value[:source], cmd.value[:destination], {:verbose => @tunnel.verbose})\n DevOn::print({:title => \"File Download Complete\", :value => cmd.value[:destination]})\n end\n end\n\n if cmd.type.eql? Command::UPLOAD_FILE\n catch_sftp_exception do\n @sftp = init_sftp\n DevOn::print({:title => \"Preparing SFTP Upload\", :value => cmd.value})\n @sftp.upload!(cmd.value[:source], cmd.value[:destination], {:verbose => @tunnel.verbose})\n DevOn::print({:title => \"File Uploaded\", :value => cmd.value[:destination]})\n end\n end\n\n if cmd.type.eql? Command::SHELL\n catch_ssh_exception do \n command = cmd.value\n command = command.gsub(\"$output\", $output) if(command.include?\"$output\") \n \n DevOn::print({:title => \"Preparing SSH command\", :value => command})\n session.exec!(command) do |channel, stream, data|\n if stream == :stdout\n arr = data.split(\"\\n\")\n stdout = arr.empty? ? data : arr\n @results = stdout\n end\n end\n $output = stdout.flatten.join(' ')\n DevOn::print({:title => \"[SHELL OUTPUT]\", :output => stdout})\n end\n end\n end\n end\n \n if !@errors.empty?\n ap \"Please correct the following ERRORS:\"\n ap @errors\n else\n ap \"NO ERRORS ENCOUNTERED!\"\n end\n\n @results\n end",
"def provision_chef_solo(box, key, chef_config, vm_config)\n box.vm.provision \"chef_solo\" do |chef|\n set_instance_variable(chef_config, chef, 'cookbooks_path')\n set_instance_variable(chef_config, chef, 'data_bags_path')\n set_instance_variable(chef_config, chef, 'environments_path')\n set_instance_variable(chef_config, chef, 'nodes_path')\n set_instance_variable(chef_config, chef, 'roles_path')\n set_instance_variable(chef_config, chef, 'synced_folder_type')\n provision_chef_common(chef, key, chef_config, vm_config)\n end\nend",
"def provision?\n true\n end",
"def configure_instance(\n machine,\n instance_profile,\n provider = 'virtualbox'\n)\n\n\n return false unless lookup_values_yaml(instance_profile, ['providers', provider])\n\n configure_vagrant_box(machine, instance_profile)\n\n configure_instance_hardware(machine, instance_profile)\n\n configure_networking(machine, instance_profile)\n\n configure_communication(machine, instance_profile)\n\n configure_filesystems(machine, instance_profile, provider)\n\n execute_system_commands(machine, instance_profile, provider)\n\nend",
"def create_libvirt_pool\n delete_libvirt_pool if run_command('sudo virsh pool-info default')[:value].success?\n images_dir = \"#{ENV['HOME']}/libvirt-images\"\n all_commands = [\n \"sudo mkdir -p #{images_dir}\",\n \"sudo virsh pool-create-as default dir --target #{images_dir}\"\n ].concat(allow_others_recursively_commands(images_dir))\n result = run_sequence(all_commands)[:value]\n if result.success?\n Result.ok('Successfully installed vagrant plugins')\n else\n Result.error('Could not install vagrant plugins')\n end\n end",
"def add_keys(vm)\n vm.provision \"file\",\n source: \"./setupfiles/vagrant_testkey\",\n destination: \"/home/vagrant/.ssh/id_ed25519\"\n vm.provision \"file\",\n source: \"./setupfiles/vagrant_testkey.pub\",\n destination: \"/home/vagrant/.ssh/id_ed25519.pub\"\n vm.provision \"shell\", inline: <<-EOS\n chmod 600 /home/vagrant/.ssh/id_ed25519\n chmod 644 /home/vagrant/.ssh/id_ed25519.pub\n EOS\nend",
"def bootstrap(config, hostname, ip_address, options = {})\n config.vm.network :private_network, :ip => ip_address\n\n if forward_ports = options[:forward_ports]\n forward_ports.each do |guest_port, host_port|\n config.vm.network :forwarded_port, :guest => guest_port, :host => host_port\n end\n end\n\n graphs_folder = \"graphs/#{hostname}\"\n FileUtils.mkdir_p(graphs_folder) unless File.directory?(graphs_folder)\n config.vm.synced_folder graphs_folder, '/var/lib/puppet/state/graphs'\n\n config.vm.provision :shell do |shell|\n shell.path = 'build/vagrant-puppet.sh'\n shell.args = \"#{hostname} #{$domain_name} unused #{ip_address($puppetmaster_ip)}\"\n end\nend",
"def run\n super\n # create an ip\n ip_address = \"#{rand(255)}.#{rand(255)}.#{rand(255)}.#{rand(255)}\"\n x = create_entity Entities::Host, { :name => ip_address }\n end",
"def add_keys(vm)\n vm.provision \"file\",\n source: \"./vagrant_testkey\",\n destination: \"/home/vagrant/.ssh/id_ed25519\"\n vm.provision \"file\",\n source: \"./vagrant_testkey.pub\",\n destination: \"/home/vagrant/.ssh/id_ed25519.pub\"\n vm.provision \"shell\", inline: <<-EOS\n chmod 600 /home/vagrant/.ssh/id_ed25519\n chmod 644 /home/vagrant/.ssh/id_ed25519.pub\n EOS\nend",
"def provision\n req = VCAP::Services::Api::ProvisionRequest.decode(request_body)\n\n svc = Service.find_by_label(req.label)\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless svc && svc.visible_to_user?(user)\n\n cfg = ServiceConfig.provision(svc, user, req.name, req.plan, req.plan_option)\n\n handle = {\n :service_id => cfg.name,\n :data => cfg.data,\n :credentials => cfg.credentials,\n }\n render :json => handle\n end",
"def provision_with(command)\n provisioning << command\n provisioning.flatten!\n end",
"def server_config(config)\n config.vm.provision :puppet, :module_path => '..' do |puppet|\n puppet.manifests_path = \"vagrant\"\n puppet.manifest_file = \"server.pp\"\n end\nend",
"def defineControlVM(control, vmName)\n\tcontrol.vm.hostname = vmName\n\tcontrol.vm.box = \"https://cloud-images.ubuntu.com/vagrant/utopic/%s/utopic-server-cloudimg-amd64-vagrant-disk1.box\" % $controlRequestImagePath\n\tcontrol.vm.network :private_network, ip: \"10.10.10.10\"\n\n\t# Forward our Docker registry port to the outside world.\n\tcontrol.vm.network \"forwarded_port\", guest: 5000, host: $controlDockerRegistryPort, auto_correct: true\n\n\t# Enabled serial logging if the user asked for it.\n\tsetUpSerialLogging vmName\n\n\t# Build the log directory where all internal control machines logs will go to.\n\tlogFile = setUpProvisionLogging vmName\n\n\t# Provision the machines.\n\tcontrol.vm.provision :shell, :path => \"automation/vagrant/tasks/ProvisionControlBase.sh\", :privileged => false, :args => \"%s\" % logFile\n\tcontrol.vm.provision :shell, :path => \"automation/vagrant/tasks/ProvisionControlFiles.sh\", :privileged => false, :args => \"%s %s\" % [logFile, $coreInstances]\n\tcontrol.vm.provision :shell, :path => \"automation/vagrant/tasks/ProvisionControlAnsible.sh\", :privileged => false, :args => \"%s\" % logFile\n\tcontrol.vm.provision :shell, :path => \"automation/vagrant/tasks/ProvisionControlDocker.sh\", :privileged => false, :args => \"%s\" % logFile\n\tcontrol.vm.provision :shell, :path => \"automation/vagrant/tasks/ProvisionControlRegistry.sh\", :privileged => false, :args => \"%s\" % logFile\nend",
"def create_etc_hosts(cluster)\n if ENV['VAGRANT_CWD'] then\n folder = ENV['VAGRANT_CWD'] + \"/export/.etc_hosts\"\n etc_file = open(folder, \"w\")\n else\n etc_file = open(\"./export/.etc_hosts\", \"w\")\n end\n etc_file.write(\"127.0.0.1 localhost\\n\")\n\n cluster.each do |role, member_list|\n member_list.each do |member_info|\n etc_file.write(\"#{member_info['contiv_control_ip']} #{member_info['name']}\\n\")\n if role == \"master\" then\n\tetc_file.write(\"#{member_info['contiv_control_ip']} netmaster \\n\")\n end\n end\n end\n\n etc_file.close\nend",
"def configure_vagrant_machine(hostname, vm, cpus, memory)\n is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)\n\n vm.box = 'bento/ubuntu-16.04'\n vm.hostname = hostname\n\n vm.provider 'virtualbox' do |vb, override|\n # NAT settings so network isn't super slow\n override.vm.network :private_network, ip: \"192.168.100.50\"\n vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']\n vb.customize ['modifyvm', :id, '--natdnsproxy1', 'on']\n vb.cpus = cpus\n vb.memory = memory\n vb.name = \"vagrant-#{hostname}\"\n\n if is_windows\n override.vm.synced_folder \".\", \"/vagrant\", mount_options: [\"fmode=700\"]\n end\n end\n\n vm.provider 'parallels' do |prl, override|\n override.vm.network :private_network, ip: \"192.168.100.50\"\n prl.update_guest_tools = true\n prl.optimize_power_consumption = false\n prl.cpus = cpus\n prl.memory = memory\n prl.name = \"vagrant-#{hostname}\"\n end\nend",
"def provision_and_mount_volume(server, disk_size, device)\n unless provider.find_server_device(server, device)\n say \"Provisioning #{disk_size}Gb persistent disk for inception VM...\"\n provider.create_and_attach_volume(\"Inception Disk\", disk_size, server, device)\n end\n\n # Format and mount the volume\n if aws?\n say \"Skipping volume mounting on AWS 12.10 inception VM until its fixed\", [:yellow, :bold]\n run_ssh_command_until_successful server, \"sudo mkdir -p /var/vcap/store\"\n else\n say \"Mounting persistent disk as volume on inception VM...\"\n run_ssh_command_until_successful server, \"sudo mkfs.ext4 #{device} -F\"\n run_ssh_command_until_successful server, \"sudo mkdir -p /var/vcap/store\"\n run_ssh_command_until_successful server, \"sudo mount #{device} /var/vcap/store\"\n end\n end",
"def attach_volumes(node, disk_sizes)\n if $provider == :virtualbox\n node.vm.provider :virtualbox do |v, override|\n disk_num = 0\n disk_sizes.each do |disk_size|\n disk_num += 1\n diskname = File.join(File.dirname(File.expand_path(__FILE__)), \".virtualbox\", \"#{node.vm.hostname}-#{disk_num}.vdi\")\n unless File.exist?(diskname)\n v.customize ['createhd', '--filename', diskname, '--size', disk_size * 1024]\n end\n v.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', disk_num, '--device', 0, '--type', 'hdd', '--medium', diskname]\n end\n end\n end\n\n if $provider == :vmware_fusion\n node.vm.provider :vmware_fusion do |v, override|\n vdiskmanager = '/Applications/VMware\\ Fusion.app/Contents/Library/vmware-vdiskmanager'\n unless File.exist?(vdiskmanager)\n dir = File.join(File.dirname(File.expand_path(__FILE__)), \".vmware\")\n unless File.directory?( dir )\n Dir.mkdir dir\n end\n\n disk_num = 0\n disk_sizes.each do |disk_size|\n disk_num += 1\n diskname = File.join(dir, \"#{node.vm.hostname}-#{disk_num}.vmdk\")\n unless File.exist?(diskname)\n `#{vdiskmanager} -c -s #{disk_size}GB -a lsilogic -t 1 #{diskname}`\n end\n\n v.vmx[\"scsi0:#{disk_num}.filename\"] = diskname\n v.vmx[\"scsi0:#{disk_num}.present\"] = 'TRUE'\n v.vmx[\"scsi0:#{disk_num}.redo\"] = ''\n end\n end\n end\n end\n\n if $provider == :parallels\n node.vm.provider :parallels do |v, override|\n disk_sizes.each do |disk_size|\n v.customize ['set', :id, '--device-add', 'hdd', '--size', disk_size * 1024]\n end\n end\n end\n\nend",
"def get_host_to_provision(role, size, volume_size)\n abs_initialize\n host =\n { 'role': role,\n 'size': size,\n 'volume_size': volume_size }\n\n host_array = [host]\n\n return host_array\n end",
"def shell_provisioners_never(vm, host, global)\n if scripts = get_config_parameter(host, global, 'scripts_never')\n scripts.each do |script|\n vm.provision script['name'], type: \"shell\", run: \"never\" do |s|\n s.path = script['script']\n s.args = script['args']\n end\n end\n end\nend",
"def make_proxmox_vm(vm)\n # * Disk: Use a SSD if possible. Preallocated might provide faster access.\n hd_file=@disk_folder+\"/#{vm}-HD.vdi\"\n\n # NOTE! Lots of code also available for inspiration in\n # /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/providers/virtualbox/driver/version_4_3.rb\n\n\n unless(File.file?(@install_iso))\n raise \"ERROR - you need to download the ISO file at #{@install_iso} from https://www.proxmox.com/downloads\"\n end\n\n ide_storage_name=\"IDE Controller for #{vm}\"\n description = \"Proxmox-in-Virtualbox generated by https://github.com/mrjcleaver/proxmox-setup \\n\" + \\\n \"Generated \"+Time.now.to_s+ \" using \"+@install_iso\n\n # http://nakkaya.com/2012/08/30/create-manage-virtualBox-vms-from-the-command-line/\n # https://www.virtualbox.org/manual/ch08.html\n run_shell_cmd(\"VBoxManage createvm --name '#{vm}' --register\")\n run_shell_cmd(\"VBoxManage modifyvm '#{vm}' --description '#{description}'\")\n # Note: Enabling the I/O APIC is required for 64-bit guest operating systems (page 48, manual)\n run_shell_cmd(\"VBoxManage modifyvm '#{vm}' --memory '#{@ram_mb}' --acpi on --ioapic on --boot1 dvd --vram 12\")\n\n run_shell_cmd(\"VBoxManage modifyvm '#{vm}' --ostype Debian --audio none\")\n\n run_shell_cmd(\"VBoxManage createhd --filename '#{hd_file}' --size '#{@hd_size_mb}' --variant Fixed\")\n run_shell_cmd(\"VBoxManage storagectl '#{vm}' --name '#{ide_storage_name}' --add ide\")\n\n run_shell_cmd(\"VBoxManage storageattach '#{vm}' --storagectl '#{ide_storage_name}' --port 0 --device 0 --type hdd --medium '#{hd_file}' --nonrotational=#{@hd_on_ssd}\")\n\n run_shell_cmd(\"VBoxManage storageattach '#{vm}' --storagectl '#{ide_storage_name}' --port 1 --device 0 --type dvddrive --medium '#{@install_iso}'\")\n\n run_shell_cmd(\"VBoxManage setextradata '#{vm}' GUI/MouseCapturePolicy Default\")\nend",
"def configure_chef_provisioners\n chef_provisioners.each { |prov| configure_chef(prov.config) }\n end",
"def configure_ps_vbox_vm(client_name,client_mac,client_arch,client_os,client_rel)\n client_os = \"Ubuntu\"\n if client_arch.match(/x86_64/)\n client_os = client_os+\"_64\"\n end\n configure_vbox_vm(client_name,client_mac,client_os)\n return\nend",
"def set_resources(vm, options)\n vm.provider :virtualbox do |v|\n v.cpus = options[:cpu]\n v.memory = options[:ram]\n end\nend",
"def setup\n unless @platform.provisioning.empty?\n script = @platform.provisioning.join(' && ')\n dispatch(script)\n end\n end"
] |
[
"0.710348",
"0.70939255",
"0.7039509",
"0.69078016",
"0.6874276",
"0.6793122",
"0.676956",
"0.6749985",
"0.6619524",
"0.6586047",
"0.6524973",
"0.6469665",
"0.641902",
"0.63955194",
"0.6378395",
"0.6365725",
"0.63513553",
"0.6338087",
"0.62785935",
"0.6226664",
"0.62037456",
"0.61774373",
"0.6171943",
"0.6168568",
"0.6132553",
"0.6120395",
"0.61147684",
"0.61062163",
"0.6065174",
"0.6038316",
"0.60239476",
"0.6020042",
"0.6008043",
"0.5986691",
"0.5973607",
"0.5967268",
"0.58807814",
"0.5863979",
"0.58634466",
"0.5846018",
"0.5832286",
"0.5829234",
"0.58114",
"0.58111435",
"0.5799403",
"0.5795352",
"0.57942355",
"0.57823795",
"0.5763793",
"0.57504755",
"0.57403046",
"0.57318443",
"0.57248175",
"0.57246834",
"0.56979835",
"0.5657509",
"0.5630897",
"0.56282717",
"0.56271213",
"0.56265223",
"0.56169194",
"0.5616548",
"0.56152886",
"0.5602062",
"0.56017447",
"0.55895126",
"0.5587323",
"0.55863494",
"0.5569994",
"0.55580807",
"0.5552543",
"0.55516535",
"0.55500615",
"0.55472225",
"0.5541782",
"0.5532471",
"0.5507741",
"0.550544",
"0.54967904",
"0.54934716",
"0.549316",
"0.54923636",
"0.54785097",
"0.5475039",
"0.5466063",
"0.5460225",
"0.5449833",
"0.54423696",
"0.5431513",
"0.5431133",
"0.5429616",
"0.54288644",
"0.5427549",
"0.5427129",
"0.54109097",
"0.5410825",
"0.54097676",
"0.5393346",
"0.53926057",
"0.53924966",
"0.5386047"
] |
0.0
|
-1
|
Add host and guest leads as ADMINs
|
def add_leads(space, space_form)
form_host_lead_dxuser = space_form.host_lead_dxuser
add_lead(
space,
User.find_by!(dxuser: form_host_lead_dxuser),
SpaceMembership::SIDE_HOST,
)
return if guest_blank?(space, space_form)
form_guest_lead_dxuser = space_form.guest_lead_dxuser
add_lead(
space,
space.review? ? space_form.space_sponsor : User.find_by!(dxuser: form_guest_lead_dxuser),
SpaceMembership::SIDE_GUEST,
)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_admin oid\n self.admins << oid if Character && !admin?(oid)\n end",
"def add_admin\n @email = :email\n User.invite!(:email => @email, :ngo => current_user.ngo)\n end",
"def add_admin(arg)\n chg_permission(admins, arg, :add)\n end",
"def fAddAdmin (name, email, pwd)\n @users.addAdmin(name,email,pwd)\n end",
"def admin_user\n #redirect_to(root_url) unless\n current_user.admin || current_user.super_admin?# || top_layer_administrator\n end",
"def admin\n #TODO\n end",
"def admin_agent\n redirect_to(root_url) unless current_agent.admin?\n end",
"def set_as_admin\n self.admin = true\n end",
"def admin_user \n if (!current_user.lunches_admin?) \n flash[:alert] = 'You not allowed to edit menu.'\n \n redirect_to(root_url)\n end\n end",
"def give_admin_access_to(login)\n give_access_to(:admin, login)\n end",
"def admin\n #manager\n #include User,CmsRole\n can :manage, :all\n end",
"def admin_in!\n access_denied! unless current_user.admin?\n end",
"def administrator\n can :manage, :all\n end",
"def admin(target = nil)\n raw \"ADMIN #{target}\".strip << \"\\r\\n\"\n end",
"def require_admin\n grant_access?(\"index\", \"users\")\n #position?('admin')\n end",
"def make_admin\n authorize! @user\n @user.roles = @user.roles + ['admin']\n @user.save\n redirect_to @user, notice: t('user.made_admin', name: @user.username)\n end",
"def administrate!\n\tif current_user.admin == false \n\t\tredirect \"/home\"\n\tend\nend",
"def admin\n end",
"def admin\n end",
"def admin\n end",
"def admin\n end",
"def update_administrators\n if user_id_changed?\n if (user_id)\n Membership.find_by_user_id_and_network_id(user_id, id).try(:destroy) # delete membership of new owner\n end \n if (user_id_was)\n Membership.create(:user_id => user_id_was, :network_id => id,\n :administrator => true, :invited_by => User.find(user_id)).accept! # create membership for old owner\n end\n end\n end",
"def admin_user\n\t\tredirect_to(root_url) unless current_user.admin? #NB il metodo \"admin?\" è stato aggiunto direttamente da Rails quando alla creazione ha visto che admin è un booleano\n\tend",
"def make_admin\n self.update_attributes(:admin => true)\n end",
"def admin\n\t\tcan :manage, :all\n\tend",
"def admin\n\n end",
"def admin?; false end",
"def admin_actions(user)\n can_act_as_logged_in_user(user)\n can_view_any_profile\n can_view_any_gallery\n can_edit_saved_queries\n can_curate\n can_update_metadata\n can_administer\n end",
"def admin?; current_user.admin?; end",
"def admin?; current_user.admin?; end",
"def check_if_should_be_admin\n end",
"def add_or_update_admin\n if @invite_admin_obj.blank?\n @invite_admin_obj = Admin.new(email: @email, default_client_id: @client_id)\n end\n\n @invite_admin_obj.status = GlobalConstant::Admin.invited_status\n @invite_admin_obj.terms_of_use = GlobalConstant::Admin.accepted_terms_of_use\n @invite_admin_obj.role = GlobalConstant::Admin.normal_admin_role\n @invite_admin_obj.name = @name\n @invite_admin_obj.session_inactivity_timeout = GlobalConstant::AdminSessionSetting.default_session_inactivity_timeout\n\n @invite_admin_obj.save! if @invite_admin_obj.changed?\n end",
"def be_admin\n if current_user.switch_to(\"admin\")\n flash[:notice] = \"You have now an 'admin' role\"\n else\n flash[:error] = \"You are not authorized to have a 'admin' role\"\n end\n redirect_to( request.env[\"HTTP_REFERER\"])\n end",
"def admin?(&block)\n if @sso_groups.include?(\"Admin\") || @user.role_id >= 2\n concat(capture(&block))\n end\n end",
"def admin_only\n deny_access(\"Necesitas tener privilegios de administrador para entrar.\") unless signed_in_as_admin?\n end",
"def admin(target = nil)\n send_data(\"ADMIN #{target}\".strip)\n end",
"def give_admin!\n self.admin = true\n save\n puts \"Felicitation vous etes admin!\"\n true\n end",
"def can_manage_admins?\n (ENV['FPHS_ADMIN_SETUP'] == 'yes' && !current_admin) || (Settings::AllowAdminsToManageAdmins && !!current_admin)\n end",
"def main_admin\n @@_cache_admin ||= (User.where(email: 'yaw@loverealm.org').take || User.create!(first_name: 'Loverealm', last_name: 'Administrator', email: 'yaw@loverealm.org', password: ENV['LR_SUPER_USERS_PASSWORD'], password_confirmation: ENV['LR_SUPER_USERS_PASSWORD'], roles: [:admin]))\n end",
"def administrate!\r\n\tif !current_user.administrator\r\n\t\tredirect \"/dashboard\"\r\n\tend\r\nend",
"def admin!\n metadata['admin'] = true\n save\n end",
"def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end",
"def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end",
"def isAdmin\n \n end",
"def admin_logic\n end",
"def is_admin? oid\n admins.include? oid\n end",
"def admin_area &block\n capture(&block) if current_user && current_user.admin?\n end",
"def set_administrator\n @administrator = Administrator.find(params[:id]) \n redirect_to accounts_path, notice: 'You are not authorized to access this administrator' and return unless @administrator && @administrator.accessible_by?(current_user)\n @account = @administrator.account \n \n redirect_to accounts_path, notice: 'You are not authorized to access this application' and return unless @account.accessible_by?(current_user)\n \n @adminsitrator\n end",
"def setup_admin\n create_admin_user\n create_admin_organization\n update_admin_user_perms\nend",
"def admin_user\n redirect_to(root_url) unless current_doctor.admin?\n end",
"def admin_user\n redirect_to(admin_admins_path) unless current_user.admin?\n end",
"def check_admin\n redirect_to houses_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin? || current_user.super_admin?\n end",
"def make_admin\n\t\tself.usertype = \"admin\"\n\t\tself.save\n\tend",
"def setAsAdmin\n self.clientType = CLIENT_TYPES[:administrator]\n end",
"def admin\n @shell.admin\n end",
"def admin(&block)\n block.call if logged_in?\n end",
"def allow_if_admin\n unless is_admin?\n flash[:danger] = \"Administration permissions needed to access to this page\"\n redirect_to new_user_session_path\n end\n end",
"def make_admin_if_first_user\n self.make_admin if self.first_user?\n end",
"def add_guest(guest, circle = guest.circle) \n # Adds authorization plugin role: 'guest' of user\n # guests can identify their hosts with:\n # guest.is_guest_of_what => Array of Members\n # and member can identify their guests with:\n # member.has_guests? => true/false\n # member.has_guests => Array of Guests\n #\n # Things to watch out for:\n # g.has_role? 'guest' => false\n # g.has_role? 'guest, member => ArgumentError\n guest.is_guest_of self\n \n # Adds relationship: guest + circle\n relationships.create!(:guest => guest, :circle => circle)\n end",
"def create_site_admin_invitations_to_space(space, site_admins)\n host_lead = space.host_lead # the admin who's created the current administrator space\n\n return if site_admins.empty?\n\n admin_membership = space.space_memberships.find_by(user: host_lead)\n\n site_admins.each do |site_admin|\n # rubocop:disable Layout/LineLength\n Rails.logger.info(\"Adding site admin #{user.dxuser} to space #{space.id}\" \\\n \" with admin membership #{admin_membership.id}\")\n SpaceMembershipService::CreateOrUpdate.call(api, space, site_admin, SpaceMembership::ROLE_ADMIN, admin_membership, false)\n NotificationsMailer.space_activated_email(space, admin_membership).deliver_now!\n # rubocop:enable Layout/LineLength\n end\n end",
"def enable_admin\n if current_user.admin?\n user = User.find(params[:id])\n user.update_attribute(\"admin\", true)\n redirect_to \"/users\"\n else\n redirect_to \"/home\"\n flash[:warning] = \"Only admins can perform that action.\"\n end\n end",
"def is_admin?\n is_admin == 1\n end",
"def grant_system_admin_privileges(user)\n can :manage, AccountPlan\n end",
"def make_admin\n @user = User.find(params[:user_id])\n @user.admin = !@user.admin\n @user.save\n redirect_to users_path\n end",
"def make_first_user_admin\n return unless User.count.zero?\n\n self.is_admin = true\n self.approved = true\n end",
"def guest\n can :read, ActiveAdmin::Page, name: \"Dashboard\"\n can [:read, :update], User, id: user.id\n end",
"def admin_access?\n admin?\n end",
"def admins\n app_users.select(&:admin?)\n end",
"def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t end",
"def admin\n can :manage, :all\n end",
"def is_admin\n test_access :admin\n end",
"def assign_administrator(user_id)\n add_user(user_id, true, true)\n end",
"def add_admin(user)\n user = User.get_user(user, client)\n response = client.post \"/admins/?actor_token=#{CGI.escape user.token}\", {:jid => user.jid}\n if response.success?\n true\n else\n raise APIException.new(response.body)\n end\n end",
"def admin?\n #warning: ADMIN must have id 0, rake db:seed to get admin and sample user\n logged_in? && current_user.admin\n end",
"def administration?\n self.privileges == PRIVILEGE_CODES[:administration]\n end",
"def add_group_as_admin(group)\n add_group_as_member group\n promote_in_group group\n end",
"def admin_actions\n unless @current_admin.is_super_admin\n flash[:error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n return\n end\n end",
"def admin_only\n current_client == current_user\n unless current_user.admin? || @client == current_user\n redirect_to clients_path, :alert => \"Access denied.\"\n end\n end",
"def ensure_admin_user!\n redirect_to(enemy_templates_path, :alert => \"You may not perform this action on enemies!\") and return unless current_user.admin?\n end",
"def admin_person\n redirect_to(root_url) unless current_person.admin?\n end",
"def admin_person\n redirect_to(root_url) unless current_person.admin?\n end",
"def admin\n authorize! :admin, @listings\n end",
"def super_admin _\n puts \"superadmin\"\n can :manage, :all\n end",
"def admin_user\n \t\tredirect_to(root_url) unless current_user.admin?\n \tend",
"def admin_user\n unless current_user && current_user.admin?\n redirect_to login_url, notice: \"admin can only do this action.\" \n end\n end",
"def admins_only\n if current_user.nil? or !current_user.is_admin?\n # Silently redirect, no need to tell anyone why. If they're\n # not an admin, they have no business here\n redirect_to root_path\n end\n end",
"def admin_only(&block)\n role_only(\"admin\", &block)\n end",
"def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend",
"def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend",
"def is_admin?\n admin\n end",
"def is_admin?\n admin\n end",
"def require_admin\n unless env['warden'].user.advisor? || env['warden'].user.resident?\n flash.error = \"You are not authorized to access that page.\"\n redirect '/'\n end\n end",
"def set_admin\n #puts \"called set_admin\"\n @admin = current_admin_credential\n end",
"def admin_link\n # @subdomain = request.subdomain\n # @site = Site.where(subdomain: request.subdomain).first.user_id\n # @user = User.where(id: @site).first\n if user_signed_in? && @user.id == current_user.id\n html = '<li>' + (link_to '<i class=\"fa fa-cog\"></i> Admin'.html_safe, dashboard_path, target: \"_blank\") + '</li>'\n html.html_safe\n end\n end",
"def admin_user\n redirect_to(root_url) unless current_user && current_user.admin?\n end",
"def setup_admins_users\n begin\n click_on('Logout')\n rescue\n print\n end\n\n Warden.test_reset!\n\n @a1 = admins(:elle_woods)\n @a2 = admins(:vivian_kensington)\n @a3 = admins(:emmett_richmond)\n\n @u1 = users(:connery)\n @u2 = users(:moore)\n @u3 = users(:brosnan)\nend",
"def admins\n [self.user.email, self.study_shares.can_edit, User.where(admin: true).pluck(:email)].flatten.uniq\n end",
"def set_admin(bool)\n bool ? self.add_role(:admin) : self.remove_role(:admin)\n end",
"def add_to_host\n raise \"Unknown guest host! You must set current_host_id before creating\" unless current_host_id > 0\n user = User.find(current_host_id) # Raise error if not found\n user.add_guest(self, @circle)\n self.is_emergency_contact_for(user) if @emergency_contact\n true\n end",
"def admin_user\n unless @is_admin\n flash[:danger] = \"Must be admin to modify recipes\"\n redirect_to(recipes_url) \n end\n end"
] |
[
"0.68553394",
"0.649806",
"0.6411531",
"0.635145",
"0.62299734",
"0.61694586",
"0.6144791",
"0.61242074",
"0.6117006",
"0.61087453",
"0.60904396",
"0.6081031",
"0.60487014",
"0.60484904",
"0.6041076",
"0.6026751",
"0.6018488",
"0.6000979",
"0.6000979",
"0.6000979",
"0.6000979",
"0.5991331",
"0.59875387",
"0.59717417",
"0.5970313",
"0.59623325",
"0.5957525",
"0.5950684",
"0.5938792",
"0.5938792",
"0.5935831",
"0.59352297",
"0.59217715",
"0.5914588",
"0.59144443",
"0.58995855",
"0.5898607",
"0.5891622",
"0.58857185",
"0.58822584",
"0.58822036",
"0.58758533",
"0.58758533",
"0.5865165",
"0.5864805",
"0.58628976",
"0.5862305",
"0.5851035",
"0.58508873",
"0.58488005",
"0.5847661",
"0.584704",
"0.58465445",
"0.58460987",
"0.58389866",
"0.5838093",
"0.5837128",
"0.5834588",
"0.5822447",
"0.58215255",
"0.581924",
"0.581921",
"0.5815224",
"0.58083445",
"0.580765",
"0.5807416",
"0.5794503",
"0.57944924",
"0.57926184",
"0.5789304",
"0.578429",
"0.57788134",
"0.57718724",
"0.5770311",
"0.57629055",
"0.57558125",
"0.57552844",
"0.575493",
"0.57511365",
"0.5745818",
"0.5743149",
"0.5743149",
"0.5742405",
"0.57354385",
"0.5733083",
"0.5728954",
"0.572405",
"0.57239056",
"0.5713863",
"0.5713863",
"0.57133347",
"0.57133347",
"0.5709346",
"0.5707323",
"0.5700984",
"0.56943375",
"0.5693465",
"0.5689833",
"0.56897306",
"0.56826997",
"0.5681822"
] |
0.0
|
-1
|
Remove pfda admin from orgs Skip if the host user is actual ADMIN_USER
|
def remove_pfda_admin_user(orgs_dxs)
return if user.dxid == ADMIN_USER
orgs_dxs.each { |dxorg| papi.call(dxorg, "removeMember", user: ADMIN_USER) }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def remove_pfda_admin_user(space, space_form)\n return if user.dxid == ADMIN_USER\n\n unless space_form.host_admin.dxid == ADMIN_USER\n admin_api.org_remove_member(space.host_dxorg, ADMIN_USER)\n end\n\n return if space_form.guest_admin.nil? || space_form.guest_admin&.dxid == ADMIN_USER\n\n admin_api.org_remove_member(space.guest_dxorg, ADMIN_USER)\n end",
"def unscrape?\n @user.is_admin?\n end",
"def dont_delete_admin\n\t\t raise \"You cannot delete the last admin\" if self.id == 1 || User.count == 1\n\t end",
"def unadmin!\n metadata['admin'] = false\n save\n end",
"def demoting_admin?(team_user)\n team_user.user&.admin? && new_role != \"owner\"\n end",
"def user_is_admin?\n\tbegin\n\t `gpresult /r /scope user`.split.include? \"Admin\"\n\trescue\n\t false\n\tend\n end",
"def remove_admin(admin, user_id)\n return get_db_as_hash().execute(\"UPDATE user SET admin = 0 WHERE user_id = ?\", user_id).first \n end",
"def avoid_to_delete_last_admin\n if User.where(admin: true).size == 1 && self.admin?\n raise LastAdminError\n end\n end",
"def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end",
"def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end",
"def set_admin_flag\n @adminFlag = false\n end",
"def admin_user\n #redirect_to(root_url) unless\n current_user.admin || current_user.super_admin?# || top_layer_administrator\n end",
"def remove_admin(arg)\n chg_permission(admins, arg, :remove)\n end",
"def ensure_if_admin_remains\n raise \"Can't delete last admin user.\" if User.count.zero?\n end",
"def ensure_if_admin_remains\n raise \"Can't delete last admin user.\" if User.count.zero?\n end",
"def destroy?\n user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin? || current_user.super_admin?\n end",
"def admin_user\n redirect_to(root_path) unless (current_user != nil && current_user.admin == true)\n end",
"def avoid_to_demote_last_admin\n if User.where(admin: true).size == 1 && !self.admin && self.admin_was\n raise LastAdminError\n end\n end",
"def admin_only\n if !Volt.current_user.admin\n redirect_to '/login'\n end\n end",
"def admin_user\n redirect_to(root_path) unless current_user.try(:admin?) || current_user?(@user)\n end",
"def rem_admin oid\n self.admins.delete oid\n end",
"def delete_admin(id)\n @m = Member.find_by_society_id_and_user_id(self.id, id)\n if @m == nil then return end\n \n if @m.admin \n @m.admin = false\n @m.save\n\t\t\tadd_post(id, \"Administrator status revoked\")\n end\n end",
"def destroy?\n owner? || user.is?(:admin)\n end",
"def do_not_rename_or_destroy_admins_group\n if @group and @group.is_the_administrators_group?\n redirect_to :action => 'list' and return false\n end\n end",
"def remove_project_admin_auth(project_id_or_key, user_id)\n delete(\"projects/#{project_id_or_key}/administrators\", user_id: user_id)\n end",
"def before_destory\n if User.count(:all, :conditions => [\"is_superuser = 1 and active = 1\"]) <= 1\n errors.add_to_base \"Cannot delete #{self.username.upcase} because it is the last admin user\"\n return false\n else\n return true\n end\n end",
"def admin_user\n render_forbidden unless current_user.admin?\n end",
"def ensure_an_admin_remains\n if user_type_id == UserType::vendor_admin_id\n if User.where({user_type_id: UserType::vendor_admin_id, company_id: company_id}).count.zero?\n raise \"Cannot delete last vendor admin.\"\n end\n end\n end",
"def admin_user\n redirect_to(root_path) unless is_admin?\n end",
"def user_is_admin?\n\t`groups`.split.include? \"admin\"\n end",
"def destroy?\n user.admin?\n end",
"def destroy?\n user.admin?\n end",
"def admin_only\n deny_access(\"Necesitas tener privilegios de administrador para entrar.\") unless signed_in_as_admin?\n end",
"def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end",
"def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end",
"def destroy?\n user.admin_or_owner?\n end",
"def user_admin?\n unless current_user.present? && current_user.admin?\n redirect_to home_welcome_path and return\n end \n end",
"def admin_user\n redirect_to(root_path) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_path) unless current_user.admin?\n end",
"def admin_only\n @user = current_user\n if @user.role != \"admin\"\n redirect_to root_path\n end\n end",
"def admin_user\n redirect_to(admin_admins_path) unless current_user.admin?\n end",
"def revoke_admin\n self.update_attributes(:admin => false)\n end",
"def is_admin_user\n if current_user.present? && current_user.admin? == false\n redirect_to '/'\n return\n end\n end",
"def remove_admin_params\n params[:user].delete(:admin) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_path) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_path) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_path) unless current_user.admin?\n end",
"def revoke_admin_rights(member)\r\n fail \"#{member.email} is not a admin of this organisation\" unless admins[member.email]\r\n fail \"not enough admins left\" unless self.admin_count > 1\r\n self.admins.delete(member.email)\r\n end",
"def admin_user\n if (!current_user || current_user.username != 'admin')\n redirect_to(root_url)\n end\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end"
] |
[
"0.73185605",
"0.6716337",
"0.65860397",
"0.6558528",
"0.65524524",
"0.64814305",
"0.6458961",
"0.6430686",
"0.6403793",
"0.6403793",
"0.63285977",
"0.63171566",
"0.631586",
"0.62212825",
"0.62212825",
"0.61993843",
"0.6192403",
"0.6179935",
"0.61742574",
"0.61648476",
"0.61639374",
"0.6156555",
"0.61254007",
"0.61202127",
"0.6119695",
"0.611888",
"0.61083853",
"0.60959023",
"0.6083673",
"0.60801715",
"0.60727096",
"0.60607314",
"0.60607314",
"0.60501826",
"0.60498285",
"0.60498285",
"0.60478306",
"0.60390604",
"0.603332",
"0.603332",
"0.60259676",
"0.60240245",
"0.60233015",
"0.602106",
"0.6015803",
"0.5998066",
"0.5998066",
"0.5998066",
"0.5995191",
"0.5995177",
"0.59899133",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713",
"0.59896713"
] |
0.7002545
|
1
|
Send an activation email to all space leads
|
def send_emails(space)
space.leads.find_each do |lead|
notification_mailer.space_activation_email(space, lead).deliver_now!
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 send_activation_or_reset_mail\n end",
"def activation\n @greeting = \"Hi\"\n\n mail :to => \"john@synapticmishap.co.uk\"\n end",
"def send_activation_notification\n deliver_activation_email(:activation, :subject => (MaSA[:welcome_subject] || \"Welcome\" ))\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 send_activation_email\n UserMailer.account_activation(self, activation_token).deliver_later\n end",
"def send_activation_email\n DoctorMailer.account_activation(self).deliver_now\n end",
"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 account_activation(user)\n @user=user\n\n mail :to => @user.email, :from => \"allr0undy0u@gmail.com\", :subject => \"Account activation\"\n end",
"def account_activation(ngo)\n @ngo = ngo\n mail(to: @ngo.email, subject: \"GYE Account Activation\")\n end",
"def account_activation(member) \r\n @member = member \r\n mail(to: member.user_name, subject: \"Account Activation\") \r\n end",
"def activation(options)\n from \"#{options[:site].support_title} <#{options[:site].email_address}>\"\n recipients options[:account].email_address\n subject options[:site].activation_subject\n content_type 'text/html'\n \n body :site => options[:site], :account => options[:account]\n end",
"def admin_account_activation(member)\r\n @member = member\r\n mail(to: member.user_name, subject: \"Admin Account Activation\") \r\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 activation_needed_email(vendor)\n @vendor = vendor\n @url = \"http://127.0.0.1:3000/vendors/#{vendor.activation_token}/activate\"\n mail(:to => vendor.email,\n :subject => \"Baitalhikma.co.jp - Please activate your vendor account\")\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 send_activation_email\n\t\tUserMailer.account_activation(self).deliver_now\n\tend",
"def send_activation_request\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 UserMailer.account_activation(self).deliver_now\n end",
"def send_activation_email\n UserMailer.account_activation(self).deliver\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 activation_needed_email(user)\n @user = user\n @activation_url = activate_url(token: user.activation_token)\n mail to: user.email\n end",
"def activation_success_email(vendor)\n @vendor = vendor\n @url = \"http://127.0.0.1:3000/login\"\n mail(:to => vendor.email,\n :subject => \"Baitalhikma.co.jp - Your account is now activated\")\n end",
"def activation\n StudentMailer.activation\n end",
"def send_activation_email\n\t\tUserMailer.user_activation(self).deliver_now\n\tend",
"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 activate_account_email(user)\n @user = user\n @url = validate_account_url(@user.signup_token)\n mail(to: @user.email, subject: \"Welcome to Report It!\")\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 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 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 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 account_activation(band)\n @band = band\n mail to: band.email, subject: \"LiveJive: Identity Confirmation\"\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_success_email(user)\n @user = user\n @url = \"http://lvh.me:3000/login\"\n mail(:to => user.email,\n :subject => \"Your account at Stackclown is now activated\")\n end",
"def send_signup_notification\n deliver_activation_email(:signup, :subject => (MaSA[:activation_subject] || \"Please Activate Your Account\") )\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 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 activation_welcome(pharmacist)\n @pharmacist = pharmacist\n\n mail to: @pharmacist.email_primary, subject: \"Your account has been activated\"\n end",
"def deliver_activation_instructions!\n reset_perishable_token!\n Mailer.deliver_activation_instructions(self)\n end",
"def account_activation(pengguna)\n @pengguna = pengguna\n mail to: pengguna.email, subject: \"Aktivasi akun Anda di Aplikasi Web Bimas Katolik\"\n end",
"def send_admin_activation_email\n MemberMailer.admin_account_activation(self).deliver_now\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 activate(user)\n @activate_url = activate_user_url(user.key)\n mail to: user.email, subject: \"[Magic TV] メールアドレスの確認\"\n end",
"def activation_success_email(user)\n @user = user\n #@url = \"http://0.0.0.0:3000/login\"\n @url = \"http://kancrumer.herokuapp.com/login\"\n mail(:to => user.email, :subject => \"Your account is now activated\")\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_confirmation(user)\n @root_url = root_url\n mail(:subject => setup_subject(I18n.t('activation_complete')),\n :to => user.email)\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 account_activation(user)\n @user = user\n\n mail to: user.email, subject: \"Account activation\"\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 acceptance_email ucr\n extract_variables ucr\n\n mail to: @user.email\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 account_activation(user)\n @user = user\n mail to: user.email, subject: \"CRS Account Activation\"\n end",
"def activation_confirmation(user)\n user_login_link(user)\n\n @greeting = \"Thank you for choosing Contractor\"\n @name = user.name\n\n mail to: user.email\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 email_verification_instructions(user)\n load_settings\n @user = user\n subject_suffix = \"Account Activation Instructions\"\n #@url = \"http://example.com/login\"\n mail(:to => user.email,\n :subject => \"[#{user.company_name}] #{subject_suffix}\",\n :template_path => 'notifications',\n :template_name => 'another',\n :activate_account_url => activate_accounts_url(:code => user.perishable_token,\n :subdomain => user.company.subdomain),\n :username => user.login,\n :token => user.perishable_token, :subdomain => user.company.subdomain)\n end",
"def activation_welcome\n PharmacistMailer.activation_welcome\n end",
"def signup_activation(user)\n @user = user\n @url = 'http://localhost:3000/login'\n mail to: @user.email, subject: \"Match Point validate email\"\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 resend_activation_email\n create_activation_digest\n save\n send_activation_email\n end",
"def account_activation(user)\n @user = user\n mail to: \"#{user.full_name} <#{user.email}>\"\n end",
"def account_activation(request)\n @request = request\n @email = @request.clid + '@louisiana.edu'\n mail to: @email, subject: \"Room Request Confirmation\"\n end",
"def sendlink(coach,host)\n @greeting = \"Hi\"\n\n mail :to => coach.email,\n :subject => \"please click the link below for account activation\",\n #:body => link_to(coaches_url,coaches_path,:host => \"localhost\")\n :body => \"http://#{host}/activate/#{coach.activation_code}\"\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 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 send_email(user)\n\t UserMailer.activate_email(user).deliver\n\tend",
"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 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 deliver_activation_confirmation!\n reset_perishable_token!\n Mailer.deliver_activation_confirmation(self)\n end",
"def account_activation\n user = User.first\n user.activation_sent_at = Time.current\n UserMailer.account_activation(user)\n end",
"def activation_success_email\n UserMailerMailer.activation_success_email\n end",
"def activated(user)\n mail_to user, activated_subject\n end",
"def invite(invitation, www_host)\n @invitation = invitation\n @www_host = www_host\n \n mail :to => invitation.email_address\n end",
"def account_activation(subscriber)\n @greeting = \"Hi\"\n @subscriber = subscriber\n\n mail to: subscriber.email, subject: \"Confirm subscription\"\n end",
"def host_confirmation\n \t#binding.pry\n \tSendMailToHost.host_confirmation(self).deliver!\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_welcome_email\n #if Rails.env.production?\n if email.present?\n if followed_by >= 0\n # to send emails in delayed jobs use\n # UserMailer.instauser_welcome_email(id).delay.deliver!\n UserMailer.instauser_welcome_email(self.id).deliver\n else\n UserMailer.instauser_reject_email(self.id).deliver!\n end\n end\n #end\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 activation\n @user = User.first\n UserMailer.activation(@user)\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 send_welcome_email(user)\n mail to: user.email, subject: \"Sign Up Confirmation - Welcome to NetworkMill\"\n Email.create(:user_id => user.id, :sent_to => user.email, :title => \"welcome_email\")\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 booking_confirmed\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def booking_email(reservation) #customer, host, reservtion_id\n @user = reservation.user #appoint reservation user id(email,name)\n @host = reservation.listing.user #appoint listing user(email,name)\n @listing = reservation.listing #appoint reservation. listing(which id)\n\n mail(to: @user.email, subject: \"Thank you for your booking.\") #after all info appointed, send an email to user(customer)\n end",
"def reservation_confirmation\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def send_mail\n User.send_welcome_email(self.id)\n end",
"def account_activated(user)\n @user = user\n @login_url = url_for(:controller => 'account', :action => 'login')\n mail :to => user.mail,\n :subject => l(:mail_subject_register, Setting.app_title)\n end",
"def activation_success_email(user)\n @user = user\n @url = \"#{get_domain}/login\"\n mail(to: user.email, subject: 'メールアドレスの認証が完了しました!')\n end"
] |
[
"0.7594372",
"0.75799966",
"0.7558296",
"0.744841",
"0.74068123",
"0.7365573",
"0.7356083",
"0.7335921",
"0.73024637",
"0.7287065",
"0.7273054",
"0.72715235",
"0.7268526",
"0.7264571",
"0.72345513",
"0.7231706",
"0.72259665",
"0.7212751",
"0.7186972",
"0.7186972",
"0.7186972",
"0.7186972",
"0.7186972",
"0.7186972",
"0.7186972",
"0.7186972",
"0.7186972",
"0.7186972",
"0.7185477",
"0.7178509",
"0.71543",
"0.71543",
"0.71400034",
"0.7108815",
"0.70732296",
"0.7071392",
"0.7061986",
"0.7059174",
"0.70524275",
"0.70522356",
"0.7035614",
"0.7019845",
"0.69967794",
"0.6995633",
"0.69756883",
"0.6973595",
"0.6970848",
"0.6969855",
"0.69651085",
"0.69629455",
"0.69571537",
"0.69507664",
"0.69451976",
"0.69319606",
"0.69269586",
"0.692218",
"0.69202685",
"0.68936145",
"0.6875423",
"0.6850012",
"0.68098295",
"0.6808868",
"0.6808868",
"0.6808403",
"0.67879474",
"0.67853445",
"0.6782881",
"0.6780776",
"0.6771602",
"0.677034",
"0.675178",
"0.6750408",
"0.67445666",
"0.6737812",
"0.6725832",
"0.6724149",
"0.67214304",
"0.672045",
"0.6717424",
"0.67166966",
"0.67044145",
"0.6700683",
"0.6686994",
"0.6657779",
"0.66445017",
"0.6629041",
"0.6608032",
"0.6602658",
"0.65934074",
"0.65852326",
"0.65791935",
"0.6574658",
"0.6565624",
"0.6560834",
"0.6520952",
"0.6514898",
"0.6511071",
"0.6467656",
"0.64670914"
] |
0.78956795
|
1
|
Create a project of a cooperative review space.
|
def create_reviewer_cooperative_project(space)
if ADMIN_USER != user.dxid
papi.call(
space.host_dxorg, "invite",
invitee: user.dxid,
level: "ADMIN",
suppressEmailNotification: true
)
end
project_dxid = api.call(
"project", "new",
name: "precisionfda-space-#{space.id}-HOST",
billTo: user.billto,
)["id"]
api.call(
project_dxid, "invite",
invitee: space.host_dxorg,
level: "CONTRIBUTE",
suppressEmailNotification: true,
suppressAllNotifications: true
)
api.call(
project_dxid, "invite",
invitee: space.guest_dxorg,
level: "CONTRIBUTE",
suppressEmailNotification: true,
suppressAllNotifications: true
)
api.call(
project_dxid, "invite",
invitee: Setting.review_app_developers_org,
level: "CONTRIBUTE",
suppressEmailNotification: true,
suppressAllNotifications: true,
)
space.host_project = project_dxid
space.save!
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_project (project, pledge_goal)\n Project.new(project, self, pledge_goal)\n end",
"def create\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:create PROJECTNAME\\nMust specify PROJECTNAME\")\n end\n\n args = [name,]\n is_public = false \n if options[:public]\n is_public= true\n ask_public(is_public)\n end \n validate_project_name(name)\n project_id = register_api_call(name,is_public) \n Mortar::Command::run(\"generate:project\", [name])\n FileUtils.cd(name)\n is_embedded = false\n if options[:embedded]\n is_embedded = true\n register_do(name, is_public, is_embedded, project_id)\n else\n git.git_init\n git.git(\"add .\")\n git.git(\"commit -m \\\"Mortar project scaffolding\\\"\") \n register_do(name, is_public, is_embedded, project_id)\n display \"NOTE: You'll need to change to the new directory to use your project:\\n cd #{name}\\n\\n\"\n end\n end",
"def set_review_project\n @proyect = Project.find(params[:id])\n @review_project = ReviewProject.find_or_create_by(:project_id => params[:id])\n end",
"def create(attributes, &block)\n GoodData.logger.info \"Creating project #{attributes[:title]}\"\n\n auth_token = attributes[:auth_token] || GoodData.connection.auth_token\n\n json = {:project =>\n {\n 'meta' => {\n 'title' => attributes[:title],\n 'summary' => attributes[:summary] || 'No summary'\n },\n 'content' => {\n 'guidedNavigation' => 1,\n 'authorizationToken' => auth_token,\n 'driver' => 'Pg'\n }\n }\n }\n json['meta']['projectTemplate'] = attributes[:template] if attributes[:template] && !attributes[:template].empty?\n project = Project.new json\n project.save\n if block\n GoodData::with_project(project) do |p|\n block.call(p)\n end\n end\n project\n end",
"def create_project(params)\n elektron_identity.post(\"projects\") { { project: params } }.body[\n \"project\"\n ]\n end",
"def create_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'POST'\n\t\targs[:pattern] = '/projects'\n\t\targs[:query]['Action'] = 'CreateProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project\n\t\t\targs[:body]['Project'] = optional[:project]\n\t\tend\n\t\tself.run(args)\n\tend",
"def create\n pr = params[:review]\n review = Review.new\n \n if review.cadastrar(current_user, pr[:project_id], pr[:tipo], pr[:texto])\n redirect_to project_path(review.project_id), :notice => 'Revisao Cadastrada Com Sucesso.'\n else\n flash[:error] = \"Revisao Nao Cadastrada #{review.errors.messages}.\"\n redirect_to project_path(review.project_id)\n end\n end",
"def create(options={})\n title = options[:title]\n summary = options[:summary]\n template = options[:template]\n token = options[:token]\n\n GoodData::Project.create(:title => title, :summary => summary, :template => template, :auth_token => token)\n end",
"def create_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :project\n\t\t\targs[:body]['Project'] = optional[:project]\n\t\tend\n\t\tself.run(args)\n\tend",
"def create_valid_project\n create_project_with 'Some test project'\n end",
"def create_project(name)\n post('projects', {:name => name})[\"project\"]\n end",
"def create\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:create PROJECT\\nMust specify PROJECT.\")\n end\n validate_arguments!\n \n unless git.has_dot_git?\n error(\"Can only create a mortar project for an existing git project. Please run:\\n\\ngit init\\ngit add .\\ngit commit -a -m \\\"first commit\\\"\\n\\nto initialize your project in git.\")\n end\n \n unless git.remotes(git_organization).empty?\n begin\n error(\"Currently in project: #{project.name}. You can not create a new project inside of an existing mortar project.\")\n rescue Mortar::Command::CommandFailed => cf\n error(\"Currently in an existing Mortar project. You can not create a new project inside of an existing mortar project.\")\n end\n end\n \n project_id = nil\n action(\"Sending request to create project: #{name}\") do\n project_id = api.post_project(name).body[\"project_id\"]\n end\n \n project_result = nil\n project_status = nil\n display\n ticking(polling_interval) do |ticks|\n project_result = api.get_project(project_id).body\n project_status = project_result.fetch(\"status_code\", project_result[\"status\"])\n project_description = project_result.fetch(\"status_description\", project_status)\n is_finished = Mortar::API::Projects::STATUSES_COMPLETE.include?(project_status)\n\n redisplay(\"Status: %s %s\" % [\n project_description + (is_finished ? \"\" : \"...\"),\n is_finished ? \" \" : spinner(ticks)],\n is_finished) # only display newline on last message\n if is_finished\n display\n break\n end\n end\n \n case project_status\n when Mortar::API::Projects::STATUS_FAILED\n error(\"Project creation failed.\\nError message: #{project_result['error_message']}\")\n when Mortar::API::Projects::STATUS_ACTIVE\n git.remote_add(\"mortar\", project_result['git_url'])\n display \"Your project is ready for use. Type 'mortar help' to see the commands you can perform on the project.\\n\\n\"\n else\n raise RuntimeError, \"Unknown project status: #{project_status} for project_id: #{project_id}\"\n end\n \n end",
"def create_project(options={})\n\t\t\tProject.create({\n\t\t\t\ttitle: \"Title example\",\n\t\t\t\tlevel: \"Easy\",\n\t\t\t\tcategory: \"Art\",\n\t\t\t\tdescription: \"Description example\"*20,\n\t\t\t\tstatus: \"Active\",\n\t\t\t\tpercentage: 50\n\t\t\t}.merge(options))\n\t\tend",
"def create_project(project)\n create_or_update(project, nil, 'project', 'projects')\n end",
"def create_project(options = {})\n project = Project.create(some_params(options))\n return project\n end",
"def create_shared_or_private_project(space)\n if ADMIN_USER != user.dxid\n admin_api.org_invite(\n space.host_dxorg,\n user.dxid,\n level: DNAnexusAPI::ORG_MEMBERSHIP_ADMIN,\n suppressEmailNotification: true,\n )\n end\n\n project_dxid = api.project_new(\n \"precisionfda-space-#{space.id}-HOST\",\n billTo: user.billto,\n )[\"id\"]\n\n api.project_invite(\n project_dxid,\n space.host_dxorg,\n DNAnexusAPI::PROJECT_ACCESS_ADMINISTER,\n suppressEmailNotification: true,\n suppressAllNotifications: true,\n )\n\n if space.shared?\n api.project_invite(\n project_dxid,\n space.guest_dxorg,\n DNAnexusAPI::PROJECT_ACCESS_CONTRIBUTE,\n suppressEmailNotification: true,\n suppressAllNotifications: true,\n )\n end\n\n api.project_invite(\n project_dxid,\n Setting.review_app_developers_org,\n DNAnexusAPI::PROJECT_ACCESS_CONTRIBUTE,\n suppressEmailNotification: true,\n suppressAllNotifications: true,\n )\n\n space.host_project = project_dxid\n space.save!\n end",
"def new_project(name:, component:, url_base:, branch:)\n # puts \"new_project(#{name}, #{component}, #{url_base})\"\n Project.new(name, component, url_base, branch: branch)\n end",
"def create_project\n unless options.force\n abort \"'#{project}' already exists\" if File.exist?( project ) \n end\n\n # copy over files from the master project data diretory in crate\n files = project_files\n files.keys.sort.each do |dir|\n mkdir dir\n files[dir].sort.each do |file|\n cp file \n end\n end\n end",
"def create(project_name, repo_name, description) ; end",
"def create\n initiative = Initiative.find_by_id(project_params[:initiative_id])\n if initiative.nil?\n @project = Project.new(project_params)\n else\n @project = initiative.projects.build(project_params)\n end\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @board, notice: @project.name + ' was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_project(widget)\n prince = \"\"\n \n # File chooser dialog\n chooserPrince = create_chooser @filter, Gtk::Stock::OK, \"Choose a prince text\"\n\n # Check the user input\n chooserPrince.run do |r|\n if r == Gtk::Dialog::RESPONSE_ACCEPT\n prince = chooserPrince.filename\n else\n chooserPrince.destroy\n return\n end\n end\n chooserPrince.destroy\n \n # Folder choose dialog\n chooser_destiny = create_folder_chooser\n \n # Check the user input\n chooser_destiny.run do |r|\n if r == Gtk::Dialog::RESPONSE_ACCEPT\n filename = chooser_destiny.filename\n @project.create_project prince, File.basename(filename), filename\n @treeView.create_tree @project\n end\n chooser_destiny.destroy\n end\n end",
"def create(attributes, &block)\n GoodData.logger.info \"Creating project #{attributes[:title]}\"\n\n auth_token = attributes[:auth_token] || GoodData.connection.auth_token\n fail 'You have to provide your token for creating projects as :auth_token parameter' if auth_token.nil? || auth_token.empty?\n\n json = {\n 'project' =>\n {\n 'meta' => {\n 'title' => attributes[:title],\n 'summary' => attributes[:summary] || 'No summary'\n },\n 'content' => {\n 'guidedNavigation' => attributes[:guided_navigation] || 1,\n 'authorizationToken' => auth_token,\n 'driver' => attributes[:driver] || 'Pg'\n }\n }\n }\n\n json['project']['meta']['projectTemplate'] = attributes[:template] if attributes[:template] && !attributes[:template].empty?\n project = Project.new json\n project.save\n\n # until it is enabled or deleted, recur. This should still end if there is a exception thrown out from RESTClient. This sometimes happens from WebApp when request is too long\n while project.state.to_s != 'enabled'\n if project.state.to_s == 'deleted'\n # if project is switched to deleted state, fail. This is usually problem of creating a template which is invalid.\n fail 'Project was marked as deleted during creation. This usually means you were trying to create from template and it failed.'\n end\n sleep(3)\n project.reload!\n end\n\n if block\n GoodData.with_project(project) do |p|\n block.call(p)\n end\n end\n sleep 3\n project\n end",
"def create_project(project)\n handle_action_exceptions(__method__) do\n cmd_line = [\"createproject '#{project}'\"]\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end",
"def create(attributes={})\n raw_response = post_request('projects', project: attributes)\n parse_response(raw_response, :project)\n end",
"def create\n @project = Project.create project_params\n current_user.memberships.create(\n project_id: @project.id,\n owner_at: Time.now\n )\n\n if @project.save\n render 'projects/create', status: 201\n else\n render 'projects/error', status: 422\n end\n end",
"def create \n\t\t@project = Project.new(project_params)\n\t\t@project.creator = current_user.id\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_project(name, type)\nend",
"def create\n @project = current_user.projects.create(params[:project])\n \n if @project.save\n record_activity(\"created new project: \" + @project.id.to_s)\n redirect_to root_path, :notice => \"Project created successfully\"\n else\n render 'new'\n end\n end",
"def project\n raw = client.get project_url\n client.factory.create(GoodData::Project, raw)\n end",
"def new_project\n @request = Request.new(data_type: :project)\n @request.build_contact\n @request.build_project\n @request.build_general_information\n\n render 'new'\n end",
"def new_project \n require 'fileutils'\n dir = \"./\" + @arguments.first\n Dir.mkdir(dir)\n %w[app config experiments report results test tmp vendor].each do |d|\n Dir.mkdir(dir + \"/\" + d)\n end\n basedir = File.dirname(__FILE__)\n File.open(File.join(dir, \"config\", \"config.yaml\"), \"w\") do |f|\n f << \"---\\nenvironments:\\n development:\\n compute:\\n\"\n end\n File.open(File.join(dir, \".gitignore\"), \"w\") do |f|\n f << \"tmp/*\"\n end\n FileUtils::cp File.join(basedir, \"generator/readme_template.txt\"), File.join(dir, \"README\")\n FileUtils::cp File.join(basedir, \"generator/Rakefile\"), File.join(dir, \"Rakefile\")\n FileUtils::cp File.join(basedir, \"generator/experiment_template.rb.txt\"), File.join(dir, \"experiments\", \"experiment.rb\")\n end",
"def createProject(description) \n project = Project.new \n project.Description = description \n @Projects.push(project) \n end",
"def create_project(project)\n pgtr = project.build_project_grid_table_row\n pgtr.title = project.book_title\n pgtr.genre = project.genres.map(&:name).join(\", \")\n pgtr.teamroom_link = project.teamroom_link\n\n roles = Hash[*Role.all.map{ | role | [role.name.downcase.gsub(/ /, \"_\").to_sym, role.id] }.flatten]\n\n # These are not roles in the PGTR\n roles.delete_if {|name, id| name == :advisor || name == :agent }\n\n # adding each role\n roles.each do | key, value |\n pgtr[key] = project.team_memberships.includes(:member).where(role_id: value).map(&:member).map(&:name).join(\", \")\n end\n\n # since the publisher only publishes :create_project on projects#create\n # there will only every be one author since we only allow one author selection\n # when creating a new project. We can also skip other_contributors\n author = project.team_memberships\n .includes(:member)\n .where(role: Role.find_by_name(\"Author\")).first.member\n\n pgtr.author_last_first = author.last_name_first\n pgtr.author_first_last = author.name\n\n # adding the current_tasks\n project.current_tasks.includes(:task => :workflow).each do | ct |\n keybase = ct.task.workflow.name.downcase.gsub(/ /, \"_\")\n pgtr[keybase + \"_task_id\"] = ct.task.id\n pgtr[keybase + \"_task_name\"] = ct.task.name\n pgtr[keybase + \"_task_display_name\"] = ct.task.display_name\n pgtr[keybase + \"_task_last_update\"] = Time.now.strftime(\"%Y-%m-%d %H:%M:%S\")\n end\n\n pgtr.save\n end",
"def create_project(name, description, client)\n\n\tproject = create(:project,\n\tname: name,\n\tstart_date: Date.today - rand(0..60),\n\tdeadline: Date.today + rand(30..60), \n\tdescription: description,\n\tclient: client)\n\n\t# Assign all three users to the project\n\tproject.users << User.all\n\n\t# Tasks\n\tget_tasks.each do |task|\n\t\tcreate(:project_task, project: project, task: task, hours_planned: rand(10..120))\n\tend\n\t\n\t# Some inputs\n\tinputs_count = rand(20..40)\n\tinputs_count.times do\n\t\tproject_task = project.project_tasks.all.sample\n\t\tuser = User.all.sample\n\t\tinput_date = Date.today - rand(-2..20)\n\t\thours = rand(1..24)\n\n\t\tcreate(:input, project_task: project_task, user: user , input_date: input_date, hours: hours)\n\tend\nend",
"def create\n #byebug\n @project = Project.new(create_params)\n @project.user_id = @current_user.id\n @project.save\n #@project = Project.create(name_project: \"prueba\", subsidy: true, parking: true, user_id: @current_user.id)\n #byebug\n render json: @project, status: :created\n end",
"def generate_project!(attributes={})\n identifier = \"a\" + Redmine::Utils.random_hex(6)\n Project.generate!(\n {\n :identifier => identifier,\n :name => identifier,\n :tracker_ids => [],\n :enabled_module_names => []\n }.merge(attributes)\n )\n end",
"def create\n @project = current_user.projects.build(params[:project])\n if @project.save\n flash[:success] = \"Project was successfully created.\"\n redirect_to root_path\n else\n flash[:error] = \"Failed to make project.\"\n render 'new'\n end\n end",
"def create_project options\n Project::create_folder options\n Project::create_db_row options\n end",
"def create_project(args)\n system %{#{bin} create #{args.join(' ')}}\n end",
"def create\n @project = Project.new(params[:project])\n @project.permalink = create_permalink(params[:project][:title])\n @project_membership = @project.project_memberships.build(:user_id => current_user.id, :role => \"founder\")\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_project(key, name, params = {})\n params[:key] = key\n params[:name] = name\n post('projects', params)\n end",
"def create_project_without_n_plus_1(*args)\n Gitlab::GitalyClient.allow_n_plus_1_calls do\n create(:project, :public, *args)\n end\n end",
"def create_document_template_project(user:, category:)\n Project.create(\n created_by: user,\n title: TEMPLATE_PROJECT_NAME,\n template_status: Project::DOCUMENT_TEMPLATE,\n category: category \n )\n end",
"def create\n @project = Project.new(project_params.merge({\n owner_id: current_user_id,\n owner_name: current_user_name,\n user_id: current_user_db_record.id\n }))\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @project = Project.new()\n end",
"def create\n @project = current_user.projects.build(project_params)\n @project.memberships.new(user: current_user,role:'Creator')\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@project = Project.new(params[:project].merge({:user_id => present_user.id}))\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tif @project.save\n\t\t\t\tformat.html { redirect_to @project, notice: t('app.projects.created') }\n\t\t\t\tformat.json { render json: @project, status: :created, location: @project }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @project = Project.new(project_params)\n @project.creator = current_user\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @project = @user.projects.new(project_params)\n @project.collaborates = [false]\n if @project.save\n success = @project.project_users.create!({user_id: current_user.id, role: 'project_manager'})\n else\n success = false\n end\n\n respond_to do |format|\n if success\n format.html { redirect_to project_documents_path(@project), notice: 'The project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_project\n empty_directory(project)\n end",
"def create\n if request.post? and params[:project]\n project = Project.new(params[:project])\n project.owner = @user.id\n project.save\n\n sprint = project.sprints.build\n sprint.name = \"Backlog\"\n sprint.status_id = 0\n sprint.created_by = @user.id\n sprint.save\n\n task = project.tasks.build\n task.name = \"General\"\n task.description = \"General Work\"\n task.type_id = 0\n task.sprint_id = sprint.id\n task.created_by = @user.id\n task.assigned_to = @user.id\n task.save\n\n flash[:message] = \"Project '#{project.name}' has been registered.\"\n else\n flash[:error] = \"No project data provided.\"\n end\n\n redirect_to :action => 'index'\n end",
"def create\n @project = @namespace.projects.new(project_params)\n @project.group_id = @namespace.group_id\n @project.user_id = @namespace.user_id\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @namespace, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n #@project.create_ci(params[:project][:ci_attributes])\n @project = Project.create( params[:project] )\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n #@user =User.create( params[:user])\n end",
"def create\n @projecct = Projecct.new(params[:projecct])\n\n respond_to do |format|\n if @projecct.save\n format.html { redirect_to @projecct, notice: 'Projecct was successfully created.' }\n format.json { render json: @projecct, status: :created, location: @projecct }\n else\n format.html { render action: \"new\" }\n format.json { render json: @projecct.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n @project.lead_id = current_user.id\n @project.workspace_id = params[:workspace_id]\n if @project.save\n 5.times do\n Task.create(name: \"New Task\", creator_id: current_user.id, workspace_id: current_user.homespace_id, project_id: @project.id)\n end\n\n render :show, status: :created\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def create_project(project)\n \n update_project(project)\n \n # TODO: Need to handle this exception...\n if (File.directory? project.svn_dir) then\n raise StandardError, \"A project called #{project.display_name} already exists in the #{project.client.display_name} repository. Please delete it or choose an alternate project name and run this script again.\"\n end\n \n # create a new subversion repository\n say(\"Creating a new subversion repository...\")\n `svnadmin create #{project.svn_dir}`\n \n # import into svn\n say(\"Importing temporary project into the new subversion repository...\")\n `svn import #{project.template}/svn file:///#{project.svn_dir} --message \"initial import\"`\n \n # this should fix the 'can't open activity db error'\n `sudo chmod 770 #{project.svn_dir}`\n activites_file = File.join(project.svn_dir,\"/dav/activities\")\n if File.exists?(activites_file)\n `sudo chmod 755 #{activites_file}`\n `sudo chown www-data:www-data #{activites_file}`\n end\n \n # install default post commit hook\n hook_file = File.join(project.svn_dir,\"hooks\",\"post-commit\")\n Template.new(File.join(Config.subtrac_path, \"svn\", \"post-commit.erb\")).write(hook_file)\n `sudo chmod +x #{hook_file}`\n\n end",
"def create\r\n\t\t\t@project = params[:id].present? ? Project.find(params[:id]) : Project.new(create_step: 0)\r\n\t\t\t\r\n\t\t\t# Author\r\n\t\t\tif @project.new_record?\r\n\t\t\t\tauthorize! :create, @project\r\n\t\t\telse\r\n\t\t\t\tauthorize! :edit, @project\r\n\t\t\tend\r\n\r\n\t\t\trender layout: 'layout_back'\r\n\t\tend",
"def create_project(name)\n response = @db.exec_params(%Q[\n INSERT INTO projects(name)\n VALUES ($1)\n RETURNING id;\n ], [name])\n\n response.first[\"id\"]\n end",
"def create_project(name, outputter, modules: nil)\n Bolt::ProjectManager.new(config, outputter, pal)\n .create(Dir.pwd, name, modules)\n end",
"def create\n @user = current_user\n @project = @user.projects.build(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\t\t@project.user_id =current_user.id\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n<<<<<<< HEAD:app/controllers/projects_controller.rb\n handle_disciplines_projects\n=======\n>>>>>>> 336471e6be257cf55c9afa2a65f928fde34e41fe:app/controllers/projects_controller.rb\n\n respond_to do |format|\n if @project.save\n flash[:notice] = 'Project was successfully created.'\n format.html { redirect_to(@project) }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_project(project_name, target_dollar_amount)\n @db.execute('insert into projects values(?, ?, ?);', nil, project_name, target_dollar_amount)\n end",
"def create\n @project = Project.new(project_params)\n @project.owner = current_user unless @project.owner\n if @project.save\n render :show, status: :created, location: @project\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def create\n @project = Project.new(params[:project])\n \n if @project.save\n flash[:success] = \"Project created\" \n redirect_to projects_url\n else\n flash[:danger] = \"Cannot create project\"\n render 'new'\n end\n end",
"def create\n @project = Project.new(project_params)\n @project.owner = current_user\n @pu = current_user.projectusers.new\n @pu.project = @project\n @pu.save\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def project_create(project_name)\n # Make sure that proper values where provided\n spool_path = ::File.join(Msf::Config.log_directory, 'projects', project_name)\n ::FileUtils.mkdir_p(spool_path)\n spool_file = ::File.join(spool_path, \"#{project_name}_spool.log\")\n if framework.db and framework.db.active\n print_line(\"Creating DB Workspace named #{project_name}\")\n workspace = framework.db.add_workspace(project_name)\n framework.db.workspace = workspace\n print_line(\"Added workspace: #{workspace.name}\")\n driver.init_ui(driver.input, Rex::Ui::Text::Output::Tee.new(spool_file))\n\n # Restore the prompt so we don't get \"msf > >\".\n #prompt = framework.datastore['Prompt'] || Msf::Ui::Console::Driver::DefaultPrompt\n #prompt_char = framework.datastore['PromptChar'] || Msf::Ui::Console::Driver::DefaultPromptChar\n #if active_module # if there is an active module, give them the fanciness they have come to expect\n # driver.update_prompt(\"#{prompt} #{mod.type}(%bld%red#{mod.shortname}%clr) \", prompt_char, true)\n #else\n # driver.update_prompt(\"#{prompt} \", prompt_char, true)\n #end\n\n print_line(\"Spooling to file #{spool_file}...\")\n else\n print_error('A database most be configured and connected to create a project')\n end\n return true\n end",
"def create\n @project = Project.new(params[:project])\n @project.roles.build name: Role.role_types.first,\n user: User.find(session[:id])\n begin \n n_invitations = @project.add_colaborators\n notice = 'Project was successfully created. '\n \n notice += '1 user has been automatically added to the project.' if n_invitations == 1\n notice += n_invitations.to_s + ' users have been automatically added to the project.' if n_invitations > 1\n\n rescue\n redirect_to @project, notice: \"An error occurred. You may have entered invalid github information.\"\n return\n end \n \n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: notice }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cpro_project = CproProject.new(params[:cpro_project])\n\n respond_to do |format|\n if @cpro_project.save\n flash[:notice] = 'CproProject was successfully created.'\n format.html { redirect_to(@cpro_project) }\n format.xml { render :xml => @cpro_project, :status => :created, :location => @cpro_project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cpro_project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_project_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectApi.create_project ...'\n end\n # resource path\n local_var_path = '/projects'\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 content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_project_body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Project'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oryAccessToken']\n\n new_options = opts.merge(\n :operation => :\"ProjectApi.create_project\",\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: ProjectApi#create_project\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @project = Project.new(project_params)\n authorize! :create, @project\n @project.user_id ||= current_user.id\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:project_id]\n cloned_from = Project.find(params[:project_id])\n @project = cloned_from.clone(params, @cur_user.id)\n else\n @cloned_project = nil\n @project = Project.new project_params\n @project.user_id = @cur_user.id\n end\n\n respond_to do |format|\n if @project.save\n format.html do\n redirect_to @project, notice: 'Project was successfully created.'\n end\n format.json do\n render json: @project.to_hash(false),\n status: :created, location: @project\n end\n else\n flash[:error] = @project.errors.full_messages\n format.html { redirect_to projects_path }\n format.json do\n render json: @project.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def create\n\t\t@project = current_user.projects.new(project_params)\n\n\t\trespond_to do |format|\n\t\t\tif @project.save\n\t\t\t\tformat.json { render :show, status: :created }\n\t\t\telse\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create_reviewer_confidential_space(shared_space, space_form)\n space = shared_space.confidential_spaces.create!(\n name: shared_space.name,\n description: shared_space.description,\n space_type: shared_space.space_type,\n cts: shared_space.cts,\n state: shared_space.state,\n host_dxorg: shared_space.host_dxorg,\n restrict_to_template: space_form.restrict_to_template,\n )\n\n project_dxid = api.project_new(\n \"precisionfda-space-#{space.id}-REVIEWER-PRIVATE\",\n billTo: user.billto,\n )[\"id\"]\n\n space.host_project = project_dxid\n space.save!\n\n api.project_invite(\n project_dxid,\n space.host_dxorg,\n DNAnexusAPI::PROJECT_ACCESS_CONTRIBUTE,\n suppressEmailNotification: true,\n suppressAllNotifications: true,\n )\n\n api.project_invite(\n project_dxid,\n Setting.review_app_developers_org,\n DNAnexusAPI::PROJECT_ACCESS_CONTRIBUTE,\n suppressEmailNotification: true,\n suppressAllNotifications: true,\n )\n\n duplicate_space(space, space_form.source_space_id)\n end",
"def new\n if current_user == nil\n @project = Project.new\n return\n end\n @project = current_user.projects.new\n end",
"def create\n @curriculum_project = CurriculumProject.new(curriculum_project_params)\n\n respond_to do |format|\n if @curriculum_project.save\n format.html { redirect_to @curriculum_project, notice: 'Curriculum project was successfully created.' }\n format.json { render :show, status: :created, location: @curriculum_project }\n else\n format.html { render :new }\n format.json { render json: @curriculum_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_project(uid, name, owner, project_profile)\n cl = client(\"Projects\", uid)\n response = cl.call(:create_project, message: {\n projectid: name,\n owner: owner,\n profile: project_profile.map { |f, v| { name: f, value: v.to_s } }\n })\n\n raise Error unless response.success?\n\n return response.to_hash[:create_project_response][:return]\n rescue Savon::SOAPFault => e\n process_error e\n end",
"def create\n @project = @user.projects.create(project_params)\n\n # Save and redirect to user projects with a notice at the top saying that the project has been created\n\n if @project.save\n redirect_to(user_projects_path(@project), notice: 'Project was successfully created.')\n else\n render action: 'new'\n end\n end",
"def create(source_project, target_project, prefix = '', repositories='*')\n fail 'Source project should not be null' if source_project.nil?\n fail 'Target project should not be null' if target_project.nil?\n\n @prefix = prefix\n @repositories = repositories\n @source_project = source_project\n @target_project = target_project\n\n puts \"Creating the project with prefix '#{prefix}', repositories '#{repositories}', source project '#{source_project}' and target project '#{target_project}'\"\n\n bootstrap unless File.directory?(folder) and File.exists?(project_file)\n load_attributes\n\n pp @attributes\n end",
"def create\n \tif user_signed_in? then\n\t\t\t@project = Project.new(params[:project])\n authorize @project\n\t\t\tif @project.dmptemplate.nil? && params[:project][:funder_id] != \"\" then # this shouldn't be necessary - see setter for funder_id in project.rb\n\t\t\t\tfunder = Organisation.find(params[:project][:funder_id])\n\t\t\t\tif funder.dmptemplates.count == 1 then\n\t\t\t\t\t@project.dmptemplate = funder.published_templates.first\n\t\t\t\tend\n\t\t\telsif @project.dmptemplate.nil? || params[:default_tag] == 'true' then\n\t\t\t\tif @project.organisation.nil? || params[:default_tag] == 'true' || @project.organisation.published_templates.first.nil? then\n\t\t\t\t\t@project.dmptemplate = Dmptemplate.find_by_is_default(true)\n\t\t\t\telse\n\t\t\t\t\t@project.dmptemplate = @project.organisation.published_templates.first\n\t\t\t\tend\n\t\t\tend\n\t\t\t@project.principal_investigator = current_user.name(false)\n\n\t\t\t@project.title = I18n.t('helpers.project.my_project_name')+' ('+@project.dmptemplate.title+')'\n\t\t\t@project.assign_creator(current_user.id)\n\t\t\trespond_to do |format|\n\t\t\t\tif @project.save\n\t\t\t\t\tformat.html { redirect_to({:action => \"show\", :id => @project.slug, :show_form => \"yes\"}, {:notice => I18n.t('helpers.project.success')}) }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\trender(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)\n\t\tend\n\tend",
"def create\n @project = @sprint.projects.create(params[:project])\n\n respond_to do |format|\n if @project.valid?\n flash[:notice] = 'Project was successfully created.'\n format.html { redirect_to project_url(@sprint, @project) }\n format.xml { head :created, :location => project_url(@project) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors.to_xml }\n end\n end\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def create\n @project = Project.new(project_params)\n @project.user_id = current_user.id\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n @project.user_id = current_user.id\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n @project.user_id = current_user.id\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @past_project = PastProject.new(past_project_params)\n\n respond_to do |format|\n if @past_project.save\n format.html { redirect_to @past_project, notice: 'Past project was successfully created.' }\n format.json { render json: @past_project, status: :created, location: @past_project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @past_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n @project.save\n redirect_to @project\n end",
"def create_reviewer_confidential_space(shared_space, space_form)\n space = shared_space.confidential_spaces.create!(\n name: shared_space.name,\n description: shared_space.description,\n space_type: shared_space.space_type,\n cts: shared_space.cts,\n state: shared_space.state,\n host_dxorg: shared_space.host_dxorg,\n restrict_to_template: space_form.restrict_to_template,\n )\n\n project_dxid = api.call(\n \"project\", \"new\",\n name: \"precisionfda-space-#{space.id}-REVIEWER-PRIVATE\",\n billTo: user.billto,\n )[\"id\"]\n\n space.host_project = project_dxid\n space.save!\n\n api.call(\n project_dxid, \"invite\",\n invitee: space.host_dxorg,\n level: \"CONTRIBUTE\",\n suppressEmailNotification: true,\n suppressAllNotifications: true,\n )\n\n api.call(\n project_dxid, \"invite\",\n invitee: Setting.review_app_developers_org,\n level: \"CONTRIBUTE\",\n suppressEmailNotification: true,\n suppressAllNotifications: true,\n )\n\n apply_space_template(space)\n end",
"def build\n CircleCi.request(@conf, \"/project/#{username}/#{project}\").post\n end"
] |
[
"0.68930215",
"0.65978414",
"0.65761304",
"0.6571514",
"0.65533745",
"0.65262187",
"0.65135425",
"0.64749277",
"0.64422035",
"0.6402188",
"0.64003485",
"0.63773036",
"0.6349652",
"0.63400304",
"0.6294244",
"0.62593",
"0.6241359",
"0.6240975",
"0.62366915",
"0.6218934",
"0.62074286",
"0.62014693",
"0.61703444",
"0.61670876",
"0.6136752",
"0.6136376",
"0.6133859",
"0.6108755",
"0.61027294",
"0.6057243",
"0.6046937",
"0.6033572",
"0.6031638",
"0.6030258",
"0.60162103",
"0.6003122",
"0.5995778",
"0.59715134",
"0.5965863",
"0.5963159",
"0.5960793",
"0.5946846",
"0.59398544",
"0.59390444",
"0.59310365",
"0.5927036",
"0.5907877",
"0.5906701",
"0.58493984",
"0.58489597",
"0.5842385",
"0.58133435",
"0.5807624",
"0.5801815",
"0.57999384",
"0.57803786",
"0.5774085",
"0.5770271",
"0.57581997",
"0.5754995",
"0.57526314",
"0.5751773",
"0.5750001",
"0.5745491",
"0.5744607",
"0.57362604",
"0.57326317",
"0.5729774",
"0.57282966",
"0.57268333",
"0.5726234",
"0.5723525",
"0.57215923",
"0.5721098",
"0.571982",
"0.5716656",
"0.57151276",
"0.57096195",
"0.5703199",
"0.56961274",
"0.56907773",
"0.5687009",
"0.5687009",
"0.5687009",
"0.5687009",
"0.5687009",
"0.5687009",
"0.5687009",
"0.5687009",
"0.5687009",
"0.5687009",
"0.5687009",
"0.5687009",
"0.5683866",
"0.5683866",
"0.56817806",
"0.567068",
"0.5669913",
"0.566857",
"0.56672114"
] |
0.78070325
|
0
|
Create a project of a confidential review space.
|
def create_reviewer_confidential_space(shared_space, space_form)
space = shared_space.confidential_spaces.create!(
name: shared_space.name,
description: shared_space.description,
space_type: shared_space.space_type,
cts: shared_space.cts,
state: shared_space.state,
host_dxorg: shared_space.host_dxorg,
restrict_to_template: space_form.restrict_to_template,
)
project_dxid = api.call(
"project", "new",
name: "precisionfda-space-#{space.id}-REVIEWER-PRIVATE",
billTo: user.billto,
)["id"]
space.host_project = project_dxid
space.save!
api.call(
project_dxid, "invite",
invitee: space.host_dxorg,
level: "CONTRIBUTE",
suppressEmailNotification: true,
suppressAllNotifications: true,
)
api.call(
project_dxid, "invite",
invitee: Setting.review_app_developers_org,
level: "CONTRIBUTE",
suppressEmailNotification: true,
suppressAllNotifications: true,
)
apply_space_template(space)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_reviewer_cooperative_project(space)\n if ADMIN_USER != user.dxid\n papi.call(\n space.host_dxorg, \"invite\",\n invitee: user.dxid,\n level: \"ADMIN\",\n suppressEmailNotification: true\n )\n end\n\n project_dxid = api.call(\n \"project\", \"new\",\n name: \"precisionfda-space-#{space.id}-HOST\",\n billTo: user.billto,\n )[\"id\"]\n\n api.call(\n project_dxid, \"invite\",\n invitee: space.host_dxorg,\n level: \"CONTRIBUTE\",\n suppressEmailNotification: true,\n suppressAllNotifications: true\n )\n\n api.call(\n project_dxid, \"invite\",\n invitee: space.guest_dxorg,\n level: \"CONTRIBUTE\",\n suppressEmailNotification: true,\n suppressAllNotifications: true\n )\n\n api.call(\n project_dxid, \"invite\",\n invitee: Setting.review_app_developers_org,\n level: \"CONTRIBUTE\",\n suppressEmailNotification: true,\n suppressAllNotifications: true,\n )\n\n space.host_project = project_dxid\n space.save!\n end",
"def create_reviewer_confidential_space(shared_space, space_form)\n space = shared_space.confidential_spaces.create!(\n name: shared_space.name,\n description: shared_space.description,\n space_type: shared_space.space_type,\n cts: shared_space.cts,\n state: shared_space.state,\n host_dxorg: shared_space.host_dxorg,\n restrict_to_template: space_form.restrict_to_template,\n )\n\n project_dxid = api.project_new(\n \"precisionfda-space-#{space.id}-REVIEWER-PRIVATE\",\n billTo: user.billto,\n )[\"id\"]\n\n space.host_project = project_dxid\n space.save!\n\n api.project_invite(\n project_dxid,\n space.host_dxorg,\n DNAnexusAPI::PROJECT_ACCESS_CONTRIBUTE,\n suppressEmailNotification: true,\n suppressAllNotifications: true,\n )\n\n api.project_invite(\n project_dxid,\n Setting.review_app_developers_org,\n DNAnexusAPI::PROJECT_ACCESS_CONTRIBUTE,\n suppressEmailNotification: true,\n suppressAllNotifications: true,\n )\n\n duplicate_space(space, space_form.source_space_id)\n end",
"def create\n pr = params[:review]\n review = Review.new\n \n if review.cadastrar(current_user, pr[:project_id], pr[:tipo], pr[:texto])\n redirect_to project_path(review.project_id), :notice => 'Revisao Cadastrada Com Sucesso.'\n else\n flash[:error] = \"Revisao Nao Cadastrada #{review.errors.messages}.\"\n redirect_to project_path(review.project_id)\n end\n end",
"def create_project (project, pledge_goal)\n Project.new(project, self, pledge_goal)\n end",
"def set_review_project\n @proyect = Project.find(params[:id])\n @review_project = ReviewProject.find_or_create_by(:project_id => params[:id])\n end",
"def create_valid_project\n create_project_with 'Some test project'\n end",
"def create(options={})\n title = options[:title]\n summary = options[:summary]\n template = options[:template]\n token = options[:token]\n\n GoodData::Project.create(:title => title, :summary => summary, :template => template, :auth_token => token)\n end",
"def create_shared_or_private_project(space)\n if ADMIN_USER != user.dxid\n admin_api.org_invite(\n space.host_dxorg,\n user.dxid,\n level: DNAnexusAPI::ORG_MEMBERSHIP_ADMIN,\n suppressEmailNotification: true,\n )\n end\n\n project_dxid = api.project_new(\n \"precisionfda-space-#{space.id}-HOST\",\n billTo: user.billto,\n )[\"id\"]\n\n api.project_invite(\n project_dxid,\n space.host_dxorg,\n DNAnexusAPI::PROJECT_ACCESS_ADMINISTER,\n suppressEmailNotification: true,\n suppressAllNotifications: true,\n )\n\n if space.shared?\n api.project_invite(\n project_dxid,\n space.guest_dxorg,\n DNAnexusAPI::PROJECT_ACCESS_CONTRIBUTE,\n suppressEmailNotification: true,\n suppressAllNotifications: true,\n )\n end\n\n api.project_invite(\n project_dxid,\n Setting.review_app_developers_org,\n DNAnexusAPI::PROJECT_ACCESS_CONTRIBUTE,\n suppressEmailNotification: true,\n suppressAllNotifications: true,\n )\n\n space.host_project = project_dxid\n space.save!\n end",
"def create_project(params)\n elektron_identity.post(\"projects\") { { project: params } }.body[\n \"project\"\n ]\n end",
"def create\n @project = Project.create project_params\n current_user.memberships.create(\n project_id: @project.id,\n owner_at: Time.now\n )\n\n if @project.save\n render 'projects/create', status: 201\n else\n render 'projects/error', status: 422\n end\n end",
"def create(attributes, &block)\n GoodData.logger.info \"Creating project #{attributes[:title]}\"\n\n auth_token = attributes[:auth_token] || GoodData.connection.auth_token\n\n json = {:project =>\n {\n 'meta' => {\n 'title' => attributes[:title],\n 'summary' => attributes[:summary] || 'No summary'\n },\n 'content' => {\n 'guidedNavigation' => 1,\n 'authorizationToken' => auth_token,\n 'driver' => 'Pg'\n }\n }\n }\n json['meta']['projectTemplate'] = attributes[:template] if attributes[:template] && !attributes[:template].empty?\n project = Project.new json\n project.save\n if block\n GoodData::with_project(project) do |p|\n block.call(p)\n end\n end\n project\n end",
"def create_project(name)\n post('projects', {:name => name})[\"project\"]\n end",
"def create_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'POST'\n\t\targs[:pattern] = '/projects'\n\t\targs[:query]['Action'] = 'CreateProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project\n\t\t\targs[:body]['Project'] = optional[:project]\n\t\tend\n\t\tself.run(args)\n\tend",
"def create\n \tif user_signed_in? then\n\t\t\t@project = Project.new(params[:project])\n authorize @project\n\t\t\tif @project.dmptemplate.nil? && params[:project][:funder_id] != \"\" then # this shouldn't be necessary - see setter for funder_id in project.rb\n\t\t\t\tfunder = Organisation.find(params[:project][:funder_id])\n\t\t\t\tif funder.dmptemplates.count == 1 then\n\t\t\t\t\t@project.dmptemplate = funder.published_templates.first\n\t\t\t\tend\n\t\t\telsif @project.dmptemplate.nil? || params[:default_tag] == 'true' then\n\t\t\t\tif @project.organisation.nil? || params[:default_tag] == 'true' || @project.organisation.published_templates.first.nil? then\n\t\t\t\t\t@project.dmptemplate = Dmptemplate.find_by_is_default(true)\n\t\t\t\telse\n\t\t\t\t\t@project.dmptemplate = @project.organisation.published_templates.first\n\t\t\t\tend\n\t\t\tend\n\t\t\t@project.principal_investigator = current_user.name(false)\n\n\t\t\t@project.title = I18n.t('helpers.project.my_project_name')+' ('+@project.dmptemplate.title+')'\n\t\t\t@project.assign_creator(current_user.id)\n\t\t\trespond_to do |format|\n\t\t\t\tif @project.save\n\t\t\t\t\tformat.html { redirect_to({:action => \"show\", :id => @project.slug, :show_form => \"yes\"}, {:notice => I18n.t('helpers.project.success')}) }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\trender(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)\n\t\tend\n\tend",
"def create\n @project = current_user.projects.create(params[:project])\n \n if @project.save\n record_activity(\"created new project: \" + @project.id.to_s)\n redirect_to root_path, :notice => \"Project created successfully\"\n else\n render 'new'\n end\n end",
"def create\r\n\t\t\t@project = params[:id].present? ? Project.find(params[:id]) : Project.new(create_step: 0)\r\n\t\t\t\r\n\t\t\t# Author\r\n\t\t\tif @project.new_record?\r\n\t\t\t\tauthorize! :create, @project\r\n\t\t\telse\r\n\t\t\t\tauthorize! :edit, @project\r\n\t\t\tend\r\n\r\n\t\t\trender layout: 'layout_back'\r\n\t\tend",
"def create_project(project)\n create_or_update(project, nil, 'project', 'projects')\n end",
"def new_project\n @request = Request.new(data_type: :project)\n @request.build_contact\n @request.build_project\n @request.build_general_information\n\n render 'new'\n end",
"def create_project(project)\n handle_action_exceptions(__method__) do\n cmd_line = [\"createproject '#{project}'\"]\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end",
"def create\n @project = current_user.projects.build(params[:project])\n if @project.save\n flash[:success] = \"Project was successfully created.\"\n redirect_to root_path\n else\n flash[:error] = \"Failed to make project.\"\n render 'new'\n end\n end",
"def create_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :project\n\t\t\targs[:body]['Project'] = optional[:project]\n\t\tend\n\t\tself.run(args)\n\tend",
"def create\n #byebug\n @project = Project.new(create_params)\n @project.user_id = @current_user.id\n @project.save\n #@project = Project.create(name_project: \"prueba\", subsidy: true, parking: true, user_id: @current_user.id)\n #byebug\n render json: @project, status: :created\n end",
"def create \n\t\t@project = Project.new(project_params)\n\t\t@project.creator = current_user.id\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n authorize! :create, @project\n @project.user_id ||= current_user.id\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params.merge({\n owner_id: current_user_id,\n owner_name: current_user_name,\n user_id: current_user_db_record.id\n }))\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_project(options = {})\n project = Project.create(some_params(options))\n return project\n end",
"def create_project(options={})\n\t\t\tProject.create({\n\t\t\t\ttitle: \"Title example\",\n\t\t\t\tlevel: \"Easy\",\n\t\t\t\tcategory: \"Art\",\n\t\t\t\tdescription: \"Description example\"*20,\n\t\t\t\tstatus: \"Active\",\n\t\t\t\tpercentage: 50\n\t\t\t}.merge(options))\n\t\tend",
"def create\n @project = Project.new(params[:project])\n @project.permalink = create_permalink(params[:project][:title])\n @project_membership = @project.project_memberships.build(:user_id => current_user.id, :role => \"founder\")\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_project(project_name, target_dollar_amount)\n @db.execute('insert into projects values(?, ?, ?);', nil, project_name, target_dollar_amount)\n end",
"def create(attributes, &block)\n GoodData.logger.info \"Creating project #{attributes[:title]}\"\n\n auth_token = attributes[:auth_token] || GoodData.connection.auth_token\n fail 'You have to provide your token for creating projects as :auth_token parameter' if auth_token.nil? || auth_token.empty?\n\n json = {\n 'project' =>\n {\n 'meta' => {\n 'title' => attributes[:title],\n 'summary' => attributes[:summary] || 'No summary'\n },\n 'content' => {\n 'guidedNavigation' => attributes[:guided_navigation] || 1,\n 'authorizationToken' => auth_token,\n 'driver' => attributes[:driver] || 'Pg'\n }\n }\n }\n\n json['project']['meta']['projectTemplate'] = attributes[:template] if attributes[:template] && !attributes[:template].empty?\n project = Project.new json\n project.save\n\n # until it is enabled or deleted, recur. This should still end if there is a exception thrown out from RESTClient. This sometimes happens from WebApp when request is too long\n while project.state.to_s != 'enabled'\n if project.state.to_s == 'deleted'\n # if project is switched to deleted state, fail. This is usually problem of creating a template which is invalid.\n fail 'Project was marked as deleted during creation. This usually means you were trying to create from template and it failed.'\n end\n sleep(3)\n project.reload!\n end\n\n if block\n GoodData.with_project(project) do |p|\n block.call(p)\n end\n end\n sleep 3\n project\n end",
"def create_project(key, name, params = {})\n params[:key] = key\n params[:name] = name\n post('projects', params)\n end",
"def create(attributes={})\n raw_response = post_request('projects', project: attributes)\n parse_response(raw_response, :project)\n end",
"def create\n initiative = Initiative.find_by_id(project_params[:initiative_id])\n if initiative.nil?\n @project = Project.new(project_params)\n else\n @project = initiative.projects.build(project_params)\n end\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @board, notice: @project.name + ' was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @create_project = current_user.projects.build(params[:project])\n flash[:notice] = \"Project #{@create_project.description} successfully created\" if @create_project.save\n respond_with(@create_project, layout: !request.xhr?)\n end",
"def create\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:create PROJECTNAME\\nMust specify PROJECTNAME\")\n end\n\n args = [name,]\n is_public = false \n if options[:public]\n is_public= true\n ask_public(is_public)\n end \n validate_project_name(name)\n project_id = register_api_call(name,is_public) \n Mortar::Command::run(\"generate:project\", [name])\n FileUtils.cd(name)\n is_embedded = false\n if options[:embedded]\n is_embedded = true\n register_do(name, is_public, is_embedded, project_id)\n else\n git.git_init\n git.git(\"add .\")\n git.git(\"commit -m \\\"Mortar project scaffolding\\\"\") \n register_do(name, is_public, is_embedded, project_id)\n display \"NOTE: You'll need to change to the new directory to use your project:\\n cd #{name}\\n\\n\"\n end\n end",
"def create\n @project = Project.new(params[:project])\n \n if @project.save\n flash[:success] = \"Project created\" \n redirect_to projects_url\n else\n flash[:danger] = \"Cannot create project\"\n render 'new'\n end\n end",
"def create\n @project = Project.new(project_params)\n @project.owner = current_user unless @project.owner\n if @project.save\n render :show, status: :created, location: @project\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def create\n @project = Project.new(params[:project])\n #@project.create_ci(params[:project][:ci_attributes])\n @project = Project.create( params[:project] )\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n #@user =User.create( params[:user])\n end",
"def create\n @curriculum_project = CurriculumProject.new(curriculum_project_params)\n\n respond_to do |format|\n if @curriculum_project.save\n format.html { redirect_to @curriculum_project, notice: 'Curriculum project was successfully created.' }\n format.json { render :show, status: :created, location: @curriculum_project }\n else\n format.html { render :new }\n format.json { render json: @curriculum_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n @project.creator = current_user\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def create(project_name, repo_name, description) ; end",
"def create\n if request.post? and params[:project]\n project = Project.new(params[:project])\n project.owner = @user.id\n project.save\n\n sprint = project.sprints.build\n sprint.name = \"Backlog\"\n sprint.status_id = 0\n sprint.created_by = @user.id\n sprint.save\n\n task = project.tasks.build\n task.name = \"General\"\n task.description = \"General Work\"\n task.type_id = 0\n task.sprint_id = sprint.id\n task.created_by = @user.id\n task.assigned_to = @user.id\n task.save\n\n flash[:message] = \"Project '#{project.name}' has been registered.\"\n else\n flash[:error] = \"No project data provided.\"\n end\n\n redirect_to :action => 'index'\n end",
"def new\n @project = Project.new()\n end",
"def project\n raw = client.get project_url\n client.factory.create(GoodData::Project, raw)\n end",
"def create\n @project = Project.new(params[:project])\n<<<<<<< HEAD:app/controllers/projects_controller.rb\n handle_disciplines_projects\n=======\n>>>>>>> 336471e6be257cf55c9afa2a65f928fde34e41fe:app/controllers/projects_controller.rb\n\n respond_to do |format|\n if @project.save\n flash[:notice] = 'Project was successfully created.'\n format.html { redirect_to(@project) }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\t\t@project.user_id =current_user.id\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = @sprint.projects.create(params[:project])\n\n respond_to do |format|\n if @project.valid?\n flash[:notice] = 'Project was successfully created.'\n format.html { redirect_to project_url(@sprint, @project) }\n format.xml { head :created, :location => project_url(@project) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors.to_xml }\n end\n end\n end",
"def create\n @project = Salesforce::Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(@project, :notice => 'Salesforce::Project was successfully created.') }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n @project.user_id = current_user.id\n\n respond_to do |format|\n if @project.save\n flash[:notice] = 'Project was successfully created.'\n format.html { redirect_to(@project) }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_document_template_project(user:, category:)\n Project.create(\n created_by: user,\n title: TEMPLATE_PROJECT_NAME,\n template_status: Project::DOCUMENT_TEMPLATE,\n category: category \n )\n end",
"def create\n @project = Project.new(project_params)\n @new_task = Task.new\n\n unless @project.save\n head :unprocessable_entity\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n if @project.save\n flash[:notice] = t('projects.create.notice')\n redirect_to projects_path\n else\n render :action => \"new\"\n end\n end",
"def create\n @project = Project.new(project_params)\n current_user.projects << @project\n authorize @project\n if @project.save\n redirect_to @project, notice: I18n.t('flash.actions.project.create.notice')\n else\n render :new \n end\n end",
"def create\n @project = Project.new(params[:project])\n @project.user_id = current_user.id;\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to edit_project_path(@project) }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@project = Project.new(params[:project].merge({:user_id => present_user.id}))\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tif @project.save\n\t\t\t\tformat.html { redirect_to @project, notice: t('app.projects.created') }\n\t\t\t\tformat.json { render json: @project, status: :created, location: @project }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n project_params[:owner_id] = current_user.id if project_params[:owner_id].nil? or not current_user.is_admin?\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_url, notice: 'Project was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: 'new' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n @project.user_id = current_user.id\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n @project.user_id = current_user.id\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n @project.user_id = current_user.id\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n repo = ProjectRepo.new current_user\n project = VProject.create(params[:v_project])\n @v_project = repo.create(project)\n\n respond_to do |format|\n if @v_project.save\n format.html { redirect_to @v_project, notice: 'V project was successfully created.' }\n format.json { render json: @v_project, status: :created, location: @v_project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @v_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n @project.account_id = current_user.account_id\n respond_to do |format|\n if @project.save\n format.html { redirect_to(projects_path, :notice => 'Project was successfully created.') }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n else\n format.html { render :action => \"new\", :error => 'Erro' }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@project = current_user.projects.new(project_params)\n\n\t\trespond_to do |format|\n\t\t\tif @project.save\n\t\t\t\tformat.json { render :show, status: :created }\n\t\t\telse\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create_project(name, type)\nend",
"def create\n @project = @namespace.projects.new(project_params)\n @project.group_id = @namespace.group_id\n @project.user_id = @namespace.user_id\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @namespace, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n @project.save\n redirect_to @project\n end",
"def create\n @project = current_user.projects.build(project_params)\n @project.memberships.new(user: current_user,role:'Creator')\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @design = current_user.designs.where(project_id: @project.id).create(design_params)\n\n if @design.save\n @design.create_variables_from_questions!\n redirect_to edit_project_design_path(@project, @design)\n else\n render :new\n end\n end",
"def create\n user = cookies[\"user_id\"]\n the_project = cookies[\"current_project\"]\n # the_project_id = Project.find_by(\"id\" => the_project)\n Comment.create(\"summary\" => params[\"summary\"], \"project_id\" => the_project, \"user_id\" => user)\n redirect_to \"/projects\", :notice => \"Comment Added\"\n end",
"def create_project\n unless options.force\n abort \"'#{project}' already exists\" if File.exist?( project ) \n end\n\n # copy over files from the master project data diretory in crate\n files = project_files\n files.keys.sort.each do |dir|\n mkdir dir\n files[dir].sort.each do |file|\n cp file \n end\n end\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def create\n @project = current_user.projects.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = @user.projects.new(project_params)\n @project.collaborates = [false]\n if @project.save\n success = @project.project_users.create!({user_id: current_user.id, role: 'project_manager'})\n else\n success = false\n end\n\n respond_to do |format|\n if success\n format.html { redirect_to project_documents_path(@project), notice: 'The project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @projecct = Projecct.new(params[:projecct])\n\n respond_to do |format|\n if @projecct.save\n format.html { redirect_to @projecct, notice: 'Projecct was successfully created.' }\n format.json { render json: @projecct, status: :created, location: @projecct }\n else\n format.html { render action: \"new\" }\n format.json { render json: @projecct.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pds_project = PdsProject.new(pds_project_params)\n\n respond_to do |format|\n if @pds_project.save\n format.html { redirect_to @pds_project, notice: 'Pds project was successfully created.' }\n format.json { render :show, status: :created, location: @pds_project }\n else\n format.html { render :new }\n format.json { render json: @pds_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = current_user\n @project = @user.projects.build(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n if current_user == nil\n @project = Project.new\n return\n end\n @project = current_user.projects.new\n end",
"def create\n @project = Project.new(project_params.merge(user_id: current_user.id))\n\n respond_to do |format|\n if @project.save\n format.json { render :show, status: :created, location: @project }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n if @project.save\n redirect_to \"/charity_lp/landingpage\", notice: 'Research Form was successfully created.'\n # format.json { render :show, status: :created, location: @project }\n else\n render 'new'\n\n # format.html {redirect_to \"/projects/new\", notice: 'Errors in submition, please ensure all fields are filled in correctly' }\n # format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end",
"def new\n\t\tif params[:project][:terms] == '0'\n\t\t\tflash[:error] = \"You must agree to the terms before creating a project\"\n\t\t\tredirect_to :action => :terms, :account_id => current_usertype.account_id\n\t\tend\n\n\t\t@project = Project.new\n\tend",
"def new_project(widget)\n prince = \"\"\n \n # File chooser dialog\n chooserPrince = create_chooser @filter, Gtk::Stock::OK, \"Choose a prince text\"\n\n # Check the user input\n chooserPrince.run do |r|\n if r == Gtk::Dialog::RESPONSE_ACCEPT\n prince = chooserPrince.filename\n else\n chooserPrince.destroy\n return\n end\n end\n chooserPrince.destroy\n \n # Folder choose dialog\n chooser_destiny = create_folder_chooser\n \n # Check the user input\n chooser_destiny.run do |r|\n if r == Gtk::Dialog::RESPONSE_ACCEPT\n filename = chooser_destiny.filename\n @project.create_project prince, File.basename(filename), filename\n @treeView.create_tree @project\n end\n chooser_destiny.destroy\n end\n end",
"def create\n @project = Project.new(params[:project])\n # Si se crea correctamente, se guarda y se redirige al show con un mensaje de exito,\n # sino, se hace un render al new del proyecto, dando el mensaje de error correspondiente\n if @project.save\n redirect_to @project, flash: {success: I18n.t('project.create_success')}\n else\n render 'new'\n end\n end",
"def new_project(name:, component:, url_base:, branch:)\n # puts \"new_project(#{name}, #{component}, #{url_base})\"\n Project.new(name, component, url_base, branch: branch)\n end",
"def create\n @project = Project.new(project_params)\n @project.user = current_user\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createProject(description) \n project = Project.new \n project.Description = description \n @Projects.push(project) \n end",
"def create\n client = params[:client].present? ? Client.new(params[:client]) : Client.find_by_id(params[:project].delete(:client_id))\n unless client.present?\n redirect_to projects_url, notice: \"Client is required.\" and return\n end\n \n @project = Project.new(params[:project])\n @project.client = client\n\n respond_to do |format|\n if @project.save\n Assignment.create({project_id: @project.id, user_id: current_user.id}.merge(params[:project][:assignment]))\n current_user.current_company.projects << @project\n current_user.current_company.clients << @project.client\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @key_questions_project = @project.key_questions_projects.build(key_questions_project_params)\n authorize(@key_questions_project)\n\n respond_to do |format|\n if @key_questions_project.save\n format.html do\n redirect_to edit_project_path(@project, page: 'key_questions'),\n notice: t('success')\n end\n format.json { render :show, status: :created, location: @project }\n else\n format.html do\n redirect_to edit_project_path(@project, page: 'key_questions'),\n alert: t('blank')\n end\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n if @project.save\n respond_to do |format|\n format.html do\n flash[:notice] = 'Project was created.'\n flash[:highlight_dom_id] = dom_id(@project)\n redirect_to projects_path\n end\n end\n else\n respond_to do |format|\n format.html { render :action => 'new' }\n end\n end\n end",
"def create_project(project)\n \n update_project(project)\n \n # TODO: Need to handle this exception...\n if (File.directory? project.svn_dir) then\n raise StandardError, \"A project called #{project.display_name} already exists in the #{project.client.display_name} repository. Please delete it or choose an alternate project name and run this script again.\"\n end\n \n # create a new subversion repository\n say(\"Creating a new subversion repository...\")\n `svnadmin create #{project.svn_dir}`\n \n # import into svn\n say(\"Importing temporary project into the new subversion repository...\")\n `svn import #{project.template}/svn file:///#{project.svn_dir} --message \"initial import\"`\n \n # this should fix the 'can't open activity db error'\n `sudo chmod 770 #{project.svn_dir}`\n activites_file = File.join(project.svn_dir,\"/dav/activities\")\n if File.exists?(activites_file)\n `sudo chmod 755 #{activites_file}`\n `sudo chown www-data:www-data #{activites_file}`\n end\n \n # install default post commit hook\n hook_file = File.join(project.svn_dir,\"hooks\",\"post-commit\")\n Template.new(File.join(Config.subtrac_path, \"svn\", \"post-commit.erb\")).write(hook_file)\n `sudo chmod +x #{hook_file}`\n\n end",
"def create\n cmp = AzCompany.find(params[:az_project][:owner_id])\n @project = AzProject.create(params[:az_project][:name], cmp, current_user, params[:az_project][:public_access])\n\n @title = 'Создание нового сайта'\n\n respond_to do |format|\n if @project.id\n flash[:notice] = 'Проект успешно создан.'\n format.html { redirect_to(@project) }\n else\n format.html { render :template => 'az_projects/new', :owner_id => cmp.id }\n end\n end\n end"
] |
[
"0.7335935",
"0.6795813",
"0.6783607",
"0.66679525",
"0.660702",
"0.66031194",
"0.657976",
"0.6578428",
"0.64866793",
"0.64284116",
"0.642025",
"0.6387912",
"0.6385298",
"0.63733757",
"0.63611037",
"0.6322394",
"0.6314972",
"0.629425",
"0.62862074",
"0.6258832",
"0.62580514",
"0.62341094",
"0.6203196",
"0.6190079",
"0.6186421",
"0.61824226",
"0.616669",
"0.6118824",
"0.60761523",
"0.606464",
"0.6057612",
"0.6057076",
"0.6051481",
"0.60491455",
"0.60480285",
"0.6043436",
"0.6041039",
"0.60351235",
"0.6034878",
"0.60345745",
"0.60323095",
"0.6027357",
"0.60253495",
"0.60197747",
"0.6018231",
"0.60133934",
"0.6011539",
"0.60071236",
"0.59989434",
"0.59889287",
"0.59868294",
"0.5977501",
"0.59722525",
"0.5968033",
"0.5956826",
"0.5955106",
"0.5953293",
"0.5953293",
"0.5951278",
"0.5950429",
"0.59490824",
"0.59462684",
"0.5937001",
"0.59354407",
"0.5934544",
"0.5932575",
"0.5924211",
"0.5921224",
"0.5919699",
"0.59057516",
"0.59057516",
"0.59057516",
"0.59057516",
"0.59057516",
"0.59057516",
"0.59057516",
"0.59057516",
"0.59057516",
"0.59057516",
"0.59057516",
"0.59057516",
"0.5899378",
"0.5893778",
"0.5892429",
"0.5891468",
"0.58901775",
"0.5887553",
"0.5875106",
"0.58672756",
"0.58649284",
"0.58628815",
"0.58590114",
"0.5847225",
"0.58442605",
"0.5835535",
"0.58352697",
"0.5830385",
"0.58294004",
"0.5827467",
"0.58234847"
] |
0.67534244
|
3
|
TODO: to be refactored Apply space_template to the space if space_template exists
|
def apply_space_template(space)
parent_space = space.space
return if parent_space.blank?
template = parent_space.space_template
return if template.blank?
template.space_template_nodes.each do |n|
node = n.node
case node
when UserFile
copy_service.copy(node, space.uid)
when App
copy_service.copy(node, space.uid)
else
raise("Space template #{template.id} has Unexpected node #{n.id} of #{node.class} class")
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_space_type(template, clim, building_type, spc_type)\n #OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"Adding space type: #{template}-#{clim}-#{building_type}-#{spc_type}\")\n\n # Get the space type data\n data = self.find_object(self.standards['space_types'], {'template'=>template, 'building_type'=>building_type, 'space_type'=>spc_type})\n if !data\n OpenStudio::logFree(OpenStudio::Warn, 'openstudio.standards.Model', \"Cannot find data for space type: #{template}-#{clim}-#{building_type}-#{spc_type}, will not be created.\")\n return false #TODO change to return empty optional schedule:ruleset?\n end\n \n name = make_name(template, clim, building_type, spc_type)\n\n # Create a new space type and name it\n space_type = OpenStudio::Model::SpaceType.new(self)\n space_type.setName(name)\n\n # Set the standards building type and space type for this new space type\n space_type.setStandardsBuildingType(building_type)\n space_type.setStandardsSpaceType(spc_type)\n\n # Set the rendering color of the space type\n rgb = data['rgb']\n rgb = rgb.split('_')\n r = rgb[0].to_i\n g = rgb[1].to_i\n b = rgb[2].to_i\n rendering_color = OpenStudio::Model::RenderingColor.new(self)\n rendering_color.setRenderingRedValue(r)\n rendering_color.setRenderingGreenValue(g)\n rendering_color.setRenderingBlueValue(b)\n space_type.setRenderingColor(rendering_color)\n\n # Create the schedule set for the space type\n default_sch_set = OpenStudio::Model::DefaultScheduleSet.new(self)\n default_sch_set.setName(\"#{name} Schedule Set\")\n space_type.setDefaultScheduleSet(default_sch_set)\n\n # Lighting\n make_lighting = false\n lighting_per_area = data['lighting_per_area']\n lighting_per_person = data['lighting_per_person']\n unless lighting_per_area == 0 || lighting_per_area.nil? then make_lighting = true end\n unless lighting_per_person == 0 || lighting_per_person.nil? then make_lighting = true end\n\n if make_lighting == true\n\n # Create the lighting definition\n lights_def = OpenStudio::Model::LightsDefinition.new(self)\n lights_def.setName(\"#{name} Lights Definition\")\n lights_frac_to_return_air = data['lighting_fraction_to_return_air']\n lights_frac_radiant = data['lighting_fraction_radiant']\n lights_frac_visible = data['lighting_fraction_visible']\n unless lighting_per_area == 0 || lighting_per_area.nil?\n lights_def.setWattsperSpaceFloorArea(OpenStudio.convert(lighting_per_area, 'W/ft^2', 'W/m^2').get)\n lights_def.setReturnAirFraction(lights_frac_to_return_air)\n lights_def.setFractionRadiant(lights_frac_radiant)\n lights_def.setFractionVisible(lights_frac_visible)\n end\n unless lighting_per_person == 0 || lighting_per_person.nil?\n lights_def.setWattsperPerson(OpenStudio.convert(lighting_per_person, 'W/person', 'W/person').get)\n lights_def.setReturnAirFraction(lights_frac_to_return_air)\n lights_def.setFractionRadiant(lights_frac_radiant)\n lights_def.setFractionVisible(lights_frac_visible)\n end\n\n # Create the lighting instance and hook it up to the space type\n lights = OpenStudio::Model::Lights.new(lights_def)\n lights.setName(\"#{name} Lights\")\n lights.setSpaceType(space_type)\n\n # Additional Lighting\n additional_lighting_per_area = data['additional_lighting_per_area']\n if additional_lighting_per_area != nil\n # Create the lighting definition\n additional_lights_def = OpenStudio::Model::LightsDefinition.new(self)\n additional_lights_def.setName(\"#{name} Additional Lights Definition\")\n additional_lights_def.setWattsperSpaceFloorArea(OpenStudio.convert(additional_lighting_per_area, 'W/ft^2', 'W/m^2').get)\n additional_lights_def.setReturnAirFraction(lights_frac_to_return_air)\n additional_lights_def.setFractionRadiant(lights_frac_radiant)\n additional_lights_def.setFractionVisible(lights_frac_visible)\n\n # Create the lighting instance and hook it up to the space type\n additional_lights = OpenStudio::Model::Lights.new(additional_lights_def)\n additional_lights.setName(\"#{name} Additional Lights\")\n additional_lights.setSpaceType(space_type)\n end\n\n # Get the lighting schedule and set it as the default\n lighting_sch = data['lighting_schedule']\n unless lighting_sch.nil?\n default_sch_set.setLightingSchedule(add_schedule(lighting_sch))\n end\n end\n\n # Ventilation\n\n make_ventilation = false\n ventilation_per_area = data['ventilation_per_area']\n ventilation_per_person = data['ventilation_per_person']\n ventilation_ach = data['ventilation_air_changes']\n unless ventilation_per_area == 0 || ventilation_per_area.nil? then make_ventilation = true end\n unless ventilation_per_person == 0 || ventilation_per_person.nil? then make_ventilation = true end\n unless ventilation_ach == 0 || ventilation_ach.nil? then make_ventilation = true end\n\n\n if make_ventilation == true\n\n # Create the ventilation object and hook it up to the space type\n ventilation = OpenStudio::Model::DesignSpecificationOutdoorAir.new(self)\n ventilation.setName(\"#{name} Ventilation\")\n puts \"#{name}\"\n space_type.setDesignSpecificationOutdoorAir(ventilation)\n ventilation.setOutdoorAirMethod('Sum')\n unless ventilation_per_area.nil? || ventilation_per_area.to_f == 0\n ventilation.setOutdoorAirFlowperFloorArea(OpenStudio.convert(ventilation_per_area, 'ft^3/min*ft^2', 'm^3/s*m^2').get)\n end\n unless ventilation_per_person.nil? || ventilation_per_person.to_f == 0\n ventilation.setOutdoorAirFlowperPerson(OpenStudio.convert(ventilation_per_person, 'ft^3/min*person', 'm^3/s*person').get)\n end\n unless ventilation_ach.nil? || ventilation_ach.to_f == 0\n ventilation.setOutdoorAirFlowAirChangesperHour(ventilation_ach)\n end\n end\n\n # Occupancy\n\n make_people = false\n occupancy_per_area = data['occupancy_per_area']\n unless occupancy_per_area == 0 || occupancy_per_area.nil? then make_people = true end\n\n if make_people == true\n # create the people definition\n people_def = OpenStudio::Model::PeopleDefinition.new(self)\n people_def.setName(\"#{name} People Definition\")\n unless occupancy_per_area == 0 || occupancy_per_area.nil?\n people_def.setPeopleperSpaceFloorArea(OpenStudio.convert(occupancy_per_area / 1000.0, 'people/ft^2', 'people/m^2').get)\n end\n\n # create the people instance and hook it up to the space type\n people = OpenStudio::Model::People.new(people_def)\n people.setName(\"#{name} People\")\n people.setSpaceType(space_type)\n\n # get the occupancy and occupant activity schedules from the library and set as the default\n occupancy_sch = data['occupancy_schedule']\n unless occupancy_sch.nil?\n default_sch_set.setNumberofPeopleSchedule(add_schedule(occupancy_sch))\n end\n occupancy_activity_sch = data['occupancy_activity_schedule']\n unless occupancy_activity_sch.nil?\n default_sch_set.setPeopleActivityLevelSchedule(add_schedule(occupancy_activity_sch))\n end\n\n end\n\n # Infiltration\n\n make_infiltration = false\n infiltration_per_area_ext = data['infiltration_per_exterior_area']\n infiltration_per_area_ext_wall = data['infiltration_per_exterior_wall_area']\n infiltration_ach = data['infiltration_air_changes']\n unless (infiltration_per_area_ext == 0 || infiltration_per_area_ext.nil?) && (infiltration_per_area_ext_wall == 0 || infiltration_per_area_ext_wall.nil?) && (infiltration_ach == 0 || infiltration_ach.nil?) \n then make_infiltration = true\n end\n\n if make_infiltration == true\n\n # Create the infiltration object and hook it up to the space type\n infiltration = OpenStudio::Model::SpaceInfiltrationDesignFlowRate.new(self)\n infiltration.setName(\"#{name} Infiltration\")\n infiltration.setSpaceType(space_type)\n unless infiltration_per_area_ext == 0 || infiltration_per_area_ext.nil?\n infiltration.setFlowperExteriorSurfaceArea(OpenStudio.convert(infiltration_per_area_ext, 'ft^3/min*ft^2', 'm^3/s*m^2').get)\n end\n unless infiltration_per_area_ext_wall == 0 || infiltration_per_area_ext_wall.nil?\n infiltration.setFlowperExteriorWallArea(OpenStudio.convert(infiltration_per_area_ext_wall, 'ft^3/min*ft^2', 'm^3/s*m^2').get)\n end\n unless infiltration_ach == 0 || infiltration_ach.nil?\n infiltration.setAirChangesperHour(infiltration_ach)\n end\n\n # Get the infiltration schedule from the library and set as the default\n infiltration_sch = data['infiltration_schedule']\n unless infiltration_sch.nil?\n default_sch_set.setInfiltrationSchedule(add_schedule(infiltration_sch))\n end\n\n end\n\n # Electric equipment\n\n make_electric_equipment = false\n elec_equip_per_area = data['electric_equipment_per_area']\n elec_equip_frac_latent = data['electric_equipment_fraction_latent']\n elec_equip_frac_radiant = data['electric_equipment_fraction_radiant']\n elec_equip_frac_lost = data['electric_equipment_fraction_lost']\n unless elec_equip_per_area == 0 || elec_equip_per_area.nil? then make_electric_equipment = true end\n\n if make_electric_equipment == true\n\n # Create the electric equipment definition\n elec_equip_def = OpenStudio::Model::ElectricEquipmentDefinition.new(self)\n elec_equip_def.setName(\"#{name} Electric Equipment Definition\")\n unless elec_equip_per_area == 0 || elec_equip_per_area.nil?\n elec_equip_def.setWattsperSpaceFloorArea(OpenStudio.convert(elec_equip_per_area, 'W/ft^2', 'W/m^2').get)\n elec_equip_def.setFractionLatent(elec_equip_frac_latent)\n elec_equip_def.setFractionRadiant(elec_equip_frac_radiant)\n elec_equip_def.setFractionLost(elec_equip_frac_lost)\n end\n\n # Create the electric equipment instance and hook it up to the space type\n elec_equip = OpenStudio::Model::ElectricEquipment.new(elec_equip_def)\n elec_equip.setName(\"#{name} Electric Equipment\")\n elec_equip.setSpaceType(space_type)\n\n # Get the electric equipment schedule from the library and set as the default\n elec_equip_sch = data['electric_equipment_schedule']\n unless elec_equip_sch.nil?\n default_sch_set.setElectricEquipmentSchedule(add_schedule(elec_equip_sch))\n end\n\n end\n\n # Gas equipment\n\n make_gas_equipment = false\n gas_equip_per_area = data['gas_equipment_per_area']\n gas_equip_frac_latent = data['gas_equipment_fraction_latent']\n gas_equip_frac_radiant = data['gas_equipment_fraction_radiant']\n gas_equip_frac_lost = data['gas_equipment_fraction_lost']\n\n unless gas_equip_per_area == 0 || gas_equip_per_area.nil? then make_gas_equipment = true end\n\n if make_gas_equipment == true\n\n # Create the gas equipment definition\n gas_equip_def = OpenStudio::Model::GasEquipmentDefinition.new(self)\n gas_equip_def.setName(\"#{name} Gas Equipment Definition\")\n gas_equip_def.setFractionLatent(gas_equip_frac_latent)\n gas_equip_def.setFractionRadiant(gas_equip_frac_radiant)\n gas_equip_def.setFractionLost(gas_equip_frac_lost)\n unless gas_equip_per_area == 0 || gas_equip_per_area.nil?\n gas_equip_def.setWattsperSpaceFloorArea(OpenStudio.convert(gas_equip_per_area, 'Btu/hr*ft^2', 'W/m^2').get)\n end\n\n # Create the gas equipment instance and hook it up to the space type\n gas_equip = OpenStudio::Model::GasEquipment.new(gas_equip_def)\n gas_equip.setName(\"#{name} Gas Equipment\")\n gas_equip.setSpaceType(space_type)\n\n # Get the gas equipment schedule from the library and set as the default\n gas_equip_sch = data['gas_equipment_schedule']\n unless gas_equip_sch.nil?\n default_sch_set.setGasEquipmentSchedule(add_schedule(gas_equip_sch))\n end\n\n end\n\n thermostat = OpenStudio::Model::ThermostatSetpointDualSetpoint.new(self)\n thermostat.setName(\"#{name} Thermostat\")\n\n heating_setpoint_sch = data['heating_setpoint_schedule']\n unless heating_setpoint_sch.nil?\n thermostat.setHeatingSetpointTemperatureSchedule(add_schedule(heating_setpoint_sch))\n end\n\n cooling_setpoint_sch = data['cooling_setpoint_schedule']\n unless cooling_setpoint_sch.nil?\n thermostat.setCoolingSetpointTemperatureSchedule(add_schedule(cooling_setpoint_sch))\n end\n\n # componentize the space type\n space_type_component = space_type.createComponent\n\n # #TODO make this return BCL component space types?\n #\n # #setup the file names and save paths that will be used\n # file_name = \"nrel_ref_bldg_space_type\"\n # component_dir = \"#{Dir.pwd}/#{component_name}\"\n # osm_file_path = OpenStudio::Path.new(\"#{component_dir}/files/#{file_name}.osm\")\n # osc_file_path = OpenStudio::Path.new(\"#{component_dir}/files/#{file_name}.osc\")\n #\n # #OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"component_dir = #{component_dir}\")\n #\n # OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"creating directories\")\n # FileUtils.rm_rf(component_dir) if File.exists?(component_dir) and File.directory?(component_dir)\n # FileUtils.mkdir_p(component_dir)\n # FileUtils.mkdir_p(\"#{component_dir}/files/\")\n #\n # #save the space type as a .osm\n # #OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"saving osm to #{osm_file_path}\")\n # model.toIdfFile().save(osm_file_path,true)\n #\n # #save the componentized space type as a .osc\n # #OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"saving osc to #{osc_file_path}\")\n # space_type_component.toIdfFile().save(osc_file_path,true)\n #\n # #make the BCL component\n # OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"creating BCL component\")\n # component = BCL::Component.new(component_dir)\n # OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"created uid = #{component.uuid}\")\n #\n # #add component information\n # component.name = component_name\n # component.description = \"This space type represent spaces in typical commercial buildings in the United States. The information to create these space types was taken from the DOE Commercial Reference Building Models, which can be found at http://www1.eere.energy.gov/buildings/commercial_initiative/reference_buildings.html. These space types include plug loads, gas equipment loads (cooking, etc), occupancy, infiltration, and ventilation rates, as well as schedules. These space types should be viewed as starting points, and should be reviewed before being used to make decisions.\"\n # component.source_manufacturer = \"DOE\"\n # component.source_url = \"http://www1.eere.energy.gov/buildings/commercial_initiative/reference_buildings.html\"\n # component.add_provenance(\"dgoldwas\", Time.now.gmtime.strftime('%Y-%m-%dT%H:%M:%SZ'), \"\")\n # component.add_tag(\"Space Types\") # todo: what is the taxonomy string for space type? is there one?\n #\n # #add arguments as attributes\n # component.add_attribute(\"NREL_reference_building_vintage\", template, \"\")\n # component.add_attribute(\"Climate_zone\", clim, \"\")\n # component.add_attribute(\"NREL_reference_building_primary_space_type\", building_type, \"\")\n # component.add_attribute(\"NREL_reference_building_secondary_space_type\", spc_type, \"\")\n #\n # #openstudio type attribute\n # component.add_attribute(\"OpenStudio Type\", space_type.iddObjectType.valueDescription, \"\")\n #\n # #add other attributes\n # component.add_attribute(\"Lighting Standard\", data[\"lighting_standard\"], \"\")\n # component.add_attribute(\"Lighting Primary Space Type\", data[\"lighting_pri_spc_type\"], \"\")\n # component.add_attribute(\"Lighting Secondary Space Type\", data[\"lighting_sec_spc_type\"], \"\")\n #\n # component.add_attribute(\"Ventilation Standard\", data[\"ventilation_standard\"], \"\")\n # component.add_attribute(\"Ventilation Primary Space Type\", data[\"ventilation_pri_spc_type\"], \"\")\n # component.add_attribute(\"Ventilation Secondary Space Type\", data[\"ventilation_sec_spc_type\"], \"\")\n #\n # component.add_attribute(\"Occupancy Standard\", \"NREL reference buildings\", \"\")\n # component.add_attribute(\"Occupancy Primary Space Type\", building_type, \"\")\n # component.add_attribute(\"Occupancy Secondary Space Type\", spc_type, \"\")\n #\n # component.add_attribute(\"Infiltration, Gas Equipment, Electric Equipment, and Schedules Standard\", \"NREL reference buildings\", \"\")\n # component.add_attribute(\"Infiltration, Gas Equipment, Electric Equipment, and Schedules Primary Space Type\", building_type, \"\")\n # component.add_attribute(\"Infiltration, Gas Equipment, Electric Equipment, and Schedules Secondary Space Type\", spc_type, \"\")\n #\n # #add the osm and osc files to the component\n # component.add_file(\"OpenStudio\", \"0.9.3\", osm_file_path.to_s, \"#{file_name}.osm\", \"osm\")\n # component.add_file(\"OpenStudio\", \"0.9.3\", osc_file_path.to_s, \"#{file_name}.osc\", \"osc\")\n #\n # #OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"saving component to #{component_dir}\")\n # component.save_component_xml(component_dir)\n #\n # =e\n # return the space type and the componentized space type\n \n return space_type\n \n end",
"def place_x(space)\n \tchoice = to_space_sym(space)\n \t@spaces[choice] = \"X\"\n end",
"def set_space\n space_class = Thinkspace::Common::Space\n space_id = ENV['SPACE_ID']\n if space_id.present?\n @space = space_class.find_by(id: space_id)\n raise_error \"Space id #{space_id} not found.\" if space.blank?\n else\n create_space(space_class)\n end\n end",
"def reserve_space space\n return if self.last and self.last.id >= space\n\n o = self.new\n o.id= space\n o.save_without_alter_ego\n o.delete\n return\n end",
"def space=(space)\n #This is a stub, used for indexing\n end",
"def misplaced_space?\n space && (space_id != space.space_id)\n end",
"def set_space\n @space = @location.spaces.find_by_permalink(params[:space_id])\n raise ActiveRecord::RecordNotFound unless @space\n end",
"def space(space_id)\n return spaces[space_id] if spaces[space_id]\n\n unless (table_record = data_dictionary.table_by_space_id(space_id))\n raise \"Table with space ID #{space_id} not found\"\n end\n\n add_table(table_record[\"NAME\"])\n\n spaces[space_id]\n end",
"def createSpaceCity\n if not @haveSpaceCity\n @currentSpaceStation = SpaceCity.new(@currentSpaceStation, @spaceStations)\n @spaceStations.transformCurrentStation(@currentSpaceStation)\n @haveSpaceCity = true\n else\n @transform = Transformation::NOTRANSFORM\n end\n end",
"def create\n @space_form = Space::Form.new(space: current_team.spaces.new,\n user: current_user,\n attributes: space_params)\n\n authorize @space_form.space, :create?\n\n respond_to do |format|\n if @space_form.save\n format.html do\n redirect_to case\n when @space_form.space.access_control.private? then space_members_path(@space_form.space)\n else space_pages_path(@space_form.space)\n end\n end\n format.json { render :show, status: :created, location: @space_form.space }\n else\n format.html { render :new }\n format.json { render json: @space_form.errors, status: :unprocessable_entity }\n end\n end\n end",
"def apply_template\n apply_table_format_template(template.table)\n apply_grouping_format_template(template.grouping)\n end",
"def create_space(organization, user)\n space_name = Figaro.env.respond_to?(:cf_space) ? Figaro.env.cf_space : DEFAULT_SPACE_NAME\n space = Space.new.get(space_name, organization)\n space = Space.new.create(space_name, organization) unless space\n\n Space.new.assign_roles(space, user, space_roles) if space_roles.any?\n\n space\n end",
"def add_space(space)\n raise \"Object was not an Innodb::Space\" unless space.is_a?(Innodb::Space)\n\n spaces[space.space_id.to_i] = space\n end",
"def create\n @space = Space.new(space_params)\n @space.user = current_user\n\n if !space_params.has_key? :is_private\n @space.is_private = @space.user.prefers_private?\n if @space.organization\n @space.is_private = @space.is_private || @space.organization.prefers_private?\n end\n end\n\n if @space.save\n render json: SpaceRepresenter.new(@space).to_json(user_options: {current_user_can_edit: true})\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end",
"def init_space\n\t\t\traise \"#{self.class} has not implemented a Space initializer\"\n\t\tend",
"def set_space\n @space = current_user.spaces.friendly.find(params[:id])\n end",
"def deal_template_2(_template='')\n\t\ttemplate = _template\n\t\twhile template[/\\{\\?.*?\\?([\\n\\r]*.*?)\\}/] != nil\n\t\t\ttemplate[/\\{\\?.*?\\?([\\n\\r]*.*?)\\}/]= $1\n\t\tend\n\t\ttemplate\n\tend",
"def apply_template(data)\n self.class.template.apply(data)\n end",
"def set_space\n @space = Space.friendly.find(params[:id])\n redirect_to root_path unless @space.present?\n end",
"def create\n @newspace = current_user.created_spaces.new(space_params)\n\n respond_to do |format|\n if @newspace.save && update_subscription(@newspace)\n\n current_user.spaces << @newspace # Creates the join record to add the admin to this space\n\n format.html { redirect_to space_members_path(@newspace), notice: 'Space was successfully created.' }\n format.json { render :show, status: :created, location: @newspace }\n else\n format.html { render :new }\n format.json { render json: @mewspace.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_template\n self.template = \"template 14231\"\n end",
"def call(space_form)\n space = nil\n site_admins = nil\n\n Space.transaction do\n space = build_space(space_form)\n dxorgs = [space.host_dxorg, space.guest_dxorg].uniq.compact\n\n create_orgs(dxorgs)\n space.save!\n add_leads(space, space_form)\n invite_challenge_bot(space) if @for_challenge\n\n create_shared_or_private_project(space)\n\n if space.review?\n create_reviewer_confidential_space(space, space_form)\n elsif space.groups? || space.government? || space.administrator?\n remove_pfda_admin_user(space, space_form)\n elsif space.private_type?\n # Private Spaces have space_id set to it's own id\n space.update(space_id: space.id)\n end\n\n # For private, government and administrator spaces we accept the space automatically\n accept_space(space) if space.private_type? || space.government? || space.administrator?\n\n site_admins = User.site_admins - [space.host_lead]\n create_site_admin_invitations_to_space(space, site_admins) if space.administrator?\n end\n\n send_invitation_emails_to_site_admins(space, site_admins) if space.administrator?\n send_emails(space) unless space.private_type?\n\n space\n end",
"def createSpaceCity\n if !@haveSpaceCity\n others = []\n\n for station in @spaceStations\n if station != @currentStation\n others << station\n end\n end\n\n @currentStation = SpaceCity.new(@currentStation, others)\n @spaceStations[@currentStationIndex] = @currentStation\n @haveSpaceCity = true\n end\n end",
"def setup_org_space\n $CF_ORG = random_suffix('org', 'CF_ORG')\n $CF_SPACE = random_suffix('space', 'CF_SPACE')\n at_exit do\n set errexit: false do\n run \"cf delete-space -f #{$CF_SPACE}\"\n run \"cf delete-org -f #{$CF_ORG}\"\n end\n end\n run \"cf create-org #{$CF_ORG}\"\n run \"cf target -o #{$CF_ORG}\"\n run \"cf create-space #{$CF_SPACE}\"\n run \"cf target -s #{$CF_SPACE}\"\nend",
"def space_params\n params.require(:space).permit(:name, :spaceType, :multiplier, :area)\n end",
"def space_available?(space)\n \t@spaces[to_space_sym(space)] == \" \" ? true : false\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def apply_template_after?; end",
"def set_default_space\n account = Factory.create :account\n \n Account.current = account\n Space.current = account.spaces.first \nend",
"def get_space(sp)\n @spaces[sp]\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def space_params\n params.require(:space).permit(:name, :image, :detail, :facility_id, :image_cache, :remove_image)\n end",
"def template(template_name)\n @attributes.store(template_name)\n end",
"def get_template(template); end",
"def assign_template\n @template = if opts[:template]\n Base.sources.template_for(opts[:template], :from => dep_source).tap {|t|\n raise DepError, \"There is no template named '#{opts[:template]}' to define '#{name}' against.\" if t.nil?\n }\n else\n (Base.sources.template_for(suffix, :from => dep_source) || self.class.base_template).tap {|t|\n opts[:suffixed] = (t != BaseTemplate)\n }\n end\n end",
"def set_template\n end",
"def allow_space\n name = params[:namespace]\n @space = Space.find_space(@user, name).take || not_found\n end",
"def apply_template_before?; end",
"def interword_spacing(space)\n begin\n Float(space)\n rescue ArgumentError\n Kernel.raise ArgumentError, 'invalid value for interword_spacing'\n rescue TypeError\n Kernel.raise TypeError, \"can't convert #{space.class} into Float\"\n end\n primitive \"interword-spacing #{space}\"\n end",
"def create_personal_space!\n if personal_space\n raise \"Personal space already exists\"\n else\n workflow = Workflow.find_by_id(Option[\"default_personal_space_workflow\"])\n workflow_create_role = Option[\"default_personal_space_owner_role\"]\n workflow_owner_role = Option[\"default_personal_space_creator_role\"]\n item_types = Option[\"default_personal_space_item_types\"].to_s.split(\",\")\n \n raise \"Default Personal Space Workflow not specified in preferences\" unless workflow && workflow_create_role && workflow_owner_role\n \n s = Space.create_with_workflow_and_owners(:code => personal_space_code, :name => \"Personal Space for #{name}\", :workflow => workflow, :enabled => true, :owners => self, :workflow_owner_role => workflow_owner_role, :workflow_create_role => workflow_create_role)\n \n item_types.collect { |it| ItemType.find_by_id(it)}.compact.each do |it|\n s.formats.create!(:item_type => it)\n end\n \n return s\n end\n \n\n end",
"def move_space_to_position(space_number, position_number)\n TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, 0)\n end",
"def create\n @spaces_mine = Space.mine(current_user.id)\n raise Space::NotAllowed, '공간 생성 한도를 초과했습니다.' if over_space_limit\n @space = Space.new(space_params.merge(user_id: current_user.id))\n @space.save\n flash.now[:error] = @space.errors.messages[:url] if @space.errors.any?\n broadcast_create_space(@space)\n end",
"def create_space_with_http_info(create_space_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SpacesApi.create_space ...'\n end\n # verify the required parameter 'create_space_request' is set\n if @api_client.config.client_side_validation && create_space_request.nil?\n fail ArgumentError, \"Missing the required parameter 'create_space_request' when calling SpacesApi.create_space\"\n end\n # resource path\n local_var_path = '/video/v1/spaces'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(create_space_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'SpaceResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['accessToken']\n\n new_options = opts.merge(\n :operation => :\"SpacesApi.create_space\",\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: SpacesApi#create_space\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def place_o(space)\n \tchoice = to_space_sym(space)\n \t@spaces[choice] = \"O\"\n end",
"def move_to_space(space_number)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, 0)\n end",
"def create\n @space = current_user.spaces.build(space_params)\n @space.photos << Photo.where(space_token: @space.token)\n\n respond_to do |format|\n if @space.save\n flash[:success] = \"空间创建成功\"\n format.html { redirect_to @space }\n format.json { render :show, status: :created, location: @space }\n else\n format.html { render :new }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end",
"def space()\n #This is a stub, used for indexing\n end",
"def template(name); end",
"def accept_space(space)\n space.active! if space.accepted? # always true for private_type spaces\n space.save!\n end",
"def set_space(space_id = params[:id])\n @space = Space.find(space_id)\n end",
"def create\n @safe_space = SafeSpace.new(safe_space_params)\n\n respond_to do |format|\n if @safe_space.save\n format.html { redirect_to @safe_space, notice: 'Safe space was successfully created.' }\n format.json { render :show, status: :created, location: @safe_space }\n else\n format.html { render :new }\n format.json { render json: @safe_space.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_template(key, value)\n t = { key => value }\n raw = read_attribute(\"template\") \n d = raw.nil? ? {} : JSON.parse(raw) \n merged = d.deep_merge(t)\n self.template = JSON.generate(merged)\n self.save!\n end",
"def create_default_space\n default_space || begin\n owned_spaces.create!({ title: Space::DEFAULT_TITLE }).tap do |space|\n SpaceUser.creators.create!({ user_id: id, space_id: space.id })\n space.create_root_folder\n end\n end\n end",
"def populate\n spots = @spaces.length**2\n asteroids = (spots * 0.3).round\n gravity_wells = (spots * 0.1).round\n empty_space = (spots * 0.6 ).round\n\n asteroids.times {fill_spot('A')}\n gravity_wells.times {fill_spot('G')}\n #Because we fill two empty space with start, end marks\n empty_space.times {fill_spot('.')}\n end",
"def apply_template\n apply_table_format_template(template.table)\n end",
"def prepare_liquid_template(template)\n end",
"def update\n respond_to do |format|\n old_name = @space_type.name\n if @space_type.update(space_type_params)\n @space_type.spaces.each { |s| s.touch }\n format.html { redirect_to @space_type, notice: t('.update_ok') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @space_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_replace_menu_template menu_template_id, participation\n\n # Fetch new menu template\n new_menu_template = MenuTemplate.find(menu_template_id)\n\n # Fetch current event_vendor\n ev = fetch_event_vendor_by_vendor_id(new_menu_template.vendor_id)\n\n if !ev.nil? && ev.menu_template_id == new_menu_template.id\n # Existing vendor, no new menu template. Just update attributes.\n ev.update_attributes!(:participation => participation)\n else\n if !ev.nil?\n # Existing vendor, new menu template. Clean out line items, and update attributes from new template.\n remove_all_menu_type_line_items(new_menu_template.vendor.id)\n ev.update_attributes!(:menu_template => new_menu_template, :participation => participation,\n :default_menu_cogs => new_menu_template.cogs, :default_menu_retail_price => new_menu_template.retail_price,\n :default_menu_sell_price => calculate_sell_price_using_account_pricing_tier(new_menu_template.cogs),\n :pricing_type => new_menu_template.pricing_type)\n else\n # New vendor. Create a new container object.\n ev = event_vendors.create!(\n :vendor => Vendor.find(new_menu_template.vendor.id), :menu_template => new_menu_template, :participation => participation,\n :default_menu_cogs => new_menu_template.cogs, :default_menu_retail_price => new_menu_template.retail_price,\n :default_menu_sell_price => calculate_sell_price_using_account_pricing_tier(new_menu_template.cogs),\n :pricing_type => new_menu_template.pricing_type)\n end\n\n # Fill in the new container object for this vendor\n process_event_vendor(ev)\n self.save\n end\n\n create_per_person_charge_addons_for_payable_party(ev.vendor)\n trigger_event_rollup\n\n end",
"def system_space\n spaces[SYSTEM_SPACE_ID]\n end",
"def move_space_to_position_on_display(space_number, position_number, display_id)\n TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, display_id)\n end",
"def update!(**args)\n @space_id = args[:space_id] if args.key?(:space_id)\n end",
"def template_replace template, myhash\n #tmpltext=File::read(template);\n\n t = template.dup\n t.gsub!( /##(.*?)##/ ) {\n #raise \"Key '#{$1}' found in template but the value has not been set\" unless ( myhash.has_key?( $1 ) )\n myhash[ $1 ].to_s\n }\n t\n end",
"def xml_space=(space)\n Axlsx::RestrictionValidator.validate(:xml_space, [:preserve, :default], space)\n @xml_space = space\n end",
"def confidential_space\n space_membership && object.confidential_space(space_membership)\n end",
"def unique_spaces!\n self.gsub!(ANY_SPACE_PATTERN, UNIQUE_SPACE)\n end",
"def space_params\n params.require(:space).permit(:title, :price, :size, :description, :address, :zipcode, :email, :active, :q, images_attributes: [:id, :file, :space_id])\n end",
"def set_safe_space\n @safe_space = SafeSpace.find(params[:id])\n end",
"def update_space_in_system(slug, body, headers=default_headers)\n @logger.info(\"Updating Space \\\"#{slug}\\\"\")\n put(\"#{@api_url}/spaces/#{slug}\", body, headers)\n end",
"def createtemplate\r\n\t\t chars_num = @secretword.length\r\n\t\t line = \"\"\r\n\t\t line_char = \"_\"\r\n\t\t while chars_num > 0 do\r\n\t\t \tline += line_char\r\n\t\t \tchars_num -= 1\r\n\t\t end\r\n\t\t templ = \"[#{line}]\"\r\n\t\t return templ\r\n\t\t end",
"def fix_related_data_for_copied_theme(new_theme, new_nodes, new_template_files, original_theme, original_nodes, original_template_files, created_at)\n # # update param_values\n original_theme_id = original_theme['id']\n new_theme_id = new_theme.id\n\n original_nodes.each_with_index{|node,index|\n new_node = new_nodes[index]\n ParamValue.where( :theme_id=>original_theme_id, :page_layout_id=>node.id, :created_at=>created_at ).\n update_all( :page_layout_id=> new_node.id, :page_layout_root_id=>new_theme.page_layout_root_id, :theme_id=>new_theme_id )\n obsolete_template_resources = new_theme.template_resources.select{|template_resource| template_resource.page_layout_id== node.id }\n if obsolete_template_resources.present?\n #change page_layout_key, update one of them is done.\n obsolete_template_resources.first.update_attribute!(:page_layout_id, new_node.id )\n end\n }\n # after page_layout_key updated, confirm template_resource existing.\n new_theme.template_resources.select{|template_resource| template_resource.source.nil? }.each(&:destroy!)\n\n if created_at.present?\n Spree::TemplateFile.where(:created_at=>created_at, :theme_id=>original_theme_id).update_all( :theme_id=>new_theme_id )\n Spree::TemplateRelease.where(:created_at=>created_at, :theme_id=>original_theme_id).update_all( :theme_id=>new_theme_id )\n end\n new_theme.save!\n end",
"def create\n group = Group.find(params[:group_id])\n unless @current_user.id == group.user_id\n return render json: { message: \"You are not permitted to perform this operation.\" }, status: :forbidden\n end\n @space = Space.new(space_params)\n if @space.save\n render json: @space, status: :created\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end",
"def create\n @space = Space.new(space_params)\n\n respond_to do |format|\n if @space.save\n format.html { redirect_to @space, notice: 'Space was successfully created.' }\n format.json { render action: 'show', status: :created, location: @space }\n else\n format.html { render action: 'new' }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end",
"def target_template()\n @target_template.dup\n end",
"def create\n @space = Space.new(space_params)\n\n respond_to do |format|\n if @space.save\n format.html { redirect_to root_path, notice: \"Space was successfully created.\" }\n format.json { render :show, status: :created, location: @space }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end",
"def replace_word(template, replaced_word, new_word)\r\n template.gsub(/#{replaced_word}/, new_word)\r\n end",
"def replace_supplement(template_dir,old_template_dir)\n\n # remove old_template\n if File.exist?(Rails.root.to_s+'/app/assets/templates/'+old_template_dir+'/template.json')\n data_json = File.read(Rails.root.to_s+'/app/assets/templates/'+old_template_dir+'/template.json')\n datax = JSON.parse(data_json)\n\n if defined?(datax[\"supplements\"].each)\n datax[\"supplements\"].each do |supp|\n # remove file\n if(supp[\"copy_type\"] == \"file\") \n the_file = Rails.root.join(supp[\"copy_to\"]+'/'+supp[\"name\"]).to_s\n if File.exists?(the_file)\n FileUtils.rm(the_file)\n end\n end\n\n # remove folder\n if(supp[\"copy_type\"] == \"folder\")\n the_folder = Rails.root.join(supp[\"copy_to\"]+'/'+supp[\"name\"]).to_s\n if Dir.exists?(the_folder)\n FileUtils.remove_dir(the_folder)\n end\n end\n end\n end \n end # end of remove old_template\n\n # apply new template\n if File.exist?(Rails.root.to_s+'/app/assets/templates/'+template_dir+'/template.json')\n data_json = File.read(Rails.root.to_s+'/app/assets/templates/'+template_dir+'/template.json')\n datax = JSON.parse(data_json)\n if defined?(datax[\"supplements\"].each)\n datax[\"supplements\"].each do |supp| \n # co-pas file\n if(supp[\"copy_type\"] == \"file\") \n the_file_temp = Rails.root.to_s+'/app/assets/templates/'+template_dir+'/supplements/'+supp[\"name\"]\n the_file_copy_to = Rails.root.to_s+'/'+supp[\"copy_to\"]+'/'+supp[\"name\"]\n if File.exists?(the_file_temp)\n\n # create directory if doesn't exist\n unless File.directory?(Rails.root.to_s+'/'+supp[\"copy_to\"])\n FileUtils.mkdir_p(Rails.root.to_s+'/'+supp[\"copy_to\"])\n end\n\n # copy the file into directory\n FileUtils.cp(the_file_temp, the_file_copy_to) \n end\n end\n\n # co-pas folder\n if(supp[\"copy_type\"] == \"folder\")\n the_folder_temp = Rails.root.to_s+'/app/assets/templates/'+template_dir+'/supplements/'+supp[\"name\"]\n the_folder_copy_to = Rails.root.to_s+'/'+supp[\"copy_to\"]+'/'+supp[\"name\"] \n\n # remove destination folder as mention in http://ruby-doc.org/stdlib-2.0.0/libdoc/fileutils/rdoc/FileUtils.html#method-c-copy_entry\n if Dir.exists?(the_folder_copy_to)\n FileUtils.remove_dir(the_folder_copy_to)\n end\n\n # copy\n if Dir.exists?(the_folder_temp)\n FileUtils.copy_entry(the_folder_temp,the_folder_copy_to)\n end\n end\n end\n end\n end\n end",
"def create\n @myspace = Myspace.new(params[:myspace])\n\n respond_to do |format|\n if @myspace.save\n format.html { redirect_to @myspace, notice: 'Myspace was successfully created.' }\n format.json { render json: @myspace, status: :created, location: @myspace }\n else\n format.html { render action: \"new\" }\n format.json { render json: @myspace.errors, status: :unprocessable_entity }\n end\n end\n end",
"def produce_spaceship(type = :freighter, size: :m, **custom_components)\n components = {enging: :standard,\n seats: :standard,\n subwoofer: :none\n }\n components.merge!(custom_components)\nend",
"def boot_space\n @space = object_with_type Parfait::Space\n @space.classes = make_dictionary\n @space.types = make_dictionary\n Parfait::Space.set_object_space @space\n end",
"def propagate_template(distance)\n @distance = distance\n return if @path.nil?\n return unless @path.template.nil?\n @path.template = @template\n @path.propagate_template(distance + 1)\n end",
"def space_params\n params.require(:space).permit(:title, :space_setting_id, :num_of_people_id, :content, :address, :token,\n :atmosphere_id, :city_id, :price_hour, :price_day, :price_month, :price_year,\n :detailed_ids => [], :user_group_ids => [], :rent_env_ids => [], photos_attributes: [:data] )\n end",
"def create_word_template! ( list_of_words, notwords_list )\n\n # VALIDATE the lists: neither is nil:\n raise ArgumentError.new \"list of words provided for Sentence %d is nil\" % self.id if list_of_words.nil?\n raise ArgumentError.new \"list of not-words provided for Sentence %d is nil\" % self.id if notwords_list.nil?\n\n # VALIDATE the lists: not-words (the punctuation) is equal or one larger than words, because they interleave\n size_difference = notwords_list.length - list_of_words.length\n if size_difference > 1 or size_difference < 0\n raise ArgumentError.new \"Sentence %d not-words length out of sync with words:\" +\n \" (nw:[%s], w:[%s])\" % [ self.id, notwords_list.length, list_of_words.length]\n end\n\n # AT THIS POINT we have:\n # words - a list of all the words\n # notwords - a list of the stuff that surrounds the words\n # such that notwords and words are interleaved,\n # such that notwords elements are first (possibly empty),\n # and notwords elements last if present\n\n # KEY:\n # x: all lower case\n # c: capitalized first letter\n # C: entirely capitals\n\n sentence_pattern = [] # build something like\n # C x, \"c x!\"\n # for\n # I said, \"Don't walk!\"\n\n while not (notwords_list.empty? and list_of_words.empty?)\n\n sentence_pattern.push notwords_list.shift if not notwords_list.empty?\n\n sentence_pattern.push Word.to_template(list_of_words.shift) if not list_of_words.empty?\n\n end\n\n self.word_template = sentence_pattern.join(\"\")\n\n end",
"def new\n @space = Space.new\n end",
"def create\n @space = Space.new(params[:space])\n\n respond_to do |format|\n if @space.save\n format.html { redirect_to @space, notice: 'Space was successfully created.' }\n format.json { render json: @space, status: :created, location: @space }\n else\n format.html { render action: \"new\" }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_template(new_template, current_template_info)\n return false unless new_template != @template\n\n # We render to ensure the template is valid\n render(new_template, current_template_info: current_template_info)\n @template = new_template.freeze\n true\n end",
"def template_name=(_arg0); end",
"def template_name=(_arg0); end",
"def unique_spaces\n self.gsub(ANY_SPACE_PATTERN, UNIQUE_SPACE)\n end",
"def update\n raise User::NotAuthorized, '수정할 권한이 없습니다.' unless @space.updatable_by?(current_user)\n @space.update_attributes(space_params)\n\n broadcast_update_space(@space)\n end",
"def duplicate_space(space, source_space_id)\n return if source_space_id.nil?\n\n source_space = Space.find(source_space_id)\n\n space_copier = CopyService::SpaceCopier.new(api: api, user: user)\n space_copier.copy(space, source_space)\n end",
"def fill_spot(space_type)\n unfilled_space = @unfilled_spaces.sample\n ind_1 = unfilled_space[0]\n ind_2 = unfilled_space[1]\n @spaces[ind_1][ind_2] = space_type\n @unfilled_spaces.delete(unfilled_space)\n end",
"def scaffold_template\r\n template = Template.new(title: 'Test template',\r\n description: 'My test template', \r\n links: {\"funder\":[],\"sample_plan\":[]},\r\n org: Org.first, migrated: false, dmptemplate_id: \"0000009999\")\r\n\r\n template.phases << Phase.new(title: 'Test phase',\r\n description: 'My test phase',\r\n number: 1, template: template)\r\n\r\n template.phases.first.sections << Section.new(title: 'Test section',\r\n description: 'My test section',\r\n number: 99, phase: template.phases.first)\r\n\r\n section = template.phases.first.sections.first\r\n i = 1\r\n # Add each type of Question to the new section\r\n QuestionFormat.all.each do |frmt|\r\n question = Question.new(text: \"Test question - #{frmt.title}\", number: i,\r\n question_format: frmt, section: section)\r\n\r\n if frmt.option_based?\r\n 3.times do |j|\r\n question.question_options << QuestionOption.new(text: \"Option #{j}\", number: j, question: question)\r\n end\r\n end\r\n\r\n section.questions << question\r\n i += 1\r\n end\r\n\r\n template.save!\r\n assert template.valid?, \"unable to create new Template: #{template.errors.map{|f, m| f.to_s + ' ' + m}.join(', ')}\"\r\n @template = template.reload\r\n end",
"def cloud_space\n return nil if self.cloud_space_id.nil?\n begin\n return ::Resources::CloudSpace.new.find(self.cloud_space_id)\n rescue Resources::Exceptions::NotFound => e\n return nil\n end\n end"
] |
[
"0.57424045",
"0.555385",
"0.54832",
"0.53907865",
"0.5252938",
"0.52402824",
"0.52234554",
"0.5207747",
"0.5174894",
"0.5164923",
"0.51312476",
"0.5115307",
"0.50710034",
"0.50550723",
"0.50517523",
"0.5044105",
"0.5026249",
"0.5018389",
"0.50085974",
"0.5006663",
"0.4985411",
"0.49809137",
"0.49767503",
"0.49608797",
"0.49575004",
"0.49479407",
"0.49460655",
"0.49460655",
"0.49460655",
"0.49460655",
"0.49460655",
"0.4945527",
"0.49427342",
"0.49320498",
"0.49149683",
"0.49005997",
"0.4898301",
"0.4898301",
"0.48940843",
"0.48866805",
"0.48857835",
"0.4885287",
"0.48691475",
"0.48651752",
"0.48469174",
"0.482859",
"0.48210588",
"0.48110723",
"0.4798465",
"0.47981644",
"0.47952658",
"0.4794659",
"0.4793886",
"0.47728008",
"0.47683108",
"0.47655684",
"0.47583693",
"0.47533697",
"0.47517133",
"0.47498608",
"0.47492725",
"0.47434932",
"0.47232887",
"0.47190267",
"0.4697941",
"0.4693774",
"0.46820942",
"0.46818262",
"0.4678096",
"0.46732083",
"0.4668727",
"0.46568167",
"0.4656599",
"0.46439528",
"0.46439496",
"0.46417892",
"0.46390152",
"0.46280545",
"0.4625847",
"0.46242005",
"0.4619833",
"0.4614616",
"0.46120003",
"0.46090412",
"0.45987028",
"0.4597046",
"0.45968086",
"0.4594111",
"0.4593261",
"0.45892805",
"0.45810676",
"0.45786864",
"0.45784202",
"0.45784202",
"0.45772538",
"0.45701984",
"0.4566143",
"0.45647874",
"0.45632827",
"0.45585316"
] |
0.77530843
|
0
|
Formula provided by Michael Sokol and Julien Paroche
|
def bucket_date
self.created_at.beginning_of_week.beginning_of_day
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def formula() @ob.get_formula end",
"def secret_formula(started)\r\n\tjelly_beans = started * 500\r\n\tjars = jelly_beans / 1000\r\n\tcrates = jars / 100\r\n\treturn jelly_beans, jars, crates\r\nend",
"def secret_formula(started)\n# Assigns variables, each building on the other.\n jelly_beans = started * 500\n jars = jelly_beans / 1000\n crates = jars / 100\n# Returns a value that is associated with each variable\n return jelly_beans, jars, crates\nend",
"def secret_formula( started ) # Here first parameter 'started' will be referenced to the start_point which equals 10000\n jelly_beans = started * 500 # the variable 'jelly_beans' is equal to 10000 x 500 = 5,000,000\n jars = jelly_beans / 1000 # the variable 'jars' is equal to the value of jelly_beans (5,000,000) / 1,000 = 5,000\n crates = jars / 100 # the variable 'crates' is equal to the value of jars (5,000) / 100 = 50\n return jelly_beans, jars, crates # returns all the expressed values for the three variables to be used outside the method\nend",
"def secret_formula(started)\n\tjelly_beans = started * 500 #assign the producto of the parameter and 500 to the variable jely_beans\n\tjars = jelly_beans / 1000 #assign the division of the variable jelly_beans and 1000 to the variable jars\n\tcrates = jars / 100 #crates is equal to the division of jars and 100\n\t#return jelly_beans, jars, crates #return the value of jelly_beans, jars and crates\nend",
"def secret_formula(started)\n jelly_beans = started * 500\n jars = jelly_beans / 1000\n crates = jars / 100\n return jelly_beans, jars , crates\nend",
"def secret_formula(started)\n jelly_beans = started * 500\n jars = jelly_beans / 1000\n crates = jars / 100\n return jelly_beans, jars, crates\nend",
"def secret_formula(started)\n jelly_beans = started * 500\n jars = jelly_beans / 1000\n crates = jars / 100\n return jelly_beans, jars, crates\nend",
"def secret_formula(started)\n jelly_beans = started * 500\n jars = jelly_beans / 1000\n crates = jars / 100\n return jelly_beans, jars, crates\nend",
"def secret_formula(started)\n jelly_beans = started * 500\n jars = jelly_beans / 1000\n crates = jars / 100\n return jelly_beans, jars, crates\nend",
"def triple_crown_winner_formula\n # TODO: implement\n end",
"def secret_formula(started)\n\tjelly_beans = started * 500\n\tjars = jelly_beans / 1000\n\tcrates = jars / 100\n\treturn jelly_beans, jars, crates\nend",
"def secret_formula(started)\n\tjelly_beans = started * 500\n\tjars = jelly_beans / 1000\n\tcrates = jars / 100\n\treturn jelly_beans, jars, crates\nend",
"def secret_formula(started)\n\tjelly_beans = started * 500\n\tjars = jelly_beans / 1000\n\tcrates = jars / 100\n\treturn jelly_beans, jars, crates\nend",
"def calculated; end",
"def secret_formula(started)\n jelly_beans = started * 500\n jars = jelly_beans / 1000\n crates = jars / 100\n# Return array of 3 values\n return jelly_beans, jars, crates\nend",
"def inverse_formula (a, b)\n return 2 * (a + 5 * b)\nend",
"def grasa\n\t\t1.2*imc+0.23*@edad-10.8*@sexo-5.4\n\tend",
"def rh_factor; end",
"def bmi_formula (kg, m)\n result = kg / (m ** 2)\nend",
"def secret_formula(started)\n jelly_beans = started * 500\n jars = jelly_beans / 1000\n crates = jars / 100\n# return jelly_beans, jars, crates\n puts \"Testing: \"\n puts \"Jelly Beans: #{jelly_beans}, Jars: #{jars}, and Crates: #{crates}\"\nend",
"def ctof(ctemp)\n32.0+(ctemp*9.0/5.0)\nend",
"def bs(a, b)\n if (b - a) == 1\n if a == 0\n pab = 1\n qab = 1\n else\n pab = ((6 * a)-5) * ((2 * a)-1) * ((6 * a)-1)\n qab = (a * a) * (a * $c3)\n end\n\n tab = pab * (13591409 + (545140134 * a))\n\n if a & 1 == 1\n tab = -tab\n end\n else\n m = 0\n m = ((a + b) / 2).round(0)\n\n pam, qam, tam = bs(a, m)\n pmb, qmb, tmb = bs(m, b)\n\n pab = pam * pmb\n qab = qam * qmb\n tab = qmb * tam + pam * tmb\n end\n return pab, qab, tab\nend",
"def e2w(n, m)\n# n = (n+0.938272)*(n+0.938272) - n*n\n n+m\nend",
"def ftoc(fahrenheit)\n\n (fahrenheit - 32) * 5/9\n\nend",
"def suprailiaco\n\t\t(@suprailiaco[0] + @suprailiaco[1] + @suprailiaco[2])/3\n\tend",
"def calculate_pymnt(amt, j, n)\n x = amt.to_f * (j.to_f / (1 - (1 + j.to_f)**-n.to_f))\n round_money(x)\nend",
"def numerator() end",
"def s2(n)\n n*(n+1)*(2*n+1)/6\nend",
"def formula(start)\n\tpencils = start * 20\n\tboxes = pencils / 100\n\treturn pencils, boxes\nend",
"def ctof(cel)\n cel * 9.0 / 5.0 + 32\nend",
"def solve\n return ((1..40).inject(:*) / ((1..20).inject(:*) ** 2))\nend",
"def ctof(cel)\n (cel * 9.0) / 5.0 + 32\nend",
"def solution\n (1..40).inject(:*) / (1..20).inject(:*)**2\nend",
"def compute_dr(day_of_the_year)\n #equation 23\n #inverse relative distance Earth-Sun\n dr = 1 + 0.033 * Math.cos((2 * Math::PI/365) * day_of_the_year)\nend",
"def value\n (\n 0.7 * (annual_income / average_income) +\n 0.3 * (base_manpower / avearge_manpower)\n ).round(6)\n end",
"def porcentajegrasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * @sexo - 5.4\n\tend",
"def formula\n input_names = all_names\n input_names_ary = sort_names(input_names.keys)\n tbl = {}\n @table.each {|inputs, output|\n return output.to_s if inputs.empty?\n inputs2 = [:x] * input_names.length\n inputs.each {|name, input|\n inputs2[input_names[name]] = input ? 1 : 0\n }\n tbl[inputs2] = output ? 1 : 0\n }\n qm = QM.qm(tbl)\n r = []\n qm.each {|term|\n t = []\n num_dontcare = 0\n term.each_with_index {|v, i|\n if v == false\n t << (\"!\" + input_names_ary[i])\n elsif v == true\n t << input_names_ary[i]\n else # :x\n num_dontcare += 1\n end\n }\n if num_dontcare == term.length\n r << 'true'\n else\n r << t.join('&')\n end\n }\n return \"false\" if r.empty?\n r.join(' | ')\n end",
"def ftoc f\n (f - 32)*5/9\nend",
"def cop_to_kw_per_ton(cop)\n \n return 3.517/cop\n \nend",
"def puzzle_formula (a, h, w, i)\n return a + (h - (w * (i / 2)))\nend",
"def denominator_formula\n 1.upto(payments - 1).map { |m| \"(1 + percent) ** (#{m} * payment_period)\" }\n .push(1)\n .join(' + ')\n end",
"def calc_equation(x, y)\n return (1000 * x) + (1000 * y) - (x * y) == 500000\nend",
"def on_earth\n @n / 31_557_600\n end",
"def calculation\n end",
"def s1(n)\n (n*(n+1)/2)**2\nend",
"def ftoc(tempF)\n (tempF - 32.0)*5.0/9.0\nend",
"def kw_per_ton_to_cop(kw_per_ton)\n \n return 3.517/kw_per_ton\n \nend",
"def get_formula_base_cost\n price = 0.0\n self.ingredients.each do |ingredient|\n price += ingredient.getPrice * ingredient.quantity\n end\n return price\n end",
"def ctof temp2\n (temp2*1.8) + 32\nend",
"def _reduce_590(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend",
"def numerology(num1)\n\t# Calculate answer \n\t(((((num1 + 5) * 2) - 4) / 2) - num1)\nend",
"def points_formula(coeficient,number_of_teams,position, opponents)\n if position == 0\n return 0\n end\n opponent_rating = 0\n opponents.each do |opponent|\n opponent_rating += opponent.rating\n end\n opponent_rating /= Player.all_ratings\n \tp = (\n coeficient.to_f * number_of_teams.to_f / position * opponent_rating.to_f\n ).round 2\n p*100\n end",
"def compute_Delta(_T)\n #equation 13\n #kPa/C\n _Delta = 4098.0 * (0.6108 * Math.exp(17.27 * _T / (_T + 237.3))) / (_T + 237.3) ** 2\nend",
"def mod_puzzle_formula (a, h, w, i)\n return a - (h + (w - (i * 2)))\nend",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n \n\n end",
"def always_three (numberi)\n \n (((((numberi+5)*2)-4)/2)-numberi)\n \nend",
"def ener_kj \n\t\t@ener_kj = @saturadas * 37 + @monoinsaturadas * 37 + @polinsaturadas * 37 + @azucares * 17 + @polialcoles * 10 + @almidon * 17 + @fibra * 8 + @proteinas * 17 + @sal * 25\n\t\treturn @ener_kj\n\tend",
"def calc_upg_gigjoules_ch4 (val1 = 0.03778, val2 = calc_upg_ch4)\n\t\t(val1 * val2).round 2 \n\tend",
"def gecos(*) end",
"def gauss_formula(n)\n n * (n + 1) / 2\nend",
"def sum_up_to_squared n=100\r\n (2 * n + 1) * (n + 1) * n / 6\r\nend",
"def ftoc(tempF)\n (tempF - 32.0) * (5.0 / 9.0)\nend",
"def compute_es(_T)\n #equation 11\n #t units are celsius, es units are kPa\n es = 0.6108 * Math.exp((17.27 * _T) / (_T + 237.3))\nend",
"def compute_fuel(element)\n (element/3).floor - 2\n end",
"def solution\n 971 * (-61)\nend",
"def uberX_fare_calculator\nend",
"def ftoc(temp)\n\t(temp - 32) * 5.0/9.0\nend",
"def missing_number_gauss_formula(nums)\n expected_sum = (nums.length * (nums.length + 1))/2\n actual_sum = nums.reduce(:+) # or nums.inject{ |sum, x| sum + x} / nums.inject(:+)\n return expected_sum - actual_sum\nend",
"def ctof(celsius)\n\n (celsius * 9/5) + 32\n\nend",
"def ctof(c)\n c * 9.0/5.0 + 32.0\nend",
"def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n \r\n\r\n end",
"def part2(in1, in2)\n (in1.to_f + in2.to_f)/3\nend",
"def huellaNut \n\t\t(@indEnergia.call + @indGei.call)/2.0\n\tend",
"def cmbnation(m)\n factrl(m) / ( factrl(m - 5) * factrl(5) )\nend",
"def celcius_calculation(fahrenheit_input) #Celcius calculation\n ((fahrenheit_input.to_f - 32) * 5) / 9\nend",
"def simpson_0_1(s)\n calc = (1)+4*(1.0/(1+s*0.25*0.25))+2*(1.0/(1+s*0.5*0.5))+4*(1.0/(1+s*0.75*0.75))+(1.0/(1+s)) \n return (1/12.0)*(calc)\nend",
"def mathoper4argum(n, y, a, b)\n\n\tn + y - a / b\n\nend",
"def irmonograsaslp\n vag=(valormonograsasp * 100) / 70\n vag.round(2)\n end",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n end",
"def MyTables(tables,b,h,result) \n if tables == 1\n result=(b*h) #Cross sectional area\n elsif tables == 2\n result =((b*h**3)/12) #moment of inertia\n else\n result =((b*h**2)/6) #section modulus\n end #end of calculating result\nend",
"def calc_upg_mwh_ch4(val1= calc_upg_gigjoules_ch4, val2= 3.6)\n\t\t(val1 / val2).round 2\n\tend",
"def subescapular\n\t\t(@subescapular[0] + @subescapular[1] + @subescapular[2])/3\n\tend",
"def calcD(pn,pa)\n return -1*(Math.log2(pn/pa))\nend",
"def f(x)\n (2**(30.403243784-x**2)).floor * 10**(-9)\nend",
"def wl_formula\n replace_nests do |i|\n # indices in Wolfram Language start with 1\n \"##{i + 1}\"\n end\n end",
"def tax_money_owed\n if update_taxable <= 43953 && update_taxable >= 0\n update_taxable * 0.15\n elsif update_taxable >= 43954 && update_taxable <=87907\n (43953*0.15) + ((update_taxable-43953) * 0.22)\n elsif update_taxable >= 87908 && update_taxable <=136270\n (43953*0.15)+ (48363*0.22) + (update_taxable * 0.26)\n elsif update_taxable >= 136270\n (43953*0.15)+ (48363*0.22)+ (43954*0.26) + (update_taxable * 0.29)\n else\n update_taxable \n end\n end",
"def ctof(temp)\n temp * (9.0 / 5.0) + 32\nend",
"def mortgage_calc principle, annual_interest, years\n n = years * 12\n r = (annual_interest / 100)/ 12 #since this is usually expressed as a percentage\n return (principle * r * (1 + r)**n / ((1 + r)**n - 1)).round(2)\nend",
"def six\n square_of_sum(100) - sum_of_squares(100)\nend",
"def part2(elves)\n higher_power = Math::log(elves,3).ceil\n lower_power = higher_power - 1\n if elves == 3**higher_power\n return elves\n elsif elves >= 2*3**lower_power\n return elves - (3**lower_power - elves)\n else\n return elves - (3**lower_power)\n end\nend",
"def pre_divide; end",
"def two_pt_a\n fga - three_p_a\n end",
"def square_of_sum\n end",
"def valorenergeticoKJ\n\t\tveKJ=(cgrasas * 37) + (cgrasassa * 37) + (grasasmono * 37) + (grasaspoli * 37) + (hcarbono * 17) + (polialcoholes * 10) + (almidon * 17) + (fibra * 8) + (proteinas * 17) + (sal * 25)\n\t\tveKJ.round(2)\n\tend",
"def post_divide; end",
"def sumOfGroup(k)\n return k**3\n \n#Given the fact that Sn=(A1+An)*n/2\n#Given the fact that An= A1+(n-1)d\n#Given the problme that A1 = n(n-1) +1 \n#Then Sn = n*n*n\n\nend",
"def ftoc(temp)\n\t(temp - 32) * 5/9.0\nend",
"def valoralmidonp\n\t\tvag=(almidon * 70) / 100\n vag.round(2)\n\tend",
"def valorsalp\n\t\tvag=(sal * 70) / 100\n vag.round(2)\n\tend",
"def grasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * ( sexo ? 1 : 0) - 5.4\n\tend"
] |
[
"0.68520945",
"0.6568194",
"0.65528095",
"0.6551659",
"0.65434635",
"0.65023327",
"0.63993376",
"0.63993376",
"0.63993376",
"0.63993376",
"0.6372778",
"0.6358174",
"0.6358174",
"0.6358174",
"0.6303005",
"0.6181995",
"0.61236477",
"0.61163014",
"0.6093724",
"0.60769886",
"0.6057036",
"0.5966063",
"0.5958003",
"0.593845",
"0.59310836",
"0.587257",
"0.58696264",
"0.5868201",
"0.58520895",
"0.5839285",
"0.58302593",
"0.58269644",
"0.5826",
"0.57940125",
"0.5754965",
"0.5751649",
"0.5733247",
"0.57163674",
"0.571297",
"0.56978077",
"0.5671356",
"0.5666222",
"0.564285",
"0.56418735",
"0.5628446",
"0.5623371",
"0.5621088",
"0.56208426",
"0.5618292",
"0.5615369",
"0.5614232",
"0.560977",
"0.5605945",
"0.55937636",
"0.5587455",
"0.55865055",
"0.55839914",
"0.5583551",
"0.5576043",
"0.55679345",
"0.5567441",
"0.5565407",
"0.5564571",
"0.5562378",
"0.5558225",
"0.5557471",
"0.55553234",
"0.5546593",
"0.55376095",
"0.55330205",
"0.5532524",
"0.55291504",
"0.5525582",
"0.5523758",
"0.5521284",
"0.5521262",
"0.5521043",
"0.552059",
"0.551965",
"0.5509413",
"0.550795",
"0.5506322",
"0.5505415",
"0.55051905",
"0.55042195",
"0.5503717",
"0.55022997",
"0.54982823",
"0.5496201",
"0.54914033",
"0.5490639",
"0.5488798",
"0.54884344",
"0.548823",
"0.5484023",
"0.54790807",
"0.5478855",
"0.5477822",
"0.5477718",
"0.5477038",
"0.5476832"
] |
0.0
|
-1
|
GET /ins_co_offices/1 GET /ins_co_offices/1.xml
|
def show
@ins_co_office = InsCoOffice.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @ins_co_office }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @offices = current_user.offices\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @offices }\n end\n end",
"def index\n @offices = Office.all\n #Office.lets_scrape\n end",
"def list_branch_offices\n\t\t\txml = \"<?xml version='1.0' encoding='utf-8'?>\n\t\t\t\t\t<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>\n\t\t\t\t\t <soap:Body>\n\t\t\t\t\t <listarTodasLasSucursales xmlns='http://tempuri.org/'>\n\t\t\t\t\t <usuario>#{@user}</usuario>\n\t\t\t\t\t <contrasena>#{@password}</contrasena>\n\t\t\t\t\t </listarTodasLasSucursales>\n\t\t\t\t\t </soap:Body>\n\t\t\t\t\t</soap:Envelope>\"\n\n\t\t\tbegin\n\t\t\t\txml_response = RestClient.post @server_url, xml, content_type: \"text/xml\"\n\t\t\t\tjson_response = Crack::XML.parse(xml_response)\n\t\t\t\tjson_response[\"soap:Envelope\"][\"soap:Body\"][\"listarTodasLasSucursalesResponse\"][\"listarTodasLasSucursalesResult\"][\"SucursalTO\"]\n\t\t\trescue => error\n\t\t\t\treturn CityboxApi.catch_error(error)\n\t\t\tend\n\t\tend",
"def show\n @offlearn = Offlearn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offlearn }\n end\n end",
"def path\n \"/onca/xml\"\n end",
"def url\n '/api/invoices'\n end",
"def show\n @available_off = AvailableOff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @available_off }\n end\n end",
"def show\n @socioeconomic_ocupation = SocioeconomicOcupation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @socioeconomic_ocupation }\n end\n end",
"def index\n @offices = Office.all\n json_response(@offices)\n end",
"def index\n @officers = Officer.find(:all)\n @clubs = Club.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @officers }\n end\n end",
"def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end",
"def index\n @oils = Oil.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @oils }\n end\n end",
"def index\n @offices = Office.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offices }\n end\n end",
"def show\n @officer = Officer.find(params[:id])\n @clubs = Club.find(:all)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @officer }\n end\n end",
"def show\n @officecar = Officecar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @officecar }\n end\n end",
"def get_substrates()\n\tputs \"Getting list of substrates.\"\n\tresponse = request_get('/api/partner/substrate')\n\tputs response.body\nend",
"def get_listings_xml(url)\n @client.get_content(url)\n end",
"def index\n @cst_ipis = CstIpi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cst_ipis }\n end\n end",
"def index\n @available_offs=current_employee.available_offs\n if @available_offs\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @available_offs } \n end\n else\n render :text => \"Error\"\n end\n end",
"def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end",
"def index\n # internal\n manage_filter_state\n # OCO\n init_oco if !session[:organization]\n\n @search = Office.search do\n fulltext params[:search]\n if session[:organization] != '0'\n with :organization_id, session[:organization]\n end\n data_accessor_for(Office).include = [:company]\n order_by sort_column, sort_direction\n paginate :page => params[:page] || 1, :per_page => per_page\n end\n @offices = @search.results\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offices }\n format.js\n end\n\n # if session[:organization] != '0'\n # # OCO organization active\n # @offices = Office.joins(:company).where(companies: { organization_id: session[:organization] }).paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n # else\n # # OCO inactive\n # @offices = Office.paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n # end\n end",
"def show\n @oil = Oil.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @oil }\n end\n end",
"def show\n @oil = Oil.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @oil }\n end\n end",
"def list\n @oyoyos = Oyoyo.find (:all)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @oyoyo }\n end\n \nend",
"def new\n @ins_co_office = InsCoOffice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ins_co_office }\n end\n end",
"def show\n @lsrs_soildata = LsrsSoil.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lsrs_soildata }\n end\n end",
"def index\n @cadastral_offices = CadastralOffice.all\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calibration }\n end\n end",
"def index\n @exposures = Exposure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @exposures }\n end\n end",
"def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end",
"def show\n @invoiceline = Invoiceline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invoiceline }\n end\n end",
"def show\n @odc_i = OdcI.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @odc_i }\n end\n end",
"def show\n @insurance_co = InsuranceCo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @insurance_co }\n end\n end",
"def index\n @offices = Office.where(\"user_id = ?\", current_user).order('created_at DESC').page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offices }\n end\n end",
"def index\n @occupancies = @location.occupancies\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @occupancies }\n end\n end",
"def index\n @clientes = Cliente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @clientes }\n end\n end",
"def show\n @concert = Concert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @concert }\n end\n end",
"def show\n @ocupation = Ocupation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ocupation }\n end\n end",
"def show\n @services_charger = ServicesCharger.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @services_charger }\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 Occi::Log.debug \"Parser call: #{response.content_type} #{entity_type} #{path.include?('-/')}\"\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 show\n @nossos_servico = NossosServico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @nossos_servico }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @coating }\n end\n end",
"def info\n CouchRest.get \"#{@uri}/\"\n end",
"def list_branch_offices_by_commune commune_id\n\t\t\txml = \"<?xml version='1.0' encoding='utf-8'?>\n\t\t\t\t\t<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>\n\t\t\t\t\t <soap:Body>\n\t\t\t\t\t <listarSucursalesSegunComuna xmlns='http://tempuri.org/'>\n\t\t\t\t\t <usuario>#{@user}</usuario>\n\t\t\t\t\t <contrasena>#{@password}</contrasena>\n\t\t\t\t\t <codigoComuna>#{commune_id}</codigoComuna>\n\t\t\t\t\t </listarSucursalesSegunComuna>\n\t\t\t\t\t </soap:Body>\n\t\t\t\t\t</soap:Envelope>\"\n\n\t\t\tbegin\n\t\t\t\txml_response = RestClient.post @server_url, xml, content_type: \"text/xml\"\n\t\t\t\tjson_response = Crack::XML.parse(xml_response)\n\t\t\t\tjson_response[\"soap:Envelope\"][\"soap:Body\"][\"listarSucursalesSegunComunaResponse\"][\"listarSucursalesSegunComunaResult\"][\"SucursalTO\"]\n\t\t\trescue => error\n\t\t\t\treturn CityboxApi.catch_error(error)\n\t\t\tend\n\t\tend",
"def index\n @committee_offices = CommitteeOffice.all\n end",
"def show\n @county = County.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.xml { render :xml => @county }\n format.xml { render :xml => @county.to_xml(:include => { :libraries => { :include => :departments } }) }\n end\n end",
"def offices\n \n end",
"def show\n @breadcrumb = 'read'\n @office = Office.find(params[:id])\n @notifications = @office.office_notifications.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @office }\n end\n end",
"def show\n @operating_expense = OperatingExpense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @operating_expense }\n end\n end",
"def index\n @feria2010observaciones = Feria2010observacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2010observaciones }\n end\n end",
"def index\n @user_openids = UserOpenid.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_openids }\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.xml { render :xml => @cso }\n end\n end",
"def show\n @colo = Colo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @colo }\n end\n end",
"def index\n @csos = Cso.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @csos }\n end\n end",
"def index\n @hk_public_holidays = HkPublicHoliday.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hk_public_holidays }\n end\n end",
"def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @clients }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @countries }\n end\n end",
"def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @client }\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 @feria2010beneficiarios = Feria2010beneficiario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2010beneficiarios }\n end\n end",
"def index\n @cst_icms = CstIcm.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cst_icms }\n end\n end",
"def show\n\n @venue = Venue.find(params[:id])\n @concerts = Concert.where(:venue_id=>@venue.id)\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @venue }\n end\n end",
"def show\n @estados_civil = EstadosCivil.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estados_civil }\n end\n end",
"def index\n @otf_lookups = OtfLookup.all(:include => :feature)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @otf_lookups }\n end\n end",
"def index\n @coatings = do_index(Coating, params)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @coatings }\n end\n end",
"def show\n @calidadtiposdocumento = Calidadtiposdocumento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calidadtiposdocumento }\n end\n end",
"def index\n @cuentas = Cuenta.all\n\n @cadena = getcuentasxml\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cadena }\n end\n end",
"def show\n @convenio = Convenio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @convenio }\n end\n end",
"def show\n @countries = Countries.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @countries }\n end\n end",
"def new\n @officer = Officer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @officer }\n end\n end",
"def index\n @st_ipis = StIpi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @st_ipis }\n end\n end",
"def index\n @countries = Country.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @countries }\n end\n end",
"def index\n \n @inquiries = Inquiry.all(:order => 'id desc').paginate(:page => params[:page], :per_page=>15)\n\n respond_to do |format|\n format.html { render 'index' }\n format.xml { render :xml => @inquiries }\n end\n end",
"def list_branch_offices_near_to opts={}\n\t\t\trequest_id = rand(10000)\n\t\t\txml = \"<?xml version='1.0' encoding='utf-8'?>\n\t\t\t\t\t<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>\n\t\t\t\t\t <soap:Body>\n\t\t\t\t\t <consultaSucursalMasCercana xmlns='http://tempuri.org/'>\n\t\t\t\t\t <usuario>#{@user}</usuario>\n\t\t\t\t\t <contrasena>#{@password}</contrasena>\n\t\t\t\t\t <id>#{request_id}</id>\n\t\t\t\t\t <nombreCalle>#{opts[:street_name]}</nombreCalle>\n\t\t\t\t\t <numeroCalle>#{opts[:street_number]}</numeroCalle>\n\t\t\t\t\t <restoCalle>#{opts[:street_detail]}</restoCalle>\n\t\t\t\t\t <NombreComuna>#{opts[:commune_name]}</NombreComuna>\n\t\t\t\t\t <latitud>#{opts[:latitude]}</latitud>\n\t\t\t\t\t <longitud>#{opts[:longitude]}</longitud>\n\t\t\t\t\t </consultaSucursalMasCercana>\n\t\t\t\t\t </soap:Body>\n\t\t\t\t\t</soap:Envelope>\"\n\n\t\t\tbegin\n\t\t\t\txml_response = RestClient.post @server_url, xml, content_type: \"text/xml\"\n\t\t\t\tjson_response = Crack::XML.parse(xml_response)\n\t\t\t\tjson_response[\"soap:Envelope\"][\"soap:Body\"][\"consultaSucursalMasCercanaResponse\"][\"consultaSucursalMasCercanaResult\"]\n\t\t\trescue => error\n\t\t\t\treturn CityboxApi.catch_error(error)\n\t\t\tend\n\t\tend",
"def show\n @orc_nota_fiscal_iten = OrcNotaFiscalIten.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @orc_nota_fiscal_iten }\n end\n end",
"def list_employees(api_object)\n puts \"Current Employees:\"\n doc = Nokogiri::XML.parse api_object.read\n names = doc.xpath('employees/employee/name').collect {|e| e.text }\n puts names.join(\", \")\n puts \"\"\nend",
"def show\n @lista_precio = ListaPrecio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lista_precio }\n end\n end",
"def index\n @solicitudes = Solicitud.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @solicitudes }\n end\n end",
"def index\n #location = GeoIp.geolocation('99.104.74.184')\n #companies = Company.within(5, :origin => [location[:latitude],location[:longitude]])\n #raise companies.inspect\n @companies = Company.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end",
"def index\n @help_offers = @job_request.help_offers\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @help_offers }\n end\n end",
"def disp_xml_rq\n body= File.open(\"public/OTA/OTA_HotelAvailRQ100.xml\").read\n render :xml => body\n end",
"def show\n @catalogs_ubication = Catalogs::Ubication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @catalogs_ubication }\n end\n end",
"def index\n @lookup_sets = LookupSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_sets }\n end\n end",
"def index\n @field_offices = FieldOffice.all\n end",
"def pacscl_xml\n document = Blacklight.default_index.search(q: \"id:#{params[:id]}\")&.dig(\"response\", \"docs\")&.first\n document = SolrDocument.new(document)\n document.suppress_xml_containers!\n respond_to do |format|\n format.xml do\n render xml: document.export_as_xml\n end\n end\n end",
"def index\n #@applicants = Applicant.paginate(:per_page => 10, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @applicants }\n end\n end",
"def show\n @lance_unico = LanceUnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lance_unico }\n end\n end",
"def show \n @calorie_intake = CalorieIntake.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calorie_intake }\n end\n end",
"def index\n @descriptor_especificos = DescriptorEspecifico.paginate(:per_page => 20, :page =>params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @descriptor_especificos }\n end\n end",
"def show\n @os_type = OsType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @os_type }\n end\n end",
"def index\n @sale_representatives = SaleRepresentative.find_all_by_company_id(current_user.company_id) \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sale_representatives }\n end\n end",
"def index\n @admin_informations = Admin::Information.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @admin_informations }\n end\n end",
"def show\n @inventario = Inventario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inventario }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ciclos }\n end\n end",
"def officers(company_number, items_per_page = nil, start_index = nil, register_type = nil, order_by = nil, register_view = nil)\n params = {}\n params[:items_per_page] = items_per_page if items_per_page\n params[:start_index] = start_index if start_index\n params[:register_type] = register_type if register_type\n params[:order_by] = order_by if order_by\n params[:register_view] = register_view if register_view\n client.get(\"company/#{company_number}/officers/\", params)\n end",
"def index\n @ingresos = Ingreso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ingresos }\n end\n end",
"def show\n @calification = Calification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calification }\n end\n end",
"def index\n @feria2009beneficiarios = Feria2009beneficiario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2009beneficiarios }\n end\n end",
"def show\n json_response(@office)\n end",
"def show\n @drop_off_location = DropOffLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @drop_off_location }\n end\n end"
] |
[
"0.6778899",
"0.6207084",
"0.61900645",
"0.61384565",
"0.60676956",
"0.59978044",
"0.5992629",
"0.59857357",
"0.597969",
"0.59686255",
"0.5964498",
"0.5959601",
"0.5952478",
"0.5948258",
"0.585986",
"0.5850791",
"0.5834076",
"0.57208395",
"0.5718783",
"0.571761",
"0.5711841",
"0.5692445",
"0.5690682",
"0.56819946",
"0.5681238",
"0.56781745",
"0.5666512",
"0.56602615",
"0.56560606",
"0.5648816",
"0.56459004",
"0.5636323",
"0.5627401",
"0.562695",
"0.562587",
"0.5614223",
"0.560084",
"0.558383",
"0.557923",
"0.5577822",
"0.55736226",
"0.5572516",
"0.5563369",
"0.5560888",
"0.554795",
"0.55428374",
"0.5540912",
"0.55394006",
"0.55299425",
"0.5523949",
"0.55222",
"0.5521083",
"0.5509107",
"0.5508416",
"0.55076694",
"0.55014473",
"0.5488888",
"0.54884166",
"0.5484315",
"0.54768485",
"0.547343",
"0.54723066",
"0.54663396",
"0.5465794",
"0.54589474",
"0.5449482",
"0.54487675",
"0.54477465",
"0.5444555",
"0.54439723",
"0.5441832",
"0.5441116",
"0.54380697",
"0.5436778",
"0.5435571",
"0.5434107",
"0.54337",
"0.542876",
"0.5419463",
"0.5418349",
"0.5413033",
"0.5406184",
"0.5400164",
"0.5394305",
"0.53942096",
"0.5392316",
"0.5391083",
"0.5380478",
"0.5380311",
"0.53788894",
"0.5377755",
"0.53701353",
"0.5368462",
"0.53674996",
"0.53647333",
"0.5363427",
"0.53634197",
"0.53622216",
"0.5352595",
"0.5351642"
] |
0.6586802
|
1
|
GET /ins_co_offices/new GET /ins_co_offices/new.xml
|
def new
@ins_co_office = InsCoOffice.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @ins_co_office }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @office = Office.new\n\t\t\n\t\t\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @office }\n end\n end",
"def new\n @officer = Officer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @officer }\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 new\n @offlearn = Offlearn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @offlearn }\n end\n end",
"def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end",
"def new\n @officecar = Officecar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @officecar }\n end\n end",
"def new\n @available_off = AvailableOff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @available_off }\n end\n end",
"def new\n @oil = Oil.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @oil }\n end\n end",
"def new\n @oil = Oil.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @oil }\n end\n end",
"def new\n @company = Company.new\n @regios = Regio.find(:all)\n @sectors = Sector.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end",
"def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @coating }\n end\n end",
"def new\n @countries = Countries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @countries }\n end\n end",
"def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoice }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @breadcrumb = 'create'\n @billing_periods = billing_periods_dropdown\n init_oco if !session[:organization]\n _o = current_offices_ids\n @centers = centers_by_office_array(_o)\n @reading_routes = reading_routes_raw_array(_o)\n # @reading_routes = reading_routes_dropdown\n end",
"def new\n\t\tPesqSecDep()\n\t\t@cliente = Cliente.new\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml {render :xml => @cliente}\n\t\tend\n\tend",
"def new\n # internal\n @breadcrumb = 'create'\n @office = Office.new\n @notifications = notifications_dropdown\n @users = users_dropdown\n @companies = companies_dropdown\n @zones = zones_dropdown\n @towns = towns_dropdown\n @provinces = provinces_dropdown\n @zipcodes = zipcodes_dropdown\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @office }\n end\n end",
"def new\n @users = User.find(:all)\n @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoice }\n end\n end",
"def new\n @reqinfo = Reqinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reqinfo }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end",
"def new\n @convenio = Convenio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @convenio }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instituto }\n end\n end",
"def new\n @nossos_servico = NossosServico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nossos_servico }\n end\n end",
"def new\n @lsrs_soildata = LsrsSoil.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lsrs_soildata }\n end\n end",
"def new\n @discovery = Discovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discovery }\n end\n end",
"def new\n @colo = Colo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @colo }\n end\n end",
"def new\n @incident = Incident.new\n \n @title = \"New Incident\" \n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end",
"def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @po }\n end\n end",
"def new\n @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end",
"def new\n @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end",
"def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument_version }\n end\n end",
"def new\n @election = Election.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @election }\n end\n end",
"def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end",
"def new\n @os_type = OsType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @os_type }\n end\n end",
"def new\n @socioeconomic_ocupation = SocioeconomicOcupation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @socioeconomic_ocupation }\n end\n end",
"def create\n @ins_co_office = InsCoOffice.new(params[:ins_co_office])\n\n respond_to do |format|\n if @ins_co_office.save\n format.html { redirect_to(@ins_co_office, :notice => 'Office was successfully created.') }\n format.xml { render :xml => @ins_co_office, :status => :created, :location => @ins_co_office }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ins_co_office.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @counterparty = Counterparty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @counterparty }\n end\n end",
"def new\n @pneighbour = Pneighbour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pneighbour }\n end\n end",
"def new\n @partytype = Partytype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partytype }\n end\n end",
"def new\n @ponto = Ponto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ponto }\n end\n end",
"def new\n @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoice }\n end\n end",
"def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end",
"def new\n @invoiceline = Invoiceline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoiceline }\n end\n end",
"def new\n @inventario = Inventario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @inventario }\n end\n end",
"def new\n @lista_precio = ListaPrecio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lista_precio }\n end\n end",
"def new_rest\n @entry_instrument = EntryInstrument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_instrument }\n end\n end",
"def new\n @aplicacion = Aplicacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aplicacion }\n end\n end",
"def new\n @services_charger = ServicesCharger.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @services_charger }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ciclo }\n end\n end",
"def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recurso }\n end\n end",
"def new\n @estados_civil = EstadosCivil.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estados_civil }\n end\n end",
"def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @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.xml { render :xml => @cliente }\n end\n end",
"def new\n @estagio = Estagio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estagio }\n end\n end",
"def new\n @olark = Olark.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @olark }\n end\n end",
"def new\n @auto = Auto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @auto }\n end\n end",
"def new\n @title = \"New Company\"\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end",
"def new\n @lookup_source = LookupSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_source }\n end\n end",
"def new\n @precio = Precio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @precio }\n end\n end",
"def new\n @getoff_info = GetoffInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @getoff_info }\n end\n end",
"def create\n @office = current_user.offices.build(params[:office])\n\n respond_to do |format|\n if @office.save\n flash[:notice] = 'Office was successfully created.'\n format.html { redirect_to(root_path) }\n format.xml { render :xml => @office, :status => :created, :location => @office }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @office.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @installation = Installation.find(params[:installation_id]) \n @offpost = Offpost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @offpost }\n end\n end",
"def new\n @ocupation = Ocupation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ocupation }\n end\n end",
"def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end",
"def new\n @peca = Peca.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @peca }\n end\n end",
"def new\n @incidenttype = Incidenttype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incidenttype }\n end\n end",
"def new\n @insurance_co = InsuranceCo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @insurance_co }\n end\n end",
"def new\n @business_partner = BusinessPartner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @business_partner }\n end\n end",
"def new\n @domino = Domino.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @domino }\n end\n end",
"def new\n @research = Research.new\n @page_title = \"Request research from White House 2 members\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @research.to_xml(:except => [:email]) }\n end\n end",
"def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end",
"def new\n @plantilla = Plantilla.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @plantilla }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @infraction_type }\n end\n end",
"def create\n @offlearn = Offlearn.new(params[:offlearn])\n\n respond_to do |format|\n if @offlearn.save\n flash[:notice] = 'Offlearn was successfully created.'\n format.html { redirect_to(@offlearn) }\n format.xml { render :xml => @offlearn, :status => :created, :location => @offlearn }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @offlearn.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @party_type = PartyType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @party_type }\n end\n end",
"def new\n @Roc = Roc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @Roc }\n end\n end",
"def new\n @calification = Calification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calification }\n end\n end",
"def new\n @new_employee_request = NewEmployeeRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @new_employee_request }\n end\n end",
"def new\n @niveis_ensino = NiveisEnsino.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @niveis_ensino }\n end\n end",
"def new\n @county = County.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @county }\n end\n end",
"def new\n @pessoa = Pessoa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pessoa }\n end\n end",
"def new\n @pessoa = Pessoa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pessoa }\n end\n end",
"def new\n @curso = Curso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @curso }\n end\n end",
"def new\n @office = Office.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @office }\n end\n end",
"def new\n @odc_i = OdcI.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @odc_i }\n end\n end",
"def new\n @solicitud = Solicitud.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitud }\n end\n end",
"def new\n @peep = Peep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @peep }\n end\n end",
"def new\n @lookup_rad = LookupRad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_rad }\n end\n end",
"def new\n @island = Island.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @island }\n end\n end",
"def new\n @incentive = Incentive.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incentive }\n end\n end",
"def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @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.xml { render :xml => @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.xml { render :xml => @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.xml { render :xml => @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.xml { render :xml => @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.xml { render :xml => @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.xml { render :xml => @company }\n end\n end",
"def new\n @inscripcione = Inscripcione.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @inscripcione }\n end\n end",
"def new\n @client = Client.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @client }\n end\n\n end",
"def new\n @poi_type = PoiType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poi_type }\n end\n end"
] |
[
"0.6782288",
"0.6741558",
"0.66297346",
"0.66275966",
"0.65640706",
"0.6553684",
"0.6552235",
"0.65375686",
"0.65375686",
"0.6515558",
"0.6482163",
"0.64396846",
"0.6438755",
"0.64386404",
"0.64208925",
"0.6417984",
"0.64154696",
"0.6386465",
"0.6380879",
"0.63801163",
"0.63781565",
"0.63774586",
"0.6373021",
"0.63721776",
"0.63669",
"0.63659215",
"0.63615876",
"0.6345439",
"0.6336048",
"0.6336048",
"0.6333032",
"0.63325727",
"0.6330996",
"0.63297784",
"0.63220197",
"0.6306902",
"0.6301898",
"0.62985206",
"0.62947935",
"0.629017",
"0.62893134",
"0.6288756",
"0.6287101",
"0.6284812",
"0.62815833",
"0.6278561",
"0.6271506",
"0.62714285",
"0.62676007",
"0.62648755",
"0.6261387",
"0.6260733",
"0.6260733",
"0.62588716",
"0.6253256",
"0.62470764",
"0.6247074",
"0.6245491",
"0.62412834",
"0.6239257",
"0.6235408",
"0.62310946",
"0.6230656",
"0.62278295",
"0.62271404",
"0.6223332",
"0.62222546",
"0.6218468",
"0.6212519",
"0.621248",
"0.62122005",
"0.6204147",
"0.62035537",
"0.61958337",
"0.619547",
"0.6193016",
"0.6191943",
"0.6189316",
"0.6188178",
"0.618369",
"0.6182866",
"0.6182866",
"0.6180975",
"0.6179707",
"0.6176699",
"0.6176217",
"0.6174465",
"0.6171993",
"0.616697",
"0.6163368",
"0.61584324",
"0.61584324",
"0.61584324",
"0.61584324",
"0.61584324",
"0.61584324",
"0.61584324",
"0.6158091",
"0.61564165",
"0.6156397"
] |
0.7053239
|
0
|
POST /ins_co_offices POST /ins_co_offices.xml
|
def create
@ins_co_office = InsCoOffice.new(params[:ins_co_office])
respond_to do |format|
if @ins_co_office.save
format.html { redirect_to(@ins_co_office, :notice => 'Office was successfully created.') }
format.xml { render :xml => @ins_co_office, :status => :created, :location => @ins_co_office }
else
format.html { render :action => "new" }
format.xml { render :xml => @ins_co_office.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @office = current_user.offices.build(params[:office])\n\n respond_to do |format|\n if @office.save\n flash[:notice] = 'Office was successfully created.'\n format.html { redirect_to(root_path) }\n format.xml { render :xml => @office, :status => :created, :location => @office }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @office.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @offices = Office.create!(office_params)\n json_response(@offices, :created)\n end",
"def list_branch_offices\n\t\t\txml = \"<?xml version='1.0' encoding='utf-8'?>\n\t\t\t\t\t<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>\n\t\t\t\t\t <soap:Body>\n\t\t\t\t\t <listarTodasLasSucursales xmlns='http://tempuri.org/'>\n\t\t\t\t\t <usuario>#{@user}</usuario>\n\t\t\t\t\t <contrasena>#{@password}</contrasena>\n\t\t\t\t\t </listarTodasLasSucursales>\n\t\t\t\t\t </soap:Body>\n\t\t\t\t\t</soap:Envelope>\"\n\n\t\t\tbegin\n\t\t\t\txml_response = RestClient.post @server_url, xml, content_type: \"text/xml\"\n\t\t\t\tjson_response = Crack::XML.parse(xml_response)\n\t\t\t\tjson_response[\"soap:Envelope\"][\"soap:Body\"][\"listarTodasLasSucursalesResponse\"][\"listarTodasLasSucursalesResult\"][\"SucursalTO\"]\n\t\t\trescue => error\n\t\t\t\treturn CityboxApi.catch_error(error)\n\t\t\tend\n\t\tend",
"def create\n @officer = Officer.new(params[:officer])\n\n respond_to do |format|\n if @officer.save\n flash[:notice] = 'Officer was successfully created.'\n format.html { redirect_to(@officer) }\n format.xml { render :xml => @officer, :status => :created, :location => @officer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @officer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @ins_co_office = InsCoOffice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ins_co_office }\n end\n end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/loan/v1\")\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 @insurance_co = InsuranceCo.new(params[:insurance_co])\n\n respond_to do |format|\n if @insurance_co.save\n format.html { redirect_to(@insurance_co, :notice => 'Insurance co was successfully created.') }\n format.xml { render :xml => @insurance_co, :status => :created, :location => @insurance_co }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @insurance_co.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n cv = ChecklistenVorlage.new({\n objekt_id: cvNode.xpath('objekt_id').text.to_s, \n bezeichner: cvNode.xpath('bezeichner').text.to_s, \n version: cvNode.xpath('version').text.to_s.to_i, \n inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool \n })\n cv.save\n\n cvNode.xpath('checklisten_eintrags/checklisten_eintrag').each do |ceNode|\n ce = ChecklistenEintrag.new({\n checklisten_vorlage_id: cv.id,\n bezeichner: ceNode.xpath('bezeichner').text.to_s,\n was: ceNode.xpath('was').text.to_s,\n wann: ceNode.xpath('wann').text.to_s,\n typ: ceNode.xpath('typ').text.to_s.to_i,\n position: ceNode.xpath('position').text.to_s.to_i\n })\n ce.save\n end\n\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n end\n end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/investmentaccount/v1\")\n end",
"def create\n @offlearn = Offlearn.new(params[:offlearn])\n\n respond_to do |format|\n if @offlearn.save\n flash[:notice] = 'Offlearn was successfully created.'\n format.html { redirect_to(@offlearn) }\n format.xml { render :xml => @offlearn, :status => :created, :location => @offlearn }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @offlearn.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def process_request\n client = Savon.client(wsdl: \"http://cit.seur.com/CIT-war/services/ImprimirECBWebService?wsdl\", \n namespaces: { \"xmlns:imp\" => \"http://localhost:7026/ImprimirECBWebService\" }, \n namespace_identifier: :imp, \n env_namespace: :soapenv, \n pretty_print_xml: true)\n \n # client.operations => [:impresion_integracion_pdf_con_ecbws, :impresion_integracion_con_ecbws]\n\n if credentials[:seur_printer].blank?\n operation = :impresion_integracion_pdf_con_ecbws\n message = build_messagePDF\n else\n operation = :impresion_integracion_con_ecbws\n message = build_messageECB\n end\n request = client.build_request(operation, message: Gyoku.xml(message))\n response = client.call(operation, message: Gyoku.xml(message))\n result = response, request\n rescue Savon::HTTPError => error\n Rails.logger.error error.http.code\n raise \n end",
"def index\n @offices = current_user.offices\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @offices }\n end\n end",
"def create\n @available_off = AvailableOff.new(params[:available_off])\n\n respond_to do |format|\n if @available_off.save\n format.html { redirect_to(@available_off, :notice => 'AvailableOff was successfully created.') }\n format.xml { render :xml => @available_off, :status => :created, :location => @available_off }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @available_off.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @officer = Officer.new(params[:officer])\n\n respond_to do |format|\n if @officer.save\n format.html { redirect_to @officer, notice: 'Officer was successfully created.' }\n format.json { render json: @officer, status: :created, location: @officer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @officer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def build_insurance_request(options={}, xml_request)\n xml_request << XmlNode.new('wwex:insuranceDetail') do |insurance|\n insurance << XmlNode.new('wwex:insuranceCategory', INSURANCE_CATEGORY[options[:insurance_category_type]])\n insurance << XmlNode.new('wwex:insuredCommodityValue', options[:insurance_commodity_value])\n insurance << XmlNode.new('wwex:insuranceIncludingFreightCharge', options[:included_the_freight_charges])\n end\n xml_request.to_s\n end",
"def create\n @niveis_ensino = NiveisEnsino.new(params[:niveis_ensino])\n\n respond_to do |format|\n if @niveis_ensino.save\n format.html { redirect_to(@niveis_ensino, :notice => 'Niveis ensino cadastrado com sucesso.') }\n format.xml { render :xml => @niveis_ensino, :status => :created, :location => @niveis_ensino }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @niveis_ensino.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\tPesqSecDep()\n\t\t@cliente = Cliente.new(params[:cliente])\n\t\t\n\t\trespond_to do |format|\n\t\t\tif @cliente.save\n\t\t\t\tformat.html {redirect_to(@cliente, :notice => 'Registro incluído com Sucesso!')}\n\t\t\t\tformat.xml {render :xml => @cliente, :status => :created, :location => @cliente}\n\t\t\telse\n\t\t\t\tformat.html {render :action => \"new\"}\n\t\t\t\tformat.xml {render :xml => @cliente.erros, :status => :unprocessable_entity }\n\t\t\tend\t\t\n\t\tend\n\tend",
"def process_offices\n if @entity_data['offices'].present?\n @company.office_locations.destroy_all\n @entity_data['offices'].each_with_index do |office_data, index|\n hq_data = (index == 0 ? { headquarters: true } : {})\n create_office_location(office_data.merge(hq_data), @company)\n end\n end\n end",
"def create\n @officer = Officer.new(officer_params)\n\n respond_to do |format|\n if @officer.save\n format.html { redirect_to @officer, notice: 'Officer was successfully created.' }\n format.json { render :show, status: :created, location: @officer }\n else\n format.html { render :new }\n format.json { render json: @officer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoiceline = Invoiceline.new(params[:invoiceline])\n\n respond_to do |format|\n if @invoiceline.save\n format.html { redirect_to(@invoiceline, :notice => 'Invoiceline was successfully created.') }\n format.xml { render :xml => @invoiceline, :status => :created, :location => @invoiceline }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invoiceline.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 add_oidc(doc)\n @logger.debug('sso - in add_oidc')\n oidc = REXML::Element.new('openidConnectClient', doc.root)\n oidc.add_attribute('id', @client_id)\n oidc.add_attribute('clientId', @client_id)\n oidc.add_attribute('clientSecret', @client_secret)\n oidc.add_attribute('authorizationEndpointUrl', @auth_url)\n oidc.add_attribute('tokenEndpointUrl', @token_url)\n oidc.add_attribute('redirectToRPHostAndPort', \"https://#{@host}\")\n oidc.add_attribute('issuerIdentifier', @issuer_identifier)\n oidc.add_attribute('scope', @scope)\n #YD 11102016 start - add PingFederate attributes\n puts '-----> Adding openidConnectClient attributes for PingFederate'\n oidc.add_attribute('grantType', @grantType)\n oidc.add_attribute('jwkEndpointUrl', @jwkEndpointUrl)\n oidc.add_attribute('signatureAlgorithm', @signatureAlgorithm)\n oidc.add_attribute('userIdentityToCreateSubject', @userIdentityToCreateSubject)\n #YD 11102016 start - add PingFederate attributes\n oidc.add_attribute('httpsRequired', 'true')\n oidc.add_attribute('sslRef', 'ssoSSLConfig')\n end",
"def create\n @cancellation = Cancellation.new_from_xml(request.body.read)\n respond_to do |format|\n if @cancellation.save! \n format.xml { render :action => 'show', :status => :created, :location => @cancellation }\n else\n format.xml { render :xml => @cancellation.errors, :status => :unprocessable_entity }\n end\n end \n \n #@orders.each do |order|\n end",
"def offices\n \n end",
"def create\n @req = Req.new(req_params)\n @req.office = current_user.office\n @req.user = current_user\n\n\n respond_to do |format|\n if @req.save\n flash[:notice] = \"Your requirement has been saved\"\n format.html { redirect_to @req }\n format.json { render :show, status: :created, location: @req }\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @req.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/creditaccount/v1\")\n end",
"def new\n \n @selecciones = Seleccion.where(\"cliente_id = ?\",usuario_actual.id)\n respond_to do |format|\n unless @selecciones.empty?\n @peso_total = Seleccion.peso_total(usuario_actual.id)\n @precio_total = Seleccion.precio_total(usuario_actual.id)\n @tarjetas = usuario_actual.tdc\n @orden = Orden.new(:direccion_entrega=>usuario_actual.direccion)\n t = Time.now\n fecha = t.strftime(\"%Y-%m-%d\")\n client = Savon::Client.new(\"http://192.168.1.121/DistribuidorFIF/webservices/servicio.php?wsdl\")\n preorden = \"<solicitud_pedido>\n <num_orden>001</num_orden>\n <nombre_comercio>Tukiosquito</nombre_comercio>\n <fecha_solicitud>\"+fecha.to_s+\"</fecha_solicitud>\n <nombre_cliente>\"+usuario_actual.nombre+\" \"+usuario_actual.apellido+\"</nombre_cliente>\n <direccion_comercio>\n <avenida>Sucre</avenida>\n <calle>-</calle>\n <edificio_casa>CC Millenium</edificio_casa>\n <local_apt>C1-15</local_apt>\n <parroquia>Leoncio Martinez</parroquia>\n <municipio>Sucre</municipio>\n <ciudad>Caracas</ciudad>\n <estado>Miranda</estado>\n <pais>Venezuela</pais>\n </direccion_comercio>\n <direccion_destino>\n <avenida>Santa Rosa</avenida>\n <calle>Tierras Rojas</calle>\n <edificio_casa>Villa Magica</edificio_casa>\n <local_apt>69</local_apt>\n <parroquia> </parroquia>\n <municipio>Zamora</municipio>\n <ciudad>Cua</ciudad>\n <estado>Miranda</estado>\n <pais>Venezuela</pais>\n </direccion_destino>\"\n @selecciones.each do |seleccion|\n p = Producto.find(seleccion.producto_id)\n preorden = preorden+\"\n <articulo>\n <id>\"+p.id.to_s+\"</id>\n <descripcion>\"+p.descripcion+\"</descripcion>\n <peso>\"+p.peso.to_s+\"</peso>\n <cantidad>\"+seleccion.cantidad.to_s+\"</cantidad>\n <precio>\"+p.precio.to_s+\"</precio>\n </articulo>\"\n end\n preorden = preorden+\"</solicitud_pedido>\"\n response = client.request :ejemplo, body: { \"value\" => preorden } \n if response.success? \n respuesta = response.to_hash[:ejemplo_response][:return]\n datos = XmlSimple.xml_in(respuesta)\n end\n\n @precio_envio = datos[\"num_orden\"][0]\n #@arreglo = XmlSimple.xml_in('')\n #@xml = XmlSimple.xml_out(@arreglo, { 'RootName' => 'solicitud_pedido' })\n #url = 'http://192.168.1.101/Antonio/tukyosquito/proyecto/servicio/servicio.php'\n #cotizacion = SOAP::RPC::Driver.new(url)\n #cotizacion.add_method('obtener','asd')\n #tdc = Tarjeta.where(\"id = ? AND cliente_id = ?\",params[:orden][:tarjeta_id],usuario_actual.id)\n #@respuesta = cotizacion.obtener('123')\n format.html # new.html.erb\n else\n format.html { redirect_to carrito_path, notice: 'No tiene productos agregados al carro de compras para generar una orden.' }\n end\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 create_invoices(invoices)\n b = Builder::XmlMarkup.new\n request_xml = b.Invoices {\n invoices.each do | invoice |\n invoice.to_xml(b)\n end\n }\n\n response_xml = http_put(@client, \"#{@xero_url}/Invoices?SummarizeErrors=false\", request_xml, {})\n\n response = parse_response(response_xml, {:request_xml => request_xml}, {:request_signature => 'PUT/invoices'})\n response.invoices.each_with_index do | response_invoice, index |\n invoices[index].invoice_id = response_invoice.invoice_id if response_invoice && response_invoice.invoice_id\n end\n response\n end",
"def upload_overdue_config_xml_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OverdueApi.upload_overdue_config_xml ...\"\n end\n # resource path\n local_var_path = \"/1.0/kb/overdue\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/xml'])\n header_params[:'X-Killbill-CreatedBy'] = opts[:'x_killbill_created_by'] if !opts[:'x_killbill_created_by'].nil?\n header_params[:'X-Killbill-Reason'] = opts[:'x_killbill_reason'] if !opts[:'x_killbill_reason'].nil?\n header_params[:'X-Killbill-Comment'] = opts[:'x_killbill_comment'] if !opts[:'x_killbill_comment'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OverdueApi#upload_overdue_config_xml\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @estados_civil = EstadosCivil.new(params[:estados_civil])\n\n respond_to do |format|\n if @estados_civil.save\n flash[:notice] = 'EstadosCivil was successfully created.'\n format.html { redirect_to(@estados_civil) }\n format.xml { render :xml => @estados_civil, :status => :created, :location => @estados_civil }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estados_civil.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @officecar = Officecar.new(params[:officecar])\n\n respond_to do |format|\n if @officecar.save\n flash[:notice] = 'Officecar was successfully created.'\n format.html { redirect_to(@officecar) }\n format.xml { render :xml => @officecar, :status => :created, :location => @officecar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @officecar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def holidayreq\n send_file '/home/user/Programs/PescadoHRIS/public/HolidayRequestForm.docx', :type => \"application/octet-stream\"\n end",
"def build_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.CancelPickupRequest(:xmlns => \"http://fedex.com/ws/pickup/v#{service[:version]}\"){\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n xml.CarrierCode @carrier_code || \"FDXE\"\n xml.PickupConfirmationNumber @pickup_confirmation_number\n xml.ScheduledDate @schedule_date\n xml.Location @location\n xml.Remarks @remarks if @remarks\n }\n end\n builder.doc.root.to_xml\n end",
"def list_branch_offices_near_to opts={}\n\t\t\trequest_id = rand(10000)\n\t\t\txml = \"<?xml version='1.0' encoding='utf-8'?>\n\t\t\t\t\t<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>\n\t\t\t\t\t <soap:Body>\n\t\t\t\t\t <consultaSucursalMasCercana xmlns='http://tempuri.org/'>\n\t\t\t\t\t <usuario>#{@user}</usuario>\n\t\t\t\t\t <contrasena>#{@password}</contrasena>\n\t\t\t\t\t <id>#{request_id}</id>\n\t\t\t\t\t <nombreCalle>#{opts[:street_name]}</nombreCalle>\n\t\t\t\t\t <numeroCalle>#{opts[:street_number]}</numeroCalle>\n\t\t\t\t\t <restoCalle>#{opts[:street_detail]}</restoCalle>\n\t\t\t\t\t <NombreComuna>#{opts[:commune_name]}</NombreComuna>\n\t\t\t\t\t <latitud>#{opts[:latitude]}</latitud>\n\t\t\t\t\t <longitud>#{opts[:longitude]}</longitud>\n\t\t\t\t\t </consultaSucursalMasCercana>\n\t\t\t\t\t </soap:Body>\n\t\t\t\t\t</soap:Envelope>\"\n\n\t\t\tbegin\n\t\t\t\txml_response = RestClient.post @server_url, xml, content_type: \"text/xml\"\n\t\t\t\tjson_response = Crack::XML.parse(xml_response)\n\t\t\t\tjson_response[\"soap:Envelope\"][\"soap:Body\"][\"consultaSucursalMasCercanaResponse\"][\"consultaSucursalMasCercanaResult\"]\n\t\t\trescue => error\n\t\t\t\treturn CityboxApi.catch_error(error)\n\t\t\tend\n\t\tend",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/bankingaccount/v1\")\n end",
"def update_offices_textfield_from_company\n\n if params[:id] == \"0\"\n @offices = []\n else\n @offices = Company.find(params[:id]).offices\n end\n\n respond_to do |format|\n format.html # update_province_textfield.html.erb does not exist! JSON only\n format.json { render json: @offices }\n end\n end",
"def create\n @operating_expense = OperatingExpense.new(params[:operating_expense])\n\n respond_to do |format|\n if @operating_expense.save\n format.html { redirect_to(@operating_expense, :notice => 'Operating expense was successfully created.') }\n format.xml { render :xml => @operating_expense, :status => :created, :location => @operating_expense }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @operating_expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n # internal\n @breadcrumb = 'create'\n @office = Office.new(params[:office])\n @office.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @office.save\n format.html { redirect_to @office, notice: crud_notice('created', @office) }\n format.json { render json: @office, status: :created, location: @office }\n else\n @notifications = notifications_dropdown\n @users = users_dropdown\n @companies = companies_dropdown\n @zones = zones_dropdown\n @towns = towns_dropdown\n @provinces = provinces_dropdown\n @zipcodes = zipcodes_dropdown\n format.html { render action: \"new\" }\n format.json { render json: @office.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"def create\n getinvoicedatum = Getinvoicedatum.get_invoice_data(params)\n\n respond_to do |format|\n if getinvoicedatum.body.include?(\"<boolean xmlns=\\\"http://www.reconline.com/\\\">true</boolean>\")\n flash[:notice] = 'Getinvoicedatum was successfully created.'\n format.html { redirect_to :action=>:index }\n format.json { render json: @getinvoicedatum, status: :created, location: @getinvoicedatum }\n else\n flash[:notice] = getinvoicedatum.body\n \n format.html { render action: \"new\" }\n format.json { render json: @getinvoicedatum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list_branch_offices_by_commune commune_id\n\t\t\txml = \"<?xml version='1.0' encoding='utf-8'?>\n\t\t\t\t\t<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>\n\t\t\t\t\t <soap:Body>\n\t\t\t\t\t <listarSucursalesSegunComuna xmlns='http://tempuri.org/'>\n\t\t\t\t\t <usuario>#{@user}</usuario>\n\t\t\t\t\t <contrasena>#{@password}</contrasena>\n\t\t\t\t\t <codigoComuna>#{commune_id}</codigoComuna>\n\t\t\t\t\t </listarSucursalesSegunComuna>\n\t\t\t\t\t </soap:Body>\n\t\t\t\t\t</soap:Envelope>\"\n\n\t\t\tbegin\n\t\t\t\txml_response = RestClient.post @server_url, xml, content_type: \"text/xml\"\n\t\t\t\tjson_response = Crack::XML.parse(xml_response)\n\t\t\t\tjson_response[\"soap:Envelope\"][\"soap:Body\"][\"listarSucursalesSegunComunaResponse\"][\"listarSucursalesSegunComunaResult\"][\"SucursalTO\"]\n\t\t\trescue => error\n\t\t\t\treturn CityboxApi.catch_error(error)\n\t\t\tend\n\t\tend",
"def build_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.PickupAvailabilityRequest(:xmlns => \"http://fedex.com/ws/pickup/v5\"){\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n add_pickup_address(xml)\n }\n end\n builder.doc.root.to_xml\n end",
"def update\n @ins_co_office = InsCoOffice.find(params[:id])\n\n respond_to do |format|\n if @ins_co_office.update_attributes(params[:ins_co_office])\n format.html { redirect_to(@ins_co_office, :notice => 'Office was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ins_co_office.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @office = Office.new(params[:office])\n @office.user = current_user\n\n respond_to do |format|\n # allow form creation on 'what's the address' page\n if @office.save(validate: false)\n track_event(\"Added Listing Address\");\n format.html { redirect_to edit_office_path(:id => @office.id)}\n format.json { render json: @office, status: :created, location: @office }\n else\n format.html { render action: \"new\" }\n format.json { render json: @office.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @officer = Officer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @officer }\n end\n end",
"def create\n @status_ref_pago_insc = StatusRefPagoInsc.new(params[:status_ref_pago_insc])\n\n respond_to do |format|\n if @status_ref_pago_insc.save\n format.html { redirect_to @status_ref_pago_insc, notice: 'Status ref pago insc was successfully created.' }\n format.json { render json: @status_ref_pago_insc, status: :created, location: @status_ref_pago_insc }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status_ref_pago_insc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @owner_invoicing_datum = OwnerInvoicingDatum.new(owner_invoicing_datum_params)\n\n respond_to do |format|\n if @owner_invoicing_datum.save\n format.html { redirect_to @owner_invoicing_datum, notice: 'Owner invoicing datum was successfully created.' }\n format.json { render :show, status: :created, location: @owner_invoicing_datum }\n else\n format.html { render :new }\n format.json { render json: @owner_invoicing_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offpost = Offpost.new(params[:offpost])\n\n respond_to do |format|\n if @offpost.save\n flash[:notice] = 'Offpost was successfully created.'\n format.html { redirect_to :back }\n format.xml { render :xml => @offpost, :status => :created, :location => @offpost }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @offpost.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @inscripcione = Inscripcione.new(params[:inscripcione])\n\n respond_to do |format|\n if @inscripcione.save\n format.html { redirect_to(@inscripcione, :notice => 'Inscripcione was successfully created.') }\n format.xml { render :xml => @inscripcione, :status => :created, :location => @inscripcione }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @inscripcione.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @office = Office.new(params[:office])\n\n respond_to do |format|\n if @office.save\n format.html { redirect_to new_office_user_path(@office), notice: 'Office was successfully created. Now create an account for office KPP manager.' }\n format.json { render json: @office, status: :created, location: @office }\n else\n format.html { render action: \"new\" }\n format.json { render json: @office.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x|\n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x|\n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end",
"def create\n @incident_proof = IncidentProof.new(incident_proof_params)\n\n respond_to do |format|\n if @incident_proof.save\n format.html { redirect_to @incident_proof, notice: 'Incident proof was successfully created.' }\n format.json { render :show, status: :created, location: @incident_proof }\n else\n format.html { render :new }\n format.json { render json: @incident_proof.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate_xml_request\n tax_receipt = generate_tax_receipt\n @certificate.certifica tax_receipt\n @key.sella tax_receipt\n tax_receipt.to_xml\n end",
"def create\n @add_to_invoice_client = AddToInvoiceClient.new(add_to_invoice_client_params)\n\n respond_to do |format|\n if @add_to_invoice_client.save\n format.html { redirect_to @add_to_invoice_client, notice: 'Add to invoice client was successfully created.' }\n format.json { render :show, status: :created, location: @add_to_invoice_client }\n else\n format.html { render :new }\n format.json { render json: @add_to_invoice_client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @selecciones = Seleccion.where(\"cliente_id = ?\",usuario_actual.id)\n @peso_total = Seleccion.peso_total(usuario_actual.id)\n @precio_total = Seleccion.precio_total(usuario_actual.id)\n @tarjetas = usuario_actual.tdc\n \n #Cobro en el banco\n client = Savon::Client.new(\"http://localhost:3001/servicios/wsdl\")\n tdc = Tarjeta.where(\"id = ? AND cliente_id = ?\",params[:orden][:tarjeta_id],usuario_actual.id)\n total_pagar = params[:orden][:total]\n pago = '<Message>\n <Request>\n <numero_tdc>'+tdc.numero+'</numero_tdc>\n <nombre_tarjetahabiente>'+tdc.tarjetahabiente+'</nombre_tarjetahabiente>\n <fecha_vencimiento>'+tdc.mes_vencimiento+'/'+tdc.ano_vencimiento+'</fecha_vencimiento>\n <codigo_seguridad>'+tdc.codigo+'</codigo_seguridad>\n <tipo_tarjeta>'+tdc.tipo+'</tipo_tarjeta>\n <direccion_cobro>'+tdc.direccion+'</direccion_cobro>\n <total_pagar>'+total_pagar+'</total_pagar>\n <cuenta_receptora>'+cuenta_receptora+'</cuenta_receptora>\n </Request>\n </Message>'\n #response = client.request :verificar_pago, body: { \"value\" => pago } \n #if response.success?\n # data = response.to_hash[:verificar_pago_response][:value][:response].first\n # @respuesta = XmlSimple.xml_in(data)\n #end\n\n #NAMESPACE = 'pagotdc'\n #URL = 'http://localhost:8080/'\n #banco = SOAP::RPC::Driver.new(URL, NAMESPACE)\n #banco.add_method('verificar_pago', 'numero_tdc', 'nombre_tarjetahabiente', 'fecha_vencimiento', 'codigo_seguridad', 'tipo_tarjeta', 'direccion_cobro', 'total_pagar', 'cuenta_receptora')\n #\n \n #respuesta = banco.verificar_pago(tdc.numero, tdc.tarjetahabiente, tdc.mes_vencimiento.to_s+'/'+tdc.ano_vencimiento.to_s, tdc.codigo, tdc.tipo, params[:orden][:total], tdc.direccion)\n \n if true #respuesta.ack.eql?(0)\n params[:orden][:cliente_id] = usuario_actual.id\n params[:orden][:total] = Seleccion.precio_total(usuario_actual.id)\n params[:orden][:fecha_entrega] = \"0000-00-00\"\n @orden = Orden.new(params[:orden])\n \n if @orden.save\n @selecciones = Seleccion.where(\"cliente_id = ?\",usuario_actual.id)\n @selecciones.each do |seleccion|\n p = Producto.find(seleccion.producto_id)\n @venta = Venta.new(:producto_id=>p.id, \n :orden_id=>@orden.id,\n :categoria_id=>p.categoria_id, \n :cantidad=>seleccion.cantidad,\n :costo=>p.precio)\n @venta.save\n end\n \n Seleccion.vaciar_carro(usuario_actual.id)\n respond_to do |format|\n format.html { redirect_to ver_ordenes_path, notice: 'Orden generada correctamente.' }\n end\n else\n respond_to do |format|\n format.html { render action: \"new\" }\n end\n end\n else\n respond_to do |format|\n format.html { render action: \"new\", notice: respuesta.mensaje }\n end\n end\n end",
"def create\n @coff = Coff.new(params[:coff])\n\n respond_to do |format|\n if @coff.save\n format.html { redirect_to @coff, notice: 'Coff was successfully created.' }\n format.json { render json: @coff, status: :created, location: @coff }\n else\n format.html { render action: \"new\" }\n format.json { render json: @coff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def gerar_nfse\n #puts load_xml\n self.cliente_soap.call(:gerar_nfse, soap_action: \"http://nfse.goiania.go.gov.br/ws/GerarNfse\", message: { arquivo_xml: self.load_xml.to_s })\n end",
"def offense_params\n params.require(:offense).permit(:ip_address, :host_name, :email, :phone)\n end",
"def create\n @inews = Inews.new(inews_params)\n\n respond_to do |format|\n if @inews.save\n format.html { redirect_to @inews, notice: 'Inews was successfully created.' }\n format.json { render :show, status: :created, location: @inews }\n else\n format.html { render :new }\n format.json { render json: @inews.errors, status: :unprocessable_entity }\n end\n end\n end",
"def url\n '/api/invoices'\n end",
"def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x| \n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x| \n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end",
"def create\n @estadocivil = Estadocivil.new(estadocivil_params)\n\n respond_to do |format|\n if @estadocivil.save\n format.html { redirect_to @estadocivil, notice: 'Estadocivil was successfully created.' }\n format.json { render :show, status: :created, location: @estadocivil }\n else\n format.html { render :new }\n format.json { render json: @estadocivil.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ocupation = Ocupation.new(params[:ocupation])\n\n respond_to do |format|\n if @ocupation.save\n format.html { redirect_to(@ocupation, :notice => 'Ocupation was successfully created.') }\n format.xml { render :xml => @ocupation, :status => :created, :location => @ocupation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ocupation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @office = Office.new(office_params)\n\n respond_to do |format|\n if @office.save\n format.html { redirect_to @office, notice: 'Office was successfully created.' }\n format.json { render :show, status: :created, location: @office }\n else\n format.html { render :new }\n format.json { render json: @office.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @partner_coordinator_association = PartnerCoordinatorAssociation.new(params[:partner_coordinator_association])\n\n respond_to do |format|\n if @partner_coordinator_association.save\n flash[:notice] = 'PartnerCoordinatorAssociation was successfully created.'\n format.html { redirect_to([:admin, @partner_coordinator_association]) }\n format.xml { render :xml => @partner_coordinator_association, :status => :created, :location => @partner_coordinator_association }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @partner_coordinator_association.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n puts \"XXXXXXXXXXXXXXXXXXX\"\n p params[:finca]\n puts \"OOOOOOOOOOOOOOOOOOO\"\n @finca = Finca.new(params[:finca])\n respond_to do |format|\n if @finca.save\n flash[:notice] = 'Finca was successfully created.'\n format.html { redirect_to(@finca) }\n format.xml { render :xml => @finca, :status => :created, :location => @finca }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @finca.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @optinpartner = Optinpartner.new(params[:optinpartner])\n\n respond_to do |format|\n if @optinpartner.save\n format.html { redirect_to @optinpartner, notice: 'Optinpartner was successfully created.' }\n format.json { render json: @optinpartner, status: :created, location: @optinpartner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @optinpartner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @orc_nota_fiscal_iten = OrcNotaFiscalIten.new(params[:orc_nota_fiscal_iten])\n\n respond_to do |format|\n if @orc_nota_fiscal_iten.save\n flash[:notice] = 'SALVO COM SUCESSO..'\n format.html { redirect_to(@orc_nota_fiscal_iten) }\n format.xml { render :xml => @orc_nota_fiscal_iten, :status => :created, :location => @orc_nota_fiscal_iten }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @orc_nota_fiscal_iten.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 create\n @invoice = Invoice.new(params[:invoice])\n @invoice.client_id = params[:clients]\n @invoice.discount_id = params[:discount_id]\n @invoice.tax_id = params[:tax_id]\n @invoice.status = Invoice::DRAFT\n @invoice.year = @counter.year\n @invoice.invoice_id = @counter.number\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n host_name = begin\n Resolv.getname(request.ip)\n rescue Resolv::ResolvError\n end || 'n/a'\n\n params[:offense].merge!({:ip_address => request.ip, :host_name => host_name})\n\n @offense = Offense.new(offense_params)\n respond_to do |format|\n if @offense.save\n if @offense.email?\n self.email\n end\n if @offense.phone?\n self.sms\n end\n format.html { redirect_to @offense, notice: 'Offense was successfully created.' }\n format.json { render :show, status: :created, location: @offense }\n else\n format.html { render :new }\n format.json { render json: @offense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @livingexpense = Livingexpense.new(params[:livingexpense])\n a=['City','Country Name','Food Cost','Accomodation Cost','Transportation Cost','User Email']\n b=[params[:livingexpense][:City],params[:livingexpense][:Country_name],params[:livingexpense][:FoodCost],params[:livingexpense][:AccomodationCost],params[:livingexpense][:TransportationCost],params[:livingexpense][:UserID]]\n \n respond_to do |format|\n if Writetocsv.writedata(a,b)\n format.html { redirect_to @livingexpense, notice: 'Thanks for your feedback!' }\n format.json { render json: @livingexpense, status: :created, location: @livingexpense }\n else\n format.html { render action: \"new\" }\n format.json { render json: @livingexpense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @orc_empenho_iten = OrcEmpenhoIten.new(params[:orc_empenho_iten])\n\n respond_to do |format|\n if @orc_empenho_iten.save\n flash[:notice] = 'SALVO COM SUCESSO.'\n format.html { redirect_to(@orc_empenho_iten) }\n format.xml { render :xml => @orc_empenho_iten, :status => :created, :location => @orc_empenho_iten }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @orc_empenho_iten.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @estagio = Estagio.new(params[:estagio])\n\n respond_to do |format|\n if @estagio.save\n flash[:notice] = 'Estagio was successfully created.'\n format.html { redirect_to(@estagio) }\n format.xml { render :xml => @estagio, :status => :created, :location => @estagio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estagio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @collection_invoice = CollectionInvoice.new(params[:collection_invoice])\n\n respond_to do |format|\n if @collection_invoice.save\n format.html { redirect_to collection_invoices_path, notice: 'Collection invoice was successfully created.' }\n format.json { render json: @collection_invoice, status: :created, location: @collection_invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @collection_invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n #@invoice.type_invoice = 'Venda'\n\n respond_to do |format|\n @invoice.status = 'ABERTA'\n @invoice.form_receipt = 'NÃO INFORMADO'\n @invoice.installments = '1'\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Criado com sucesso.' }\n format.json { render :show, status: :created, location: @invoice }\n #sweetalert_success('Dados cadastrados com sucesso!', 'Sucesso!', useRejections: false)\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @odc_i = OdcI.new(params[:odc_i])\n\n respond_to do |format|\n if @odc_i.save\n format.html { redirect_to(@odc_i, :notice => 'Odc i was successfully created.') }\n format.xml { render :xml => @odc_i, :status => :created, :location => @odc_i }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @odc_i.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @ofrece = Ofrece.new(ofrece_params)\n\n respond_to do |format|\n if @ofrece.save\n format.html { redirect_to @ofrece, notice: 'Ofrece was successfully created.' }\n format.json { render :show, status: :created, location: @ofrece }\n else\n format.html { render :new }\n format.json { render json: @ofrece.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @ins_co_office = InsCoOffice.find(params[:id])\n @ins_co_office.destroy\n\n respond_to do |format|\n format.html { redirect_to(ins_co_offices_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @onsen = Onsen.new(onsen_params)\n\n respond_to do |format|\n if @onsen.save\n format.html { redirect_to @onsen, notice: 'Onsen was successfully created.' }\n format.json { render :show, status: :created, location: @onsen }\n else\n format.html { render :new }\n format.json { render json: @onsen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @criterio_evalucion_servicio = CriterioEvalucionServicio.new(criterio_evalucion_servicio_params)\n\n respond_to do |format|\n if @criterio_evalucion_servicio.save\n\n format.html { redirect_to @criterio_evalucion_servicio, notice: 'Criterio evalucion servicio was successfully created.' }\n format.json { render :show, status: :created, location: @criterio_evalucion_servicio }\n else\n format.html { render :new }\n format.json { render json: @criterio_evalucion_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @clientsOffers = ClientsOffers.new(params[:clientsOffers])\n\n respond_to do |format|\n if @clientsOffers.save\n format.html { redirect_to @clientsOffers, notice: 'ClientsOffers was succesfully created.' }\n format.json { render json: @clientsOffers, status: :created, location: @clientsOffers }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clientsOffers.errors, status: :unprocesable_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 @chk_out_in = ChkOutIn.new(params[:chk_out_in])\n\n respond_to do |format|\n if @chk_out_in.save\n format.html { redirect_to(@chk_out_in, :notice => 'Chk out in was successfully created.') }\n format.xml { render :xml => @chk_out_in, :status => :created, :location => @chk_out_in }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @chk_out_in.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @oil = Oil.new(params[:oil])\n\n respond_to do |format|\n if @oil.save\n format.html { redirect_to(@oil, :notice => 'Oil was successfully created.') }\n format.xml { render :xml => @oil, :status => :created, :location => @oil }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @oil.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @oil = Oil.new(params[:oil])\n\n respond_to do |format|\n if @oil.save\n format.html { redirect_to(@oil, :notice => 'Oil was successfully created.') }\n format.xml { render :xml => @oil, :status => :created, :location => @oil }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @oil.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def to_xml options={}\n\n super(options) do |xml|\n\n xml.reqNumber self.reqNumber\n\n if ! self.category.nil?\n xml.category self.category.catName\n else\n xml.category \"Not defined\"\n end\n\n\n xml.industries do\n industries.each do |industry|\n xml.industry industry.indName\n end\n end\n\n end\n\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 @admins_office = Admins::Office.new(admins_office_params)\n\n respond_to do |format|\n if @admins_office.save\n format.html { redirect_to @admins_office, notice: 'Office was successfully created.' }\n format.json { render :show, status: :created, location: @admins_office }\n else\n format.html { render :new }\n format.json { render json: @admins_office.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @ins_co_office = InsCoOffice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ins_co_office }\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 create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n flash[:notice] = 'Invoice was successfully created.'\n format.html { redirect_to invoices_url }\n format.xml { head :created, :location => invoice_url(@invoice) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invoice.errors.to_xml }\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 @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 @incucai = Incucai.new(params[:incucai])\n\n respond_to do |format|\n if @incucai.save\n format.html { redirect_to @incucai, notice: 'Incucai was successfully created.' }\n format.json { render json: @incucai, status: :created, location: @incucai }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incucai.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to(@invoice, :notice => 'Invoice was successfully created.') }\n format.xml { render :xml => @invoice, :status => :created, :location => @invoice }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n # @invoice.sender_address = SenderAddress.new(invoice_params[:sender_address])\n # @invoice.client_address = ClientAddress.new(invoice_params[:client_address])\n if @invoice.save\n render :show, status: :created, location: @invoice\n else\n render json: @invoice.errors, status: :unprocessable_entity\n end\n end",
"def create\n @estacionamiento = Estacionamiento.new(estacionamiento_params)\n @lista_departamentos = Ubigeo.find_by_sql(\"select distinct idDepartamento, Departamento from ubigeos\")\n @lista_provincias = Ubigeo.find_by_sql(\"select distinct idProvincia, Provincia from ubigeos\")\n @lista_distritos = Ubigeo.find_by_sql(\"select distinct idDistrito, Distrito from ubigeos\")\n @serv_adicinales = ServAdicinale.all\n\n respond_to do |format|\n if @estacionamiento.save\n format.html { redirect_to @estacionamiento, notice: 'Estacionamiento was successfully created.' }\n format.json { render :show, status: :created, location: @estacionamiento }\n else\n format.html { render :new }\n format.json { render json: @estacionamiento.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.5972843",
"0.58993775",
"0.5696602",
"0.5676932",
"0.5502328",
"0.5480036",
"0.5472551",
"0.5425959",
"0.54230785",
"0.53897434",
"0.5375659",
"0.53277665",
"0.53269917",
"0.52758044",
"0.52560896",
"0.5250543",
"0.52231205",
"0.52176917",
"0.52162737",
"0.52116734",
"0.520456",
"0.5190254",
"0.518956",
"0.51830685",
"0.51782423",
"0.5158673",
"0.5148238",
"0.5147891",
"0.51403034",
"0.51361996",
"0.5131965",
"0.512969",
"0.5125587",
"0.5112241",
"0.51017904",
"0.5100209",
"0.5099933",
"0.50894976",
"0.5089298",
"0.50810504",
"0.507786",
"0.5075417",
"0.5063714",
"0.50616646",
"0.5058965",
"0.5051904",
"0.50494534",
"0.5046397",
"0.5044517",
"0.50387365",
"0.50323",
"0.50287104",
"0.5024849",
"0.50228053",
"0.5022221",
"0.5012749",
"0.50120044",
"0.50057364",
"0.50006086",
"0.49997702",
"0.49961254",
"0.49943107",
"0.49935368",
"0.49905893",
"0.49903694",
"0.49858043",
"0.4982164",
"0.4982157",
"0.49778187",
"0.4975891",
"0.49747714",
"0.49736816",
"0.49734578",
"0.49637678",
"0.49620333",
"0.4948615",
"0.49483562",
"0.4945574",
"0.49431527",
"0.49358788",
"0.4935338",
"0.49338844",
"0.49322197",
"0.49321952",
"0.49277338",
"0.492586",
"0.49089786",
"0.49089786",
"0.4908616",
"0.49085763",
"0.4901283",
"0.4893904",
"0.48865423",
"0.48841798",
"0.48828274",
"0.48821244",
"0.48797724",
"0.48770434",
"0.48727754",
"0.48672545"
] |
0.628173
|
0
|
PUT /ins_co_offices/1 PUT /ins_co_offices/1.xml
|
def update
@ins_co_office = InsCoOffice.find(params[:id])
respond_to do |format|
if @ins_co_office.update_attributes(params[:ins_co_office])
format.html { redirect_to(@ins_co_office, :notice => 'Office was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @ins_co_office.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @office.update(office_params)\n head :no_content\n end",
"def update\n @office = Office.find(params[:id])\n\n respond_to do |format|\n if @office.update_attributes(params[:office])\n format.html { redirect_to offices_path, notice: 'Office was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @office.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n @office = Office.find(params[:id])\n\n respond_to do |format|\n if @office.update_attributes(params[:office])\n flash[:notice] = 'Office was successfully updated.'\n format.html { redirect_to(@office) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @office.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_offices_textfield_from_company\n\n if params[:id] == \"0\"\n @offices = []\n else\n @offices = Company.find(params[:id]).offices\n end\n\n respond_to do |format|\n format.html # update_province_textfield.html.erb does not exist! JSON only\n format.json { render json: @offices }\n end\n end",
"def update\n @officer = Officer.find(params[:id])\n\n respond_to do |format|\n if @officer.update_attributes(params[:officer])\n flash[:notice] = 'Officer was successfully updated.'\n format.html { redirect_to(@officer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @officer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @invoiceline = Invoiceline.find(params[:id])\n\n respond_to do |format|\n if @invoiceline.update_attributes(params[:invoiceline])\n format.html { redirect_to(@invoiceline, :notice => 'Invoiceline was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoiceline.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_oidc(doc, oidc)\n @logger.debug('sso - in update_oidc')\n Utils.find_and_update_attribute(oidc, 'id', @client_id)\n Utils.find_and_update_attribute(oidc, 'clientId', @client_id)\n Utils.find_and_update_attribute(oidc, 'clientSecret', @client_secret)\n Utils.find_and_update_attribute(oidc, 'authorizationEndpointUrl', @auth_url)\n Utils.find_and_update_attribute(oidc, 'tokenEndpointUrl', @token_url)\n Utils.find_and_update_attribute(oidc, 'redirectToRPHostAndPort', \"https://#{@host}\")\n Utils.find_and_update_attribute(oidc, 'issuerIdentifier', @issuer_identifier)\n Utils.find_and_update_attribute(oidc, 'scope', @scope)\n #YD 11102016 start - add PingFederate attributes\n puts '-----> Updating openidConnectClient attributes for PingFederate'\n Utils.find_and_update_attribute(oidc, 'grantType', @grantType)\n Utils.find_and_update_attribute(oidc, 'jwkEndpointUrl', @jwkEndpointUrl)\n Utils.find_and_update_attribute(oidc, 'signatureAlgorithm', @signatureAlgorithm)\n Utils.find_and_update_attribute(oidc, 'userIdentityToCreateSubject', @userIdentityToCreateSubject)\n #YD 11102016 start - add PingFederate attributes\n Utils.find_and_update_attribute(oidc, 'httpsRequired', 'true')\n Utils.find_and_update_attribute(oidc, 'sslRef', 'ssoSSLConfig')\n end",
"def update\n @socioeconomic_ocupation = SocioeconomicOcupation.find(params[:id])\n\n respond_to do |format|\n if @socioeconomic_ocupation.update_attributes(params[:socioeconomic_ocupation])\n format.html { redirect_to(@socioeconomic_ocupation, :notice => 'SocioeconomicOcupation was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @socioeconomic_ocupation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @office.update(office_params)\n format.html { redirect_to @office, notice: 'Office was successfully updated.' }\n format.json { render :show, status: :ok, location: @office }\n else\n format.html { render :edit }\n format.json { render json: @office.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @officecar = Officecar.find(params[:id])\n\n respond_to do |format|\n if @officecar.update_attributes(params[:officecar])\n flash[:notice] = 'Officecar was successfully updated.'\n format.html { redirect_to(@officecar) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @officecar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @offlearn = Offlearn.find(params[:id])\n\n respond_to do |format|\n if @offlearn.update_attributes(params[:offlearn])\n flash[:notice] = 'Offlearn was successfully updated.'\n format.html { redirect_to(@offlearn) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @offlearn.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 put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update\n @officer = Officer.find(params[:id])\n\n respond_to do |format|\n if @officer.update_attributes(params[:officer])\n format.html { redirect_to @officer, :notice => 'Officer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @officer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @coff = Coff.find(params[:id])\n\n respond_to do |format|\n if @coff.update_attributes(params[:coff])\n format.html { redirect_to @coff, notice: 'Coff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @coff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @officer = Officer.find(params[:id])\n\n respond_to do |format|\n if @officer.update_attributes(params[:officer])\n format.html { redirect_to @officer, notice: 'Officer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @officer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end",
"def update\n @available_off = AvailableOff.find(params[:id])\n\n respond_to do |format|\n if @available_off.update_attributes(params[:available_off])\n format.html { redirect_to(employee_available_off_url, :notice => 'AvailableOff was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @available_off.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @insurance_co = InsuranceCo.find(params[:id])\n\n respond_to do |format|\n if @insurance_co.update_attributes(params[:insurance_co])\n format.html { redirect_to(@insurance_co, :notice => 'Insurance co was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @insurance_co.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @office_career.update(office_career_params)\n head :no_content\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 respond_to do |format|\n if @officer.update(officer_params)\n format.html { redirect_to @officer, notice: 'Officer was successfully updated.' }\n format.json { render :show, status: :ok, location: @officer }\n else\n format.html { render :edit }\n format.json { render json: @officer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @officer.update(officer_params)\n format.html { redirect_to @officer, notice: 'Officer was successfully updated.' }\n format.json { render :show, status: :ok, location: @officer }\n else\n format.html { render :edit }\n format.json { render json: @officer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # internal\n @breadcrumb = 'update'\n @office = Office.find(params[:id])\n @office.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @office.update_attributes(params[:office])\n format.html { redirect_to @office,\n notice: (crud_notice('updated', @office) + \"#{undo_link(@office)}\").html_safe }\n format.json { head :no_content }\n else\n @notifications = notifications_dropdown\n @users = users_dropdown\n @companies = companies_dropdown\n @zones = zones_dropdown\n @towns = towns_dropdown\n @provinces = provinces_dropdown\n @zipcodes = zipcodes_dropdown\n format.html { render action: \"edit\" }\n format.json { render json: @office.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @orc_suplementacao = OrcSuplementacao.find(params[:id])\n\n respond_to do |format|\n if @orc_suplementacao.update_attributes(params[:orc_suplementacao])\n flash[:notice] = 'SALVO COM SUCESSO.'\n format.html { redirect_to(@orc_suplementacao) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @orc_suplementacao.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 @getoff_info = GetoffInfo.find(params[:id])\n\n respond_to do |format|\n if @getoff_info.update_attributes(params[:getoff_info])\n format.html { redirect_to @getoff_info, :notice => 'Getoff info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @getoff_info.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @coating.update_attributes(params[:coating])\n format.html { redirect_to(@coating, :notice => t(\"screens.notice.successfully_updated\")) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @coating.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n @invoice.year = Date.today.year\n\n @invoice.client_id = params[:clients]\n @invoice.discount_id = params[:discount_id]\n @invoice.tax_id = params[:tax_id]\n\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @nossos_servico = NossosServico.find(params[:id])\n\n respond_to do |format|\n if @nossos_servico.update_attributes(params[:nossos_servico])\n format.html { redirect_to(@nossos_servico, :notice => 'Nossos servico was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @nossos_servico.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @calidadtiposdocumento = Calidadtiposdocumento.find(params[:id])\n\n respond_to do |format|\n if @calidadtiposdocumento.update_attributes(params[:calidadtiposdocumento])\n format.html { redirect_to(@calidadtiposdocumento, :notice => 'Calidadtiposdocumento was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @calidadtiposdocumento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @accounting_office = AccountingOffice.find(params[:id])\n\n respond_to do |format|\n if @accounting_office.update_attributes(params[:accounting_office])\n format.html { redirect_to @accounting_office, notice: 'Accounting office was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @accounting_office.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @niveis_ensino = NiveisEnsino.find(params[:id])\n\n respond_to do |format|\n if @niveis_ensino.update_attributes(params[:niveis_ensino])\n format.html { redirect_to(@niveis_ensino, :notice => 'Niveis ensino atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @niveis_ensino.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 @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 respond_to do |format|\n if @officev.update(officev_params)\n set_me\n format.html { redirect_to @officev, notice: 'Officev was successfully updated.' }\n format.json { render :show, status: :ok, location: @officev }\n else\n format.html { render :edit }\n format.json { render json: @officev.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 @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to(@incident) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incident.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 @estagio = Estagio.find(params[:id])\n\n respond_to do |format|\n if @estagio.update_attributes(params[:estagio])\n flash[:notice] = 'Estagio was successfully updated.'\n format.html { redirect_to(@estagio) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estagio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def _update(type, current_name, metadata={})\n type = type.to_s.camelize\n request :update do |soap|\n soap.body = {\n :metadata => {\n :current_name => current_name,\n :metadata => prepare(metadata),\n :attributes! => { :metadata => { 'xsi:type' => \"ins0:#{type}\" } }\n }\n }\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 @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 @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 @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n if @clientsOffers.update_attributes(params[:clientsOffers])\n format.html { redirect_to @clientsOffers, notice: 'ClientsOffers was succesfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clientsOffers.errors, status: :unprocesable_entity }\n end\n end\n end",
"def update\n @ocupation = Ocupation.find(params[:id])\n\n respond_to do |format|\n if @ocupation.update_attributes(params[:ocupation])\n format.html { redirect_to(@ocupation, :notice => 'Ocupation was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ocupation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @oil = Oil.find(params[:id])\n\n respond_to do |format|\n if @oil.update_attributes(params[:oil])\n format.html { redirect_to(@oil, :notice => 'Oil was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @oil.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @oil = Oil.find(params[:id])\n\n respond_to do |format|\n if @oil.update_attributes(params[:oil])\n format.html { redirect_to(@oil, :notice => 'Oil was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @oil.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @safety_officer = SafetyOfficer.find(params[:id])\n\n respond_to do |format|\n if @safety_officer.update_attributes(params[:safety_officer])\n format.html { redirect_to(incident_timesheet_path, :notice => 'Safety officer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @safety_officer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @az_invoice = AzInvoice.find(params[:id])\n\n respond_to do |format|\n if @az_invoice.update_attributes(params[:az_invoice])\n format.html { redirect_to(@az_invoice, :notice => 'AzInvoice was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @az_invoice.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 @inventario = Inventario.find(params[:id])\n @foto = @inventario.foto\n \n @service = InventarioService.new(@inventario, @foto)\n respond_to do |format|\n\n if @inventario.update_attributes(params[:inventario],params[:foto_file])\n format.html { redirect_to(@inventario, :notice => 'Inventario was successfully updated.') }\n format.xml { head :ok }\n else\n\t @foto = @service.foto\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inventario.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @status_ref_pago_insc = StatusRefPagoInsc.find(params[:id])\n\n respond_to do |format|\n if @status_ref_pago_insc.update_attributes(params[:status_ref_pago_insc])\n format.html { redirect_to @status_ref_pago_insc, notice: 'Status ref pago insc was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status_ref_pago_insc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def override\n document_id = params[:document_id]\n document = params[:document]\n document_type = params[:document_type]\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 if document\n xml.summary document_type\n if document\n xml.content(:type => document.content_type) {\n xml.text Base64.encode64(document.read)\n }\n end\n }\n end\n\n url = Document::PATH + \"cmis/i/#{document_id}?alf_ticket=\" + ticket\n\n begin\n RestClient.put url, builder.to_xml, {:content_type => 'application/atom+xml;type=entry'}\n rescue => e\n Rails.logger.info \"#\"*50\n Rails.logger.info \"Error updating file\"\n Rails.logger.info e.message\n Rails.logger.info \"#\"*50\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 update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to(@invoice, :notice => 'Invoice was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def 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.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @opinion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n flash[:notice] = 'Invoice was successfully updated.'\n format.html { redirect_to invoices_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors.to_xml }\n end\n end\n end",
"def update\n @collection_invoice = CollectionInvoice.find(params[:id])\n\n respond_to do |format|\n if @collection_invoice.update_attributes(params[:collection_invoice])\n format.html { redirect_to collection_invoices_path, notice: 'Collection invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collection_invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @optinpartner = Optinpartner.find(params[:id])\n\n respond_to do |format|\n if @optinpartner.update_attributes(params[:optinpartner])\n format.html { redirect_to @optinpartner, notice: 'Optinpartner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @optinpartner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cb_ipo.update(cb_ipo_params)\n format.html { redirect_to @cb_ipo, notice: 'Cb ipo was successfully updated.' }\n format.json { render :show, status: :ok, location: @cb_ipo }\n else\n format.html { render :edit }\n format.json { render json: @cb_ipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ecopoint.update(ecopoint_params)\n format.html { redirect_to @ecopoint, notice: 'Ecopoint was successfully updated.' }\n format.json { render :show, status: :ok, location: @ecopoint }\n else\n format.html { render :edit }\n format.json { render json: @ecopoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @oyoyo = Oyoyo.find(params[:id])\n\n respond_to do |format|\n if @oyoyo.update_attributes(params[:oyoyo])\n flash[:notice] = 'Oyoyo was successfully updated.'\n format.html { redirect_to(@oyoyo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @oyoyo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def update\n @operating_expense = OperatingExpense.find(params[:id])\n\n respond_to do |format|\n if @operating_expense.update_attributes(params[:operating_expense])\n format.html { redirect_to(@operating_expense, :notice => 'Operating expense was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @operating_expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def process_offices\n if @entity_data['offices'].present?\n @company.office_locations.destroy_all\n @entity_data['offices'].each_with_index do |office_data, index|\n hq_data = (index == 0 ? { headquarters: true } : {})\n create_office_location(office_data.merge(hq_data), @company)\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n flash[:notice] = 'Invoice was successfully updated.'\n format.html { redirect_to(@invoice) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n flash[:notice] = 'Invoice was successfully updated.'\n format.html { redirect_to(@invoice) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n @invoice.timestamp = Time.now\n @invoice.update_totals\n\n\n# #if the invoice is paid, let's add them to the email marketing list\n# if @invoice.paid = true then\n# @cust = Customer.find_by_id(@invoice.customer_id)\n# url = \"http://allinnetworks.com/index.php?option=com_acymailing>ask=sub&task=optin&hiddenlists=1,8&user[email]=\" + @cust.email + \"&user[name]=\" + @cust.firstname + \" \" + @cust.lastname\n# @doc = Nokogiri::XML(open(url))\n# end\n\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to(invoice_path(@invoice.id), :notice => 'Invoice was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @ins_co_office = InsCoOffice.new(params[:ins_co_office])\n\n respond_to do |format|\n if @ins_co_office.save\n format.html { redirect_to(@ins_co_office, :notice => 'Office was successfully created.') }\n format.xml { render :xml => @ins_co_office, :status => :created, :location => @ins_co_office }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ins_co_office.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @economic = Economic.find(params[:id])\n\n respond_to do |format|\n if @economic.update_attributes(params[:economic])\n format.html { redirect_to(@economic, :notice => 'Economic was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @economic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @inscripcione = Inscripcione.find(params[:id])\n\n respond_to do |format|\n if @inscripcione.update_attributes(params[:inscripcione])\n format.html { redirect_to(@inscripcione, :notice => 'Inscripcione was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inscripcione.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @vdocs_requirement = VdocsRequirement.find(params[:id])\n\t@contract = @vdocs_requirement.contract\n\n respond_to do |format|\n if @vdocs_requirement.update_attributes(params[:vdocs_requirement])\n flash[:notice] = 'VdocsRequirement was successfully updated.'\n format.html { redirect_to(@vdocs_requirement) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vdocs_requirement.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 @inews.update(inews_params)\n format.html { redirect_to @inews, notice: 'Inews was successfully updated.' }\n format.json { render :show, status: :ok, location: @inews }\n else\n format.html { render :edit }\n format.json { render json: @inews.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @orc_ata = OrcAta.find(params[:id])\n\n respond_to do |format|\n if @orc_ata.update_attributes(params[:orc_ata])\n flash[:notice] = 'SALVO COM SUCESSO'\n format.html { redirect_to(@orc_ata) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @orc_ata.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @address_cocoon.update(address_cocoon_params)\n format.html { redirect_to @address_cocoon, notice: 'Address cocoon was successfully updated.' }\n format.json { render :show, status: :ok, location: @address_cocoon }\n else\n format.html { render :edit }\n format.json { render json: @address_cocoon.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 @opo.update(opo_params)\n format.html { redirect_to @opo, notice: 'Opo was successfully updated.' }\n format.json { render :show, status: :ok, location: @opo }\n else\n format.html { render :edit }\n format.json { render json: @opo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def set_offense\n @offense = Offense.find(params[:id])\n end",
"def update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to('/invoiceview', :notice => 'Invoice was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @goods_auto_option = GoodsAutoOption.find(params[:id])\n\n respond_to do |format|\n if @goods_auto_option.update_attributes(params[:goods_auto_option])\n format.html { redirect_to(@goods_auto_option, :notice => 'GoodsAutoOption was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @goods_auto_option.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @ins_co_office = InsCoOffice.find(params[:id])\n @ins_co_office.destroy\n\n respond_to do |format|\n format.html { redirect_to(ins_co_offices_url) }\n format.xml { head :ok }\n end\n end",
"def update\n @inquiry = Inquiry.find(params[:id])\n\n respond_to do |format|\n if @inquiry.update_attributes(params[:inquiry])\n format.html { redirect_to(@inquiry, :notice => 'Inquiry was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inquiry.errors, :status => :unprocessable_entity }\n end\n end\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 set_socioeduk_atendimento_inicial_documento\n @socioeduk_atendimento_inicial_documento = Socioeduk::AtendimentoInicialDocumento.find(params[:id])\n end",
"def update\n @spouse = Spouse.find(params[:id])\n\n respond_to do |format|\n if @spouse.update_attributes(params[:spouse])\n flash[:notice] = 'Spouse was successfully updated.'\n format.html { redirect_to(@spouse) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spouse.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @frequencia_orgao = Frequencia::Orgao.find(params[:id])\n\n respond_to do |format|\n if @frequencia_orgao.update_attributes(params[:frequencia_orgao])\n format.html { redirect_to(@frequencia_orgao, :notice => 'Orgão atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @frequencia_orgao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @industry = Industry.find(params[:id])\n\n respond_to do |format|\n if @industry.update_attributes(params[:industry])\n flash[:notice] = 'Industry was successfully updated.'\n format.html { redirect_to(@industry) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @industry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @add_to_invoice_client.update(add_to_invoice_client_params)\n format.html { redirect_to @add_to_invoice_client, notice: 'Add to invoice client was successfully updated.' }\n format.json { render :show, status: :ok, location: @add_to_invoice_client }\n else\n format.html { render :edit }\n format.json { render json: @add_to_invoice_client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_officev\n @officev = Officev.find(params[:id])\n end",
"def index\n @offices = current_user.offices\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @offices }\n end\n end",
"def update\n # @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @office_type.update(office_type_params)\n format.html { redirect_to @office_type, notice: 'Office type was successfully updated.' }\n format.json { render :show, status: :ok, location: @office_type }\n else\n format.html { render :edit }\n format.json { render json: @office_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def manage_convenios(resource)\n resource ||= JSON.parse(resource.to_json)\n resource.each do |_key, value|\n\n @cliente_convenio = self.cliente_convenios.find_by(id: value[\"cliente_convenio_id\"].to_i) if value[\"cliente_convenio_id\"].present?\n if value['option']==\"edit\" and !@cliente_convenio.nil?\n @cliente_convenio.update_attributes(convenio_id: value[\"convenio_id\"],\n status_convenio: value[\"status_convenio\"],\n validade_carteira: value[\"validade_carteira\"],\n matricula: value[\"matricula\"],\n produto: value[\"produto\"],\n titular: value[\"titular\"],\n plano: value[\"plano\"],\n via: value[\"via\"],\n observacoes: value[\"observacoes\"],\n utilizando_agora: value[\"utilizando_agora\"])\n else\n @cliente_convenio = self.cliente_convenios.build(convenio_id: value[\"convenio_id\"].to_i,\n status_convenio: value[\"status_convenio\"],\n validade_carteira: value[\"validade_carteira\"],\n matricula: value[\"matricula\"],\n produto: value[\"produto\"],\n titular: value[\"titular\"],\n plano: value[\"plano\"],\n via: value[\"via\"],\n observacoes: value[\"observacoes\"],\n utilizando_agora: value[\"utilizando_agora\"])\n @cliente_convenio.save!\n end\n end\n end",
"def update\n @documentotipo = Documentotipo.find(params[:id])\n\n respond_to do |format|\n if @documentotipo.update_attributes(params[:documentotipo])\n format.html { redirect_to @documentotipo, notice: 'Documentotipo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @documentotipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @xrf_coc.update(xrf_coc_params)\n format.html { redirect_to @xrf_coc, notice: 'Xrf coc was successfully updated.' }\n format.json { render :show, status: :ok, location: @xrf_coc }\n else\n format.html { render :edit }\n format.json { render json: @xrf_coc.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 @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n\n respond_to do |format|\n if @observacao_vocacionada.update_attributes(params[:observacao_vocacionada])\n format.html { redirect_to @observacao_vocacionada}\n flash[:notice] = \"Registro alterado com sucesso!\"\n else\n format.html { render action: \"edit\" }\n format.json { render json: @observacao_vocacionada.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.61209834",
"0.58853495",
"0.5862495",
"0.5802529",
"0.57994395",
"0.5777615",
"0.57137275",
"0.5679202",
"0.56741464",
"0.56029654",
"0.5584538",
"0.5583037",
"0.5563727",
"0.5562154",
"0.54945403",
"0.54758495",
"0.5463382",
"0.54628986",
"0.54586387",
"0.54527646",
"0.5438996",
"0.5435177",
"0.54329675",
"0.54329675",
"0.54184496",
"0.5399794",
"0.53979564",
"0.53850186",
"0.53848875",
"0.53845227",
"0.5381153",
"0.5370074",
"0.53480935",
"0.5335497",
"0.5329431",
"0.53240883",
"0.5313187",
"0.5308786",
"0.5307972",
"0.5304266",
"0.53036124",
"0.5298715",
"0.5298299",
"0.5278649",
"0.5276551",
"0.5270495",
"0.5268821",
"0.5260574",
"0.5260574",
"0.5259743",
"0.52585727",
"0.5258287",
"0.5243953",
"0.5242116",
"0.52371794",
"0.5229728",
"0.5228356",
"0.5227062",
"0.522242",
"0.5220098",
"0.52193195",
"0.52191114",
"0.52182496",
"0.52175814",
"0.5214424",
"0.5208094",
"0.5207796",
"0.5207796",
"0.5201819",
"0.52014995",
"0.51974857",
"0.5196957",
"0.51969516",
"0.51933855",
"0.5183192",
"0.51806384",
"0.5179987",
"0.51774293",
"0.51765555",
"0.5176072",
"0.5175065",
"0.5169358",
"0.51684505",
"0.51670164",
"0.5162337",
"0.515926",
"0.5158141",
"0.51499337",
"0.5146163",
"0.51445603",
"0.51439553",
"0.51407695",
"0.51402444",
"0.5138785",
"0.5138613",
"0.5134492",
"0.5133663",
"0.5132578",
"0.51309294",
"0.5124845"
] |
0.64627606
|
0
|
DELETE /ins_co_offices/1 DELETE /ins_co_offices/1.xml
|
def destroy
@ins_co_office = InsCoOffice.find(params[:id])
@ins_co_office.destroy
respond_to do |format|
format.html { redirect_to(ins_co_offices_url) }
format.xml { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @office = Office.find(params[:id])\n @office.destroy\n\n respond_to do |format|\n format.html { redirect_to(offices_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @office.destroy\n head :no_content\n end",
"def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def delete(id)\r\n connection.delete(\"/#{@doctype}[@ino:id=#{id}]\")\r\n end",
"def destroy\n @convenio = Convenio.find(params[:id])\n @convenio.destroy\n\n respond_to do |format|\n format.html { redirect_to(convenios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @officer = Officer.find(params[:id])\n @officer.destroy\n\n respond_to do |format|\n format.html { redirect_to(officers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @socioeconomic_ocupation = SocioeconomicOcupation.find(params[:id])\n @socioeconomic_ocupation.destroy\n\n respond_to do |format|\n format.html { redirect_to(socioeconomic_ocupations_url) }\n format.xml { head :ok }\n end\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def destroy\n @ocupation = Ocupation.find(params[:id])\n @ocupation.destroy\n\n respond_to do |format|\n format.html { redirect_to(ocupations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @offlearn = Offlearn.find(params[:id])\n @offlearn.destroy\n\n respond_to do |format|\n format.html { redirect_to(offlearns_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n @calidadtiposdocumento = Calidadtiposdocumento.find(params[:id])\n @calidadtiposdocumento.destroy\n\n respond_to do |format|\n format.html { redirect_to(calidadtiposdocumentos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @available_off = AvailableOff.find(params[:id])\n @available_off.destroy\n\n respond_to do |format|\n format.html { redirect_to(employee_available_offs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @officecar = Officecar.find(params[:id])\n @officecar.destroy\n\n respond_to do |format|\n format.html { redirect_to(officecars_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @gstr_advance_receipts = GstrAdvanceReceipt.find_by_id_and_company_id(params[:id], @company.id)\n @gstr_advance_receipts.delete_gstr_one_entry \n @gstr_advance_receipts.delete\n respond_to do |format|\n @gstr_advance_receipts.register_delete_action(request.remote_ip, @current_user, 'deleted')\n format.html { redirect_to(gstr_advance_receipts_url, :notice =>\"Gstr Advance Receipt has been succesfully deleted\") }\n format.xml {head :ok}\n \n end\n end",
"def destroy\n @auto1h_fold_change = Auto1hFoldChange.find(params[:id])\n @auto1h_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to(auto1h_fold_changes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @office = Office.find(params[:id])\n @office.destroy\n\n respond_to do |format|\n format.html { redirect_to offices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @cita = Cita.find(params[:id])\n paciente_id=@cita.paciente_id\n Operation.delete_all \"cita_id = #{@cita.id}\"\n consulta=Consulta.find_by_cita_id(params[:id])\n consulta.update_attributes(:cita_id => nil)\n @cita.destroy\n \n respond_to do |format|\n format.html { redirect_to :controller => \"lab\",:action => \"crea_cita\",:id => paciente_id,:id_cons => consulta.id }\n format.xml { head :ok }\n end\n end",
"def destroy\n @documento = @externo.documentos.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url(@externo)) }\n format.xml { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @invoiceline = Invoiceline.find(params[:id])\n @invoiceline.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoicelines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @concert = Concert.find(params[:id])\n @concert.destroy\n\n respond_to do |format|\n format.html { redirect_to(concerts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @oil = Oil.find(params[:id])\n @oil.destroy\n\n respond_to do |format|\n format.html { redirect_to(oils_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @oil = Oil.find(params[:id])\n @oil.destroy\n\n respond_to do |format|\n format.html { redirect_to(oils_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @insurance_co = InsuranceCo.find(params[:id])\n @insurance_co.destroy\n\n respond_to do |format|\n format.html { redirect_to(insurance_cos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @domino = Domino.find(params[:id])\n @domino.destroy\n\n respond_to do |format|\n format.html { redirect_to(dominos_url) }\n format.xml { head :ok }\n end\n end",
"def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end",
"def destroy\n @fax_document = FaxDocument.find(params[:id])\n @fax_document.destroy\n \n respond_to do |format|\n format.html { redirect_to(fax_documents_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n Iterable.request(conf, base_path).delete\n end",
"def deleteEntityFax( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/fax\",params)\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def destroy\n @operating_expense = OperatingExpense.find(params[:id])\n @operating_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(operating_expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @economic = Economic.find(params[:id])\n @economic.destroy\n\n respond_to do |format|\n format.html { redirect_to(economics_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @omatsuri = Omatsuri.find(params[:id])\n @omatsuri.destroy\n\n respond_to do |format|\n format.html { redirect_to(omatsuris_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @expedicao = Expedicao.find(params[:id])\n @expedicao.destroy\n\n respond_to do |format|\n format.html { redirect_to(expedicoes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bixo = Bixo.find(params[:id])\n @bixo.destroy\n\n respond_to do |format|\n format.html { redirect_to(bixos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @documentoclasificacion = Documentoclasificacion.find(params[:id])\n @documentoclasificacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentoclasificaciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @colonoscopytest = Colonoscopytest.find(params[:id])\n @colonoscopytest.destroy\n\n respond_to do |format|\n format.html { redirect_to(colonoscopytests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @docent = Docent.find(params[:id])\n @docent.destroy\n\n respond_to do |format|\n format.html { redirect_to(docents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @odc_i = OdcI.find(params[:id])\n @odc_i.destroy\n\n respond_to do |format|\n format.html { redirect_to(odc_is_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @office = Office.find(params[:id])\n\n authorize! :destroy, @office\n \n @office.destroy\n\n track_event(\"Deleted Listing\");\n\n respond_to do |format|\n format.html { redirect_to offices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @req_breakdown = ReqBreakdown.find(params[:id])\n @req_breakdown.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_req_breakdowns_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @documento = Documento.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @aplicacion = Aplicacion.find(params[:id])\n @aplicacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(aplicacions_url) }\n format.xml { head :ok }\n end\n end",
"def delete(slide)\n # ./_rels/presentation.xml.rels\n # Update Relationship ids\n # Insert a new one slideRef\n @doc.edit_xml @doc.presentation.rels.path do |xml|\n # Calucate the next id\n # next_id = xml.xpath('//xmlns:Relationship[@Id]').map{ |n| n['Id'] }.sort.last.succ\n # TODO - Figure out how to make this more MS idiomatic up 9->10 instead of incrementing\n # the character....\n # Insert that into the slide and crakc open the presentation.xml file\n\n target = slide.path.relative_path_from(@doc.presentation.path.dirname)\n relationship = xml.at_xpath(\"/xmlns:Relationships/xmlns:Relationship[@Type='#{Slide::REL_TYPE}' and @Target='#{target}']\")\n # ./presentation.xml\n # Update attr\n # p:notesMasterId\n # Insert attr\n # p:sldId, increment, etc.\n @doc.edit_xml '/ppt/presentation.xml' do |xml|\n xml.at_xpath(\"/p:presentation/p:sldIdLst/p:sldId[@r:id='#{relationship['Id']}']\").remove\n end\n relationship.remove\n end\n\n # Delete slide link and slideNotes link from ./[Content-Types].xml \n @doc.edit_xml @doc.content_types.path do |xml|\n xml.at_xpath(\"/xmlns:Types/xmlns:Override[@ContentType='#{Slide::CONTENT_TYPE}' and @PartName='#{slide.path}']\").remove\n xml.at_xpath(\"/xmlns:Types/xmlns:Override[@ContentType='#{Notes::CONTENT_TYPE}' and @PartName='#{slide.notes.path}']\").remove\n end\n\n # Update ./ppt\n # !!! DESTROY !!!\n # ./slides\n # Delete files\n # ./_rels/notesSlide(\\d+).xml.rels\n @doc.delete slide.notes.rels.path\n # ./notesSlide(\\d+).xml file\n @doc.delete slide.notes.path\n # ./_rels/slide(\\d+).xml.rels\n @doc.delete slide.rels.path\n # ./slide(\\d+).xml file\n @doc.delete slide.path\n # ./notesSlides\n # Delete files\n\n # Hooray! We're done! Ummm, what should we return though? can't be the slide since\n # its destroyed and there's no practical way to keep it around in memory.\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 delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def delete\n @client.delete_document(@path)\n end",
"def destroy\n @inquiry = Inquiry.find(params[:id])\n @inquiry.destroy\n\n respond_to do |format|\n format.html { redirect_to(inquiries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @inquiry = Inquiry.find(params[:id])\n @inquiry.destroy\n\n respond_to do |format|\n format.html { redirect_to(inquiries_url) }\n format.xml { head :ok }\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.xml { head :ok }\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 @reqinfo = Reqinfo.find(params[:id])\n @reqinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reqinfos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @oligo = Oligo.find(params[:id])\n @oligo.destroy\n\n respond_to do |format|\n format.html { redirect_to(oligos_url) }\n format.xml { head :ok }\n end\n end",
"def deleteEntityDocument( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/document\",params)\n end",
"def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end",
"def destroy\n @goods_auto_option = GoodsAutoOption.find(params[:id])\n @goods_auto_option.destroy\n\n respond_to do |format|\n format.html { redirect_to(goods_auto_options_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @az_invoice = AzInvoice.find(params[:id])\n @az_invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(az_invoices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @correspondence = Correspondence.find(params[:id])\n @correspondence.destroy\n\n respond_to do |format|\n format.html { redirect_to(correspondences_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n @ole.Delete()\n end",
"def delete()\n @ole.Delete()\n end",
"def delete()\n @ole.Delete()\n end",
"def delete()\n @ole.Delete()\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 @concert = Concert.find(params[:id])\n @concert.destroy\n\n respond_to do |format|\n format.html { redirect_to(concerts_url, :notice=> 'Concert was deleted.') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @certidao = Certidao.find(params[:id])\n @certidao.destroy\n\n respond_to do |format|\n format.html { redirect_to(certidaos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pfs_consultation = PfsConsultation.find(params[:id])\n @pfs_consultation.destroy\n\n respond_to do |format|\n format.html { redirect_to(pfs_consultations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @erratum = Erratum.find(params[:id])\n @erratum.destroy\n\n respond_to do |format|\n format.html { redirect_to(errata_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @prd_etc = PrdEtc.find(params[:id])\n @prd_etc.destroy\n\n respond_to do |format|\n format.html { redirect_to(prd_etcs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to(clientes_url) }\n format.xml { head :ok }\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.xml { head :ok }\n end\n end",
"def destroy\n @admin_coleccion = Admin::Coleccion.find(params[:id])\n @admin_coleccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_coleccions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @documento = Documento.find(params[:id])\n # Eliminar los registros asociativos de las tablas JOIN \n # para las asociaciones HBTM (has_and_belongs_to_many)\n #\n @documento.reconocimientos.destroy_all\n @documento.areas.destroy_all\n\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to documentos_url, :notice => \"#{@documento.titulo} eliminado\" }\n format.json { head :no_content }\n end\n end",
"def delete_all(xpath); end",
"def destroy\n \t@courier = Courier.find(params[:courier_id])\n @delivery = @courier.deliveries.find(params[:delivery_id])\n @dropoff = @delivery.dropoffs.find(params[:id])\n @dropoff.destroy\n\n respond_to do |format|\n format.html { redirect_to(dropoffs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @auto = Auto.find(params[:id])\n @auto.destroy\n\n respond_to do |format|\n format.html { redirect_to(autos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @Roc = Roc.find(params[:id])\n @Roc.destroy\n\n respond_to do |format|\n format.html { redirect_to(Rocs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @accounting_office = AccountingOffice.find(params[:id])\n @accounting_office.destroy\n\n respond_to do |format|\n format.html { redirect_to accounting_offices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orc_nota_fiscal_iten = OrcNotaFiscalIten.find(params[:id])\n @orc_nota_fiscal_iten.destroy\n\n \n respond_to do |format|\n format.html { redirect_to(orc_nota_fiscal_itens_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @office.destroy\n respond_to do |format|\n format.html { redirect_to offices_url, notice: 'Office was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estados_civil = EstadosCivil.find(params[:id])\n @estados_civil.destroy\n\n respond_to do |format|\n format.html { redirect_to(estados_civiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @orc_ata = OrcAta.find(params[:id])\n @orc_ata.destroy\n @ata =\n respond_to do |format|\n format.html { redirect_to( home_path ) }\n\n format.xml { head :ok }\n end\n end",
"def delete(oid)\n end",
"def destroy\r\n @dcf = Dcf.find(params[:id])\r\n @dcf.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(dcfs_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @absence_request = AbsenceRequest.find(params[:id])\n @absence_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(absence_requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoicehead = Invoicehead.find(params[:id])\n @invoicehead.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoiceheads_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.6583533",
"0.6518735",
"0.64920455",
"0.6396862",
"0.6299352",
"0.6170572",
"0.6164077",
"0.6160628",
"0.61012083",
"0.60825944",
"0.6075309",
"0.6060401",
"0.60582286",
"0.6047363",
"0.60300773",
"0.6015298",
"0.60115176",
"0.6001922",
"0.59869945",
"0.5981915",
"0.5976641",
"0.5974598",
"0.59663814",
"0.5963437",
"0.5961846",
"0.596126",
"0.59557617",
"0.59487677",
"0.5947573",
"0.5946755",
"0.59306276",
"0.5924561",
"0.5920659",
"0.5910616",
"0.5903686",
"0.58958346",
"0.5889345",
"0.58870757",
"0.58824134",
"0.5882392",
"0.5881456",
"0.58790976",
"0.58712196",
"0.587106",
"0.5862276",
"0.5859809",
"0.5857089",
"0.5845034",
"0.5845034",
"0.5845034",
"0.5845034",
"0.5845034",
"0.58436257",
"0.5840194",
"0.5838939",
"0.58388203",
"0.5833719",
"0.58300966",
"0.58291876",
"0.58291876",
"0.5827468",
"0.5825574",
"0.5825574",
"0.5825574",
"0.5825574",
"0.58249676",
"0.58216673",
"0.5820383",
"0.5818186",
"0.58169055",
"0.58159363",
"0.581548",
"0.58154017",
"0.58154017",
"0.58154017",
"0.58154017",
"0.5815053",
"0.58142155",
"0.5812239",
"0.58114445",
"0.58097684",
"0.5804676",
"0.5802055",
"0.5800474",
"0.5800474",
"0.57976633",
"0.5796559",
"0.57958776",
"0.5791646",
"0.5790366",
"0.5787843",
"0.5780059",
"0.5779337",
"0.5778514",
"0.57769907",
"0.57747054",
"0.57724476",
"0.57721",
"0.57702786",
"0.5767154"
] |
0.6935799
|
0
|
This is made caseinsensitive by downcasing everything. That's a bummer; it would be better for the stopword filter to be caseinsensitive.
|
def extract
@tweets.each do |tweet|
sw_filter(tweet.lang)
.filter(tweet.attrs[:full_text].split.map { |w| w.downcase } )
.each do |token|
next unless is_word? token
@working_space[token] << tweet.user.id
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def reduce_case_insensitive(_production, _range, _tokens, _children)\n Regexp::IGNORECASE\n end",
"def words_to_skip_capitalization_of\n\t\t[ \n\t\t'of','a','the','and','an','or','nor','but','if','then','else','when','up','at','from','by','on',\n\t\t'off','for','in','out','over','to'\n\t\t]\n\tend",
"def words_to_skip_capitalization_of\n [\n 'of','a','the','and','an','or','nor','but','if','then','else','when','up','at','from','by','on',\n 'off','for','in','out','over','to'\n ]\n end",
"def case_insensitive_match; end",
"def stop_words\n # Words taken from Jonathan Feinberg's cue.language (via jasondavies.com), see lib/cue.language/license.txt.\n \"i|me|my|myself|we|us|our|ours|ourselves|you|your|yours|yourself|yourselves|he|him|his|himself|she|her|hers|herself|it|its|itself|they|them|their|theirs|themselves|what|which|who|whom|whose|this|that|these|those|am|is|are|was|were|be|been|being|have|has|had|having|do|does|did|doing|will|would|should|can|could|ought|im|youre|hes|shes|its|were|theyre|ive|youve|weve|theyve|id|youd|hed|shed|wed|theyd|ill|youll|hell|shell|well|theyll|isnt|arent|wasnt|werent|hasnt|havent|hadnt|doesnt|dont|didnt|wont|wouldnt|shant|shouldnt|cant|cannot|couldnt|mustnt|lets|thats|whos|whats|heres|theres|whens|wheres|whys|hows|a|an|the|and|but|if|or|because|as|until|while|of|at|by|for|with|about|against|between|into|through|during|before|after|above|below|to|from|up|upon|down|in|out|on|off|over|under|again|further|then|once|here|there|when|where|why|how|all|any|both|each|few|more|most|other|some|such|no|nor|not|only|own|same|so|than|too|very|say|says|said|shall\"\nend",
"def spell_out str\n str.downcase\nend",
"def case_insensitivity\n if url_params['case_insensitive'] == \"true\"\n \"&case_insensitive=on\"\n else\n \"\"\n end\n end",
"def ignore_case(search, case_type)\n (case_type == :smart && search !~ /[A-Z]/) || case_type == :ignore\n end",
"def case_insensitive_match=(_arg0); end",
"def filter phrase\n\t\twords = phrase.reject{ |word| stopwords_list.include? word }\n\t\twords.reject{ |word| invalid_word? word}\n\tend",
"def remove_stopwords(ary)\n @filter.filter(ary)\n end",
"def filter(text)\n text.upcase.gsub(@filter, '')\n end",
"def mixed_case(name)\n name.downcase.gsub(/\\b\\w/, &:upcase)\nend",
"def mixed_case_2(name)\n\tname.downcase.gsub(/\\b\\w/, &:upcase)\nend",
"def lower_case!(words)\n raise NotImplementedError # TODO\nend",
"def mixed_case(name)\n\tname.downcase.gsub(/\\b\\w/) {|first| first.upcase}\nend",
"def filter(keywords)\n keywords.delete_if do |key, value|\n include?(key.downcase)\n end\n end",
"def cleanupStopWords(line)\n\t#removes a, an, and, by, for, from, in, of, on, or, out, the, to, with from line\n\t\tline.gsub!(/\\ba+\\b|\\ban+\\b|\\band+\\b|\\bby+\\b|\\bfor+\\b|\\bfrom+\\b|\\bin+\\b|\\bof+\\b|\\bon+\\b|\\bor+\\b|\\bout+\\b|\\bthe+\\b|\\bto+\\b|\\bwith+\\b/, '')\n\treturn line\nend",
"def downcase() end",
"def downcase!() end",
"def partially_downcased_summary\n self.sanitized_summary.gsub(/(?:^|(?:\\.\\s))(\\w+)/) {|s| s.downcase }\n end",
"def downcase_word\n word.downcase!\n end",
"def lower_case(words)\n raise NotImplementedError # TODO\nend",
"def downcase; end",
"def downcase\n\t\tcollect(&:downcase)\n\tend",
"def name_filter(results, search)\n words = search.split(' ')\n for i in 0...words.size\n results = results.where(\"UPPER(name) LIKE ?\", \"%#{words[i]}%\")\n end\n return results\n end",
"def remove_stop_words(song)\n\ttitle = song\n\ttitle.gsub!(/\\b(a|an|and|by|for|from|in|of|on|out|the|to|with)\\b+/, \"\")\n\treturn title\nend",
"def process_stopwords(txt = self.search_text)\n #Needs to be set so highlighting will work properly (can't match quotes)\n self.highlight_token_array(txt)\n #Now put humpty dumpty back together without the nasty stopwords, sort the tokens by length\n self.search_token_array(txt).join(\" \")\n end",
"def xfrm_remove_stop_words(str)\n stop_words = ['Variant','variant', 'Erhua', 'Counter', 'Has', 'I', 'me', 'a', 'an', 'am', 'are', 'as', 'at', 'be', 'by','how', 'in', 'is', 'it', 'of', 'on', 'or', 'that', 'than', 'the', 'this', 'to', 'was', 'what', 'when', 'where', 'who', 'will', 'with', 'the']\n results = []\n str.gsub!($regexes[:inlined_tags], \"\") ## remove tag blocks\n str.split(' ').each do |sstr|\n # remove non word characters from string\n results << sstr unless stop_words.index(sstr.gsub(/[^a-zA-Z|\\s]/, '').strip)\n end\n return results.flatten.compact.join(' ')\n end",
"def case_insensitive(input)\n return 1 unless input\n\n input.split(\"\").each do |i|\n return 0 if /[[:upper:]]/ =~ i\n end\n\n return 1\n end",
"def filter_term_list(term_list)\n (term_list.map(&:downcase) - IGNORED_WORDS).reject { |t| t.size < 3 }\n end",
"def titlecase()\r\n ignore_list = %w{of etc and by the for on is at to but nor or a via}\r\n capitalize_all_ex(ignore_list)\r\n end",
"def processed\n self.scan(/[a-z]/i).join.downcase\n end",
"def underscorize!\n self.replace(self.scan(/[A-Z][a-z]*/).join(\"_\").downcase)\n end",
"def remove_non_words_and_downcase str\n # \\W means charcaters not in range [a-zA-z0-9_]\n # dash '-' is removed, but underscore '_' is kept\n # whitespace is not part of \\w so they are removed, too!\n str.downcase\n .gsub(/\\W/, '')\nend",
"def normalize_phrase phrase\n\t\tphrase.to_s.downcase\n\tend",
"def all_excluded_words\n (excluded_words + (lazy? ? LAZY_WORDS : [])).map(&:downcase)\n end",
"def initialize\n @words = (KEYWORDS + OTHERS).map(&:downcase)\n end",
"def downcase\n `return self.toLowerCase();`\n end",
"def downcase\n `return self.toLowerCase();`\n end",
"def snake_case(group = true)\n\t\t\treturn self unless self =~ %r/[A-Z\\s]/\n\t\t\treverse.scan(%r/[A-Z]+|[^A-Z]*[A-Z]+?|[^A-Z]+/).reverse.map{|word| word.reverse.downcase}.join('_').gsub(/\\s/,'_')\n\t\tend",
"def query_wo_exact_phrases(txt)\n self.query_without_exact_phrases ||= txt.gsub(Awesome::Definitions::Stopwords::QUOTED_REGEX, '')\n end",
"def sanitize_string(str, filter = /[^a-z_]/, replacement = '')\n str = ActiveSupport::Inflector.transliterate(str).downcase\n str.gsub(filter, replacement)\n end",
"def upcase() end",
"def lowercase_search_prefixes(data)\n _search_prefixes(data.downcase, LOWERCASE_SEARCHABLE)\n end",
"def word\n\t@word.downcase\nend",
"def wildcard_search_param(parameter)\n parameter.downcase\n end",
"def shout(words)\n\twords.upcase\nend",
"def upcase!() end",
"def find_filter_word_matches(filter_value, filter_list: :filters)\n sanitized_value = filter_value.downcase\n flatten_filters(filter_list).select do |filter|\n filter.downcase == sanitized_value || filter.split.map(&:downcase).include?(sanitized_value)\n end\n end",
"def downcase(input); end",
"def case_sensitive?\n !@regexp.casefold?\n end",
"def unicode_downcase\n UnicodeUtils.downcase(self)\n end",
"def rl_downcase_word(count, key)\r\n rl_change_case(count, DownCase)\r\n end",
"def titlecase!\n replace(titlecase)\n end",
"def name_case!\n self.gsub!(self, self.name_case)\n end",
"def data_strip_downcase\n self.original_text = original_text.mb_chars.strip.downcase\n self.translated_text = translated_text.mb_chars.strip.downcase\n end",
"def proper(word)\n /[[:upper:]]/.match(word) != nil\n end",
"def to_lower_case(word)\n return word.downcase\n end",
"def remove_stop_words(list)\n list.select {|word| word unless @stopwords.include? word }\n end",
"def correct_case\n orig = @query.split\n latest = @message.split\n orig.each_with_index do |original_word, j|\n if i = latest.index(original_word.downcase)\n latest[i] = original_word\n end\n end\n @message = latest.join(' ')\n end",
"def case_fix(name)\r\n fixed_name = name.split(' ')\r\n fixed_name.each do |word|\r\n word.capitalize!\r\n end\r\n fixed_name.join(' ')\r\nend",
"def strip_stopwords!(stopwords, min_length)\n @body = @body.split.delete_if() do |x| \n t = x.downcase.gsub(/[^a-z]/, '')\n t.length < min_length || stopwords.include?(t)\n end.join(' ')\n end",
"def word_case(preserve_prefixed_underscores: true)\n LuckyCase.word_case self, preserve_prefixed_underscores: preserve_prefixed_underscores\n end",
"def case_sensitive!\n @flags &= ~File::FNM_CASEFOLD\n end",
"def shout(word)\n\treturn word.upcase\nend",
"def keyword(str)\n str.split(':').first.strip.downcase\nend",
"def strip_stopwords!(stopwords, min_length)\n #noinspection RubyParenthesesAfterMethodCallInspection\n @body = @body.split.delete_if() do |x|\n t = x.downcase.gsub(/[^a-z]/, '')\n t.length < min_length || stopwords.include?(t)\n end.join(' ')\n end",
"def isStopWord(term)\n @@stopWords.include?(term) || term.length < 3\n end",
"def case_sensitive?\n true\n end",
"def index\n @case_insensitives = CaseInsensitive.all\n end",
"def shout(word)\n upper_case = word.upcase\nend",
"def word\n @word.downcase\n end",
"def downcase!\n @raw.downcase!\n end",
"def word\n @word.downcase\n end",
"def search_string string\n string.downcase.gsub(/\\s/, '')\n end",
"def stop_on *words\n @stop_words = [*words].flatten\n end",
"def remove_stop_words(question, vectorStopWords)\n vectorStopWords.each do |stopWord|\n if question.match(/\\b#{stopWord}\\b/)\n question.gsub! (/\\b#{stopWord}\\b/), ''\n end\n end\n question\n end",
"def downcase_text\n self.text.downcase!\n end",
"def upcase; end",
"def titlecase\n gsub(/\\b\\w/){ $`[-1,1] == \"'\" ? $& : $&.upcase }\n end",
"def filter_word?(word, values)\n return true unless word\n word = word.strip\n word.length < 4 ||\n word =~ /\\d{3}/ ||\n (values[0] < 5 && values[1] < 5 ) ||\n STOPWORDS.include?(word)\nend",
"def name_case(options = {})\n options = { :lazy => true, :irish => true }.merge options\n\n # Skip if string is mixed case\n if options[:lazy]\n first_letter_lower = self[0] == self.downcase[0]\n all_lower_or_upper = (self.downcase == self || self.upcase == self)\n\n return self unless first_letter_lower || all_lower_or_upper\n end\n\n localstring = downcase\n localstring.gsub!(/\\b\\w/) { |first| first.upcase }\n localstring.gsub!(/\\'\\w\\b/) { |c| c.downcase } # Lowercase 's\n\n if options[:irish]\n if localstring =~ /\\bMac[A-Za-z]{2,}[^aciozj]\\b/ or localstring =~ /\\bMc/\n match = localstring.match(/\\b(Ma?c)([A-Za-z]+)/)\n localstring.gsub!(/\\bMa?c[A-Za-z]+/) { match[1] + match[2].capitalize }\n\n # Now fix \"Mac\" exceptions\n localstring.gsub!(/\\bMacEdo/, 'Macedo')\n localstring.gsub!(/\\bMacEvicius/, 'Macevicius')\n localstring.gsub!(/\\bMacHado/, 'Machado')\n localstring.gsub!(/\\bMacHar/, 'Machar')\n localstring.gsub!(/\\bMacHin/, 'Machin')\n localstring.gsub!(/\\bMacHlin/, 'Machlin')\n localstring.gsub!(/\\bMacIas/, 'Macias')\n localstring.gsub!(/\\bMacIulis/, 'Maciulis')\n localstring.gsub!(/\\bMacKie/, 'Mackie')\n localstring.gsub!(/\\bMacKle/, 'Mackle')\n localstring.gsub!(/\\bMacKlin/, 'Macklin')\n localstring.gsub!(/\\bMacKmin/, 'Mackmin')\n localstring.gsub!(/\\bMacQuarie/, 'Macquarie')\n end\n localstring.gsub!('Macmurdo','MacMurdo')\n end\n\n # Fixes for \"son (daughter) of\" etc\n localstring.gsub!(/\\bAl(?=\\s+\\w)/, 'al') # al Arabic or forename Al.\n localstring.gsub!(/\\bAp\\b/, 'ap') # ap Welsh.\n localstring.gsub!(/\\bBen(?=\\s+\\w)/,'ben') # ben Hebrew or forename Ben.\n localstring.gsub!(/\\bDell([ae])\\b/,'dell\\1') # della and delle Italian.\n localstring.gsub!(/\\bD([aeiou])\\b/,'d\\1') # da, de, di Italian; du French; do Brasil\n localstring.gsub!(/\\bD([ao]s)\\b/,'d\\1') # das, dos Brasileiros\n localstring.gsub!(/\\bDe([lr])\\b/,'de\\1') # del Italian; der Dutch/Flemish.\n localstring.gsub!(/\\bEl\\b/,'el') # el Greek or El Spanish.\n localstring.gsub!(/\\bLa\\b/,'la') # la French or La Spanish.\n localstring.gsub!(/\\bL([eo])\\b/,'l\\1') # lo Italian; le French.\n localstring.gsub!(/\\bVan(?=\\s+\\w)/,'van') # van German or forename Van.\n localstring.gsub!(/\\bVon\\b/,'von') # von Dutch/Flemish\n\n # Fix roman numeral names\n localstring.gsub!(\n / \\b ( (?: [Xx]{1,3} | [Xx][Ll] | [Ll][Xx]{0,3} )?\n (?: [Ii]{1,3} | [Ii][VvXx] | [Vv][Ii]{0,3} )? ) \\b /x\n ) { |match| match.upcase }\n\n localstring\n end",
"def fdowncase\n downcase.cdowncase\n end",
"def constantize(string)\n return string.downcase.gsub(/[^a-z]/i, '') \n end",
"def case_sensitive?\n !@regexp.casefold?\n end",
"def reformatInput(word)\n return String.downcase(String.chars.sort(&:casecmp).join)\n end",
"def strict_matching(ingredient_name,item)\n return item.downcase.include?(ingredient_name)\nend",
"def alphafilter\n self.gsub(/[^a-zA-Z\\s]/, '')\n end",
"def remove_bad_words(report_model = nil)\n all_words = Word.all_words\n contain_bad_words = false\n res = self.gsub(/\\b\\w+\\b/) do |word|\n if all_words.include?(word.downcase)\n contain_bad_words = true\n '***'\n else\n word\n end\n end.squeeze(' ')\n Report.where(description: 'Contain bad words', target: report_model).first_or_create if contain_bad_words\n res\n end",
"def weirdcase string\n string.split(\" \").map{|word| toWeirdCase(word)}.join(\" \")\nend",
"def clean_str(word)\n word.gsub(/[^\\w]/, '').downcase\n end",
"def get_stop_word_array\n\t\treturn ['a','about','above','after','again','against','all','am','an','and','any','are',\"aren't\",'as','at','be','because','been','before','being','below','between','both','but','by',\n\t\t\t\t\"can't\",'cannot','could',\"couldn't\",'did',\"didn't\",'do','does',\"doesn't\",'doing',\"don't\",'down','during','each','few','for','from','further','had',\"hadn't\",'has',\"hasn't\",\n\t\t\t\t'have',\"haven't\",'having','he',\"he'd\",\"he'll\",\"he's\",'her','here',\"here's\",'hers','herself','him','himself','his','how',\"how's\",'i',\"i'd\",\"i'll\",\"i'm\",\"i've\",'if','in','into',\n\t\t\t\t'is',\"isn't\",'it',\"it's\",'its','itself',\"let's\",'me','more','most',\"mustn't\",'my','myself','no','nor','not','of','off','on','once','only','or','other','ought','our','ours',\n\t\t\t\t'ourselves','out','over','own','same',\"shan't\",'she',\"she'd\",\"she'll\",\"she's\",'should',\"shouldn't\",'so','some','such','than','that',\"that's\",'the','their','theirs','them',\n\t\t\t\t'themselves','then','there',\"there's\",'these','they',\"they'd\",\"they'll\",\"they're\",\"they've\",'this','those','through','to','too','under','until','up','very','was',\"wasn't\",\n\t\t\t\t'we',\"we'd\",\"we'll\",\"we're\",\"we've\",'were',\"weren't\",'what',\"what's\",'when',\"when's\",'where',\"where's\",'which','while','who',\"who's\",'whom','why',\"why's\",'with',\"won't\",\n\t\t\t\t'would',\"wouldn't\",'you',\"you'd\",\"you'll\",\"you're\",\"you've\",'your','yours','yourself','yourselves','zero']\n\tend",
"def fix_keywords\n @fix_keywords_cache ||= all_applicable_hooks.map do |hook|\n hook.keywords.map { |keyword| keyword.downcase.strip }\n end.flatten.uniq\n end",
"def test_exclusion_match_nocase\r\n\t\tcontent = \"first line.\\nthis string does not contain a case sensitive match on: MyMatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.not_modifier = true\r\n\t\tsnort_rule_content.unescaped_string = \"mymatch123\"\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(0, match,\"case sensitive exclusion match on content didnt fire.\")\t\r\n\tend",
"def remove_stop_words(list)\n if @filter_stop_words\n list.select {|word| !@stopwords.include?(word) }\n else\n list\n end\n end",
"def smash\n downcase.scan(/\\w+/).join\n end",
"def is_lower?(c)\n return c != c.capitalize\n end",
"def sanitize(words)\n#lowercases the string\n lower_case = lowerCase(words)\n#removes all the special elements\nclean_string = clean(lower_case)\nend",
"def upcase\n return @word.upcase\n end",
"def word_case?(allow_prefixed_underscores: true)\n LuckyCase.word_case? self, allow_prefixed_underscores: allow_prefixed_underscores\n end"
] |
[
"0.7214392",
"0.71627814",
"0.70379704",
"0.7018476",
"0.66996205",
"0.66654193",
"0.66247535",
"0.662042",
"0.6574865",
"0.6517637",
"0.651462",
"0.6495328",
"0.6472453",
"0.6435291",
"0.6393078",
"0.6382332",
"0.63339794",
"0.6262782",
"0.6260746",
"0.6245256",
"0.6232074",
"0.6226842",
"0.62200695",
"0.6214482",
"0.6200989",
"0.6184686",
"0.6128087",
"0.6126947",
"0.6116991",
"0.60833406",
"0.6079084",
"0.6051426",
"0.60384303",
"0.603614",
"0.60311353",
"0.60285026",
"0.6025356",
"0.6020462",
"0.6013929",
"0.6013929",
"0.6011586",
"0.6001861",
"0.60005707",
"0.59949553",
"0.59874976",
"0.5985264",
"0.59815854",
"0.5977953",
"0.5972851",
"0.5968221",
"0.59656024",
"0.59564966",
"0.5950626",
"0.594926",
"0.5949252",
"0.5945846",
"0.5933666",
"0.59287745",
"0.59266955",
"0.59265757",
"0.5926041",
"0.5925821",
"0.59245235",
"0.59090066",
"0.5906658",
"0.5900971",
"0.58987427",
"0.5889882",
"0.58894753",
"0.58859414",
"0.5883672",
"0.5874608",
"0.58725566",
"0.586913",
"0.5867289",
"0.58665395",
"0.5866235",
"0.58658123",
"0.5865713",
"0.58641225",
"0.58267146",
"0.58240175",
"0.5819347",
"0.5819181",
"0.5813416",
"0.581279",
"0.5808081",
"0.5791613",
"0.5789633",
"0.57876766",
"0.5769221",
"0.5765248",
"0.57590634",
"0.57549554",
"0.57479477",
"0.57458866",
"0.5741726",
"0.57269394",
"0.57233346",
"0.57212704",
"0.572086"
] |
0.0
|
-1
|
Inserta un valor al principio de la lista.
|
def push_head(value)
if value.class == Nodo
added_node = value
else
added_node = Nodo.new(value)
end
added_node.prev = nil
added_node.next = @head
@head.prev = added_node unless @head.nil?
@head = added_node
@tail = added_node if @tail.nil?
@sz = @sz + 1
return nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def insert(clave, valor)\r\n @grafo[clave] = valor\r\n end",
"def insert(value) \n self.head.nil? ? insert_empty_list(value) : insert_on_end(value)\n\n print \"=> Result insertion: \"\n print_simple_list(self.last)\n end",
"def insertar_lista_principio(referencia)\n if @principio != nil && @principio.siguiente != nil\n n = @principio\n @principio = Nodo.new(referencia, n, nil)\n n.anterior = @principio\n elsif @principio != nil\n n = @principio\n @principio = Nodo.new(referencia, n, nil)\n n.anterior = @principio\n @final = n\n else\n @principio = Nodo.new(referencia, nil, nil)\n @final = @principio\n end\n end",
"def insertar(value)\n insert(Node.new(value, nil, nil))\n end",
"def insert(v)\n \n end",
"def insertar(texto,timestamp,usuario,fotousuario)\n\t\n\t\tlistaobjeto=[texto,timestamp,usuario,fotousuario]\n\t\t@Lista+=[listaobjeto]\n\tend",
"def insert(value)\n # YOUR WORK HERE\n end",
"def insert(value)\n #get hashed value\n hash_value = hash_function(value)\n # insert value\n @@collection[hash_value] = value\n\n # return confirmation\n \"value: \" << value << \" inserted at position: \" << hash_value.to_s\n end",
"def insert(value)\n #YOUR WORK HERE\n end",
"def insertar_lista_final(referencia)\n if @final != nil\n @final = Nodo.new(referencia, nil, @final)\n n = @final.anterior\n n.siguiente = @final\n else\n @principio = Nodo.new(referencia, nil, nil)\n @final = @principio\n end\n end",
"def insert(value, index)\n end",
"def insertar_por_cabeza(value)\n\t\tnodo=Node.new(value,nil,nil)\n\t\tif(@head==nil)\n\t\t\t@tail=nodo\n\t\t\t@head=nodo\n\t\telse\n\t\t\tnodo.nest=@head\n\t\t\t@head.prev=nodo\n\t\t\t@head=nodo\n\t\t\tnodo.prev=nil\n\t\tend\n\n\tend",
"def insertar_por_cola(value)\n\t\tnodo=Node.new(value,nil,nil)\n if(@tail==nil)\n @tail=nodo\n @head=nodo\n else\n nodo.prev=@tail\n @tail.nest=nodo\n @tail=nodo\n\t\t\tnodo.nest=nil\n end\n\n\tend",
"def add_item(list,name,value)\n list = List.find(list)\n list.add(Item.new(name,value))\n say_set list.name, name, value\n end",
"def add_to_list(item)\n\t# Datenstruktur : voc.id \n\t\tlist = get_list \n\t\tlist.push(item)\n\t\tnew_list = list.join(\" \")\n\t\tcookies[:\"eList\"] = { :value => new_list } \n\tend",
"def insert(loc, data)\n insert_array = data.split.reverse\n insert_array.each do |item|\n if list.allowed(item)\n @list.insert(loc, item)\n else\n 0\n end\n end\n end",
"def insert value\r\n current_head = @head\r\n #create a new node with:\r\n #\"value\" that come from LIST-INSERT argument\r\n #\"next\" that point to the node that is currently at the head\r\n #\"prev\" that is NULL since it will be spliced onto the front of the list\r\n new_node = Node.new value, current_head, nil\r\n #if the list is not empty (L.head != NULL)(there exist at least one node in the list)\r\n if current_head != nil\r\n #point the old head node prev pointer to the new node\r\n current_head.set_prev_node new_node\r\n #OPTIONAL: if the list is empty, set tail to the the first node\r\n else\r\n @tail = new_node\r\n end\r\n #point L.head to the new node\r\n @head = new_node\r\n #You can return a pointer to the new node so you can access it quickly (e.g. for reading, updating or deleting)\r\n return new_node\r\n #You can return the list so that you can chain methods\r\n return self\r\n end",
"def insert(item)\n\n\n\n\n end",
"def insert(index, value)\n if index == @size\n append(value)\n else\n assert_in_range(index)\n \n current, previous = get_node(index)\n inserted = LinkedListNode.new(:successor => current, :value => value)\n previous.successor = inserted if previous\n \n @head = inserted if current == @head \n @size += 1\n end\n end",
"def insert_in_list_at(position = 1)\n insert_at_position(position)\n end",
"def insert_in_list_at(position = 1)\n insert_at_position(position)\n end",
"def insert(key, value=nil)\n if key.kind_of?(Array)\n key, value = key\n end\n if key.nil? || value.nil?\n raise CorpusError.new(\"Invalid key/value: #{key} - #{value}\")\n end\n\n ret = @db.put(key.to_s.downcase ,value.to_s.downcase)\n if !ret\n raise CorpusError.new(\"#{@db.errmsg}: #{key} - #{value}\")\n end\n end",
"def insert_at(value, index)\n length = size - 1\n if @head.nil?\n set_head(value)\n elsif index > length\n puts \"the list does not have a value associated with your given index.\"\n else\n old_node = at_no_data(index)\n old_next_node = at_no_data(index + 1)\n prev_node = at_no_data(index - 1)\n prev_node.next_node.data = value\n prev_node.next_node = old_node\n end\nend",
"def insert key, value\n begin\n db.putnr(key, value)\n rescue StandardError => e ; handle_error(\"Insert #{[key, value].inspect}\", e); end\n end",
"def insert(value)\n store.push value\n swim(length)\n self\n end",
"def insert(value)\n index = find(value)\n if index == -1\n @inner << value\n index = @inner.length - 1\n end\n return index\n end",
"def insertar(identificador, tipo, tamanio, asignacion, modificable = true)\n\t\t@tabla.store(identificador.valor.str, tipo)\n\n\t\tif tamanio != nil then\n\t\t\t@tamanio.store(identificador.valor.str, tamanio)\n\t\tend\n\n\t\tif asignacion != nil then\n\t\t\t@asignacion.store(identificador.valor.str, asignacion)\n\n\t\telse\n\n\t\t\tif tipo.str == \"int\" then\n\t\t\t\t# token = Token.new(\"0\", -1, -1)\n\t\t\t\t# nodo = NodoInt.new(token)\n\t\t\t\t@asignacion.store(identificador.valor.str, 0)\n\n\t\t\telsif tipo.str == \"bool\" then\n\t\t\t\t# token = Token.new(\"false\", -1, -1)\n\t\t\t\t# nodo = NodoBool.new(token)\n\t\t\t\t@asignacion.store(identificador.valor.str, false)\n\n\t\t\telsif tipo.str == \"bits\" && (tamanio.is_a?(Integer) || tamanio.is_a?(String)) then\n\n\t\t\t\ti = 0\n\t\t\t\tvalor = \"0b\"\n\t\t\t\twhile (i<Integer(tamanio))\n\t\t\t\t\tvalor += \"0\"\n\t\t\t\t\ti += 1\n\t\t\t\tend\n\n\t\t\t\t@asignacion.store(identificador.valor.str, valor)\n\n\t\t\tend\n\n\t\tend\n\n\t\t@modificable.store(identificador.valor.str, modificable)\n\n\tend",
"def get_value(value)\n if @head == nil #Comprobamos si la lista no esta vacía\n raise RuntimeError, \"Lista vacía, no se puede extraer nodo\"\n else\n\t\t i = @tail\n\t\t @valor=nil\n\t\t while i != nil\n\t\t if i.value == value\n\t\t @valor = i.value\n\t\t end\n\t\t i = i.next\n\t\t end\n end\n @valor\n end",
"def insertar_elemento(nodo)\n \n @nodo = Nodo_.new(nil, nodo, nil)\n \n if @tail == nil\n @head = @nodo\n @tail = @nodo\n #@nodo\n else\n @nodo.next = @head\n @head.prev = @nodo\n @head = @nodo\n #@nodo\n end\n \n end",
"def insert(data) \n set data, 1\n end",
"def insert(data) \n set data, 1\n end",
"def insert_last(value)\n \n end",
"def insertarHead(value)\n nodo = Node.new(value)\n if @head == nil and @tail == nil\n @head = nodo\n @tail = nodo\n else\n @head.next = nodo\n nodo.prev = @head\n @head = nodo\n end\n @size+=1\n end",
"def insert token, tipo, variable = true\n\n\t\tif variable \n\t\t\tif @tabla.has_key? (token.texto)\n\t\t\t\traise RedefinirError.new(token, self.find(token.texto)[:token], variable)\n\t\t\telse\n\t\t\t\t@tabla[token.texto] = {:token => token, :tipo => tipo, :valor => nil}\n\t\t\tend\n\t\telse\n\t\t\tif @tabla.has_key? (token.idFuncion.nombre.texto)\n\t\t\t\traise RedefinirError.new(token.idFuncion.nombre, self.find(token.idFuncion.nombre.texto)[:instancia].idFuncion.nombre, variable)\t\n\t\t\telse\n\t\t\t\t@tabla[token.idFuncion.nombre.texto] = {:instancia => token, :tipo => tipo}\n\t\t\tend\n\t\tend\t\n\tend",
"def insert(val, index)\n node = LinkedListNode.new(val)\n prev_ele = self.nth_element(index - 1)\n next_ele = prev_ele.next\n node.next = next_ele\n prev_ele.next = node\n end",
"def insert(elem)\n @vector.push(elem)\n end",
"def insert(elem)\n @vector.push(elem)\n \n end",
"def insert_at(value, index)\n current = @head\n (index - 1).times do\n current = current.next_node\n end\n\n current.next_node = Node.new(value, current.next_node)\n \n end",
"def push(value)\n insert(value)\n self\n end",
"def add value\n if @head.nil?\n @length = 1\n @head = GenericList::Node.new(value)\n else\n lst = @head\n ptr = @head.nxt\n while ptr && @proc.call(value, lst.value) <= 0\n lst = ptr\n ptr = ptr.nxt\n end\n @length += 1\n lst.insert value\n end\n end",
"def insert(value)\n node = @current\n @current = LinkNode.call(value, node, :after, self, &@match_value)\n self.head = @current if self.head.nil?\n self.tail = @current if self.tail.equal?(node)\n self.size += 1\n end",
"def insert(etiqueta)\n nodo = Node.new(etiqueta, nil, nil)\n\n if self.empty\n nodo.next=nodo\n nodo.prev=nodo\n @head=nodo\n @tail=nodo\n\n else\n nodo.prev = @tail\n nodo.next = nil\n @tail.next = nodo\n @tail = nodo\n end\n end",
"def create\n @lista_valor = ListaValor.new(params[:lista_valor])\n\n respond_to do |format|\n if @lista_valor.save\n format.html { redirect_to @lista_valor, notice: 'El valor de la variable fue creado satisfactoriamente.' }\n format.json { render json: @lista_valor, status: :created, location: @lista_valor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lista_valor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def insert(key)\n end",
"def add(value)\n if value.kind_of? Array\n value.each { |v| add(v) }\n else\n value = PublicEarth::Db::Base.as_id(value)\n value = value.id if value.is_a? Atlas::Place\n value.strip! if value.kind_of? String\n @values << value unless @values.include? value\n end\n self\n end",
"def insert(value)\n if @Max <= 15\n if @actual.nil?\n @actual = value\n @fin = value\n else\n value.next = @actual\n @actual.prev = value\n value.prev = nil\n @actual = value\n end\n @Max+= 1\n end\n end",
"def addTelefone(contato)\n\tputs(\"\\n\\nDigite o novo numero:\")\n\ttel = Telefone.new\n\ttel.numero = Validacao.validaTelefone(gets.chomp)\n\ttel.id_contato = contato.id\n\tcontato.telefones.push(tel)\n\tContatoDAO.new.addTelefone(tel)\nend",
"def insert_takoble\n\t\tsql = \"insert into TAKO_List values (?, ?)\"\n\t\treturn sql\n\tend",
"def insert_at(value, index)\n if index == 0\n prepend(value)\n elsif index >= self.size\n append(value)\n else\n prev = nil\n cur = head\n i = 0\n until i == index\n prev = cur\n cur = cur.next_node\n i += 1\n end\n prev.next_node = Node.new(value, cur)\n end\n end",
"def insert_head (value) # Insertar desde la cabeza\n\t nodo=Node.new(value,nil,nil)\n nodo.nest = @head\n @head = nodo # el head ahora apunta a este nodo\n if (@tail == nil)\n @tail = nodo\n end\n nodo.prev = nil\n if (nodo.nest != nil)\n nodo.nest.prev = nodo\n end\n end",
"def insert(value)\n new_node = Node.new(value)\n @head.prev = new_node if @head\n new_node.next = @head\n @tail = new_node unless @tail\n @head = new_node\n @count += 1\n end",
"def <<(p)\n raise TypeError, \"Esperada pregunta para inserción\" unless p.is_a? (Pregunta)\n if (@total == 0)\n @cabeza = Nodo.new(p, nil, nil)\n @cola = @cabeza\n else\n @cola.next = Nodo.new(p, nil, @cola)\n @cola = @cola.next\n @cola.value\n end\n @total += 1\n end",
"def insert_at(position = acts_as_list_top)\n insert_at_position(position)\n end",
"def set_lista_valor\n @lista_valor = ListaValor.find(params[:id])\n end",
"def insert( list_name, owner, author, text, full_message, submitted )\n # TODO Checking friendship existance requires oauth\n # if owner != author and not base.friendship_exists?(owner, author)\n # puts(owner + \" does not follow \" + author + \". Not adding list.\")\n # else\n # puts (owner + \" \" + author + \" are friends, adding to list.\")\n # end\n \n @list = List.find( :first, \n :conditions => { :name => list_name,\n :owner => owner } )\n \n if not @list\n \n #Don't allow creating a list for someone else.\n if owner != author\n puts (owner + \" \" + author + \" \" + list_name + \" doesn't exist, not creating.\")\n return false\n end\n \n @list = List.new({ \"owner\" => owner,\n \"name\" => list_name,\n \"permission\" => \"public\" } )\n @list.save #TODO error handling here like in list create method\n end\n \n #Created a list but no more items\n if text == \"\"\n return false\n end\n \n #Check if the item exists, since we assume the messages\n #come in chronological order, we can just break when\n #we find something.\n @item = Item.find( :first,\n :conditions => { :author => author,\n :text => text,\n :submitted => submitted } ) \n #Clean up this search by using the submit time and the list name or ID TODO\n #TODO really need to check submit time to make sure it's the same message\n if @item\n puts(\"Already saw this element before\")\n return true\n end\n \n @item = @list.items.build( { :author => author,\n :text => text,\n :fullMessage => full_message,\n :submitted => submitted } )\n @item.save #TODO error handling\n print \"item saved\"\n \n return false\n end",
"def agregar_compra(producto, unidades = 1)\n DB.execute(\"insert into compras values ( ?, ?)\", producto, unidades)\nend",
"def insert(arel, name = nil, pk = nil, id_value = nil, sequence_name = nil, binds = [])\n sql, binds = sql_for_insert(to_sql(arel, binds), pk, id_value, sequence_name, binds)\n value = exec_insert(sql, name, binds)\n id_value\n end",
"def insert(*values)\n raise NotImplementedError, NOTIMPL_MSG\n end",
"def insert_at(v, list, n)\n list.dup.insert(n, v)\nend",
"def insert_tail (value) # Insertar desde la cola ( este es el que usaremos para practica 7)\n\tnodo=Node.new(value,nil,nil)\n nodo.prev = @tail\n @tail = nodo\n if (@head == nil)\n @head = nodo\n end\n nodo.nest = nil\n if (nodo.prev != nil)\n nodo.prev.nest = nodo\n end\n end",
"def insertarTail(value)\n nodo = Node.new(value)\n if @head == nil and @tail == nil\n @head = nodo\n @tail = nodo\n else\n @tail.prev = nodo\n nodo.next = @tail\n @tail = nodo\n end\n @size+=1\n end",
"def insert_after value\n node = Node.new value, @nxt, self\n @nxt.prv = node if @nxt\n @nxt = node\n end",
"def add(final_list, item, quan)\r\n p final_list[item] = quan\r\nend",
"def using_insert(array,element)\n array.insert(4,element)\n end",
"def add_to_list(list)\n\n end",
"def add_to_list(list)\n\n end",
"def add_to_list(list)\n\n end",
"def insertar_elemento(nodo)\n \n if @elemento != nil\n \n nodo.next = @elemento\n @elemento = nodo\n end\n end",
"def insert_tail(value)\n if @head.nil?\n @head = Nodo.new(value, nil, nil)\n @tail = @head\n else\n @tail[:next] = Nodo.new(value, nil, @tail)\n @tail = @tail[:next]\n end\n end",
"def using_insert(array, item)\n array.insert(4, item)\nend",
"def using_insert(array, element)\n \n array.insert(4, element)\n \nend",
"def insert(value)\n if @tail\n @tail.next = Node.new(value, @tail)\n @tail = @tail.next\n else\n @head = Node.new(value)\n @tail = @head\n end\n @length += 1\n return @tail\n end",
"def insert_at(index, value)\n node = Node.new\n node.value = value\n counter = 0\n current_node = @head\n until counter == index\n previous_node = current_node\n current_node = current_node.next_node\n counter += 1\n end\n previous_node.next_node = node\n node.next_node = current_node\n end",
"def add(val)\n get_node(val) #every new element that has to be added should point to a new node correponding to it.\n list_size = @elements.size\n last_element_index = list_size - 1\n @elements[last_element_index].next_node = list_size\n new_element_index = list_size\n @elements[new_element_index] = @node\n end",
"def insert(symbol, identifier,value)\n\t\tif !@symbols.has_key?(identifier)\n\t\t\t@symbols[identifier] = [symbol,value]\n\t\t\treturn false\n\t\telse\n\t\t\tputs \"Identificador: #{identifier}, declarado dos veces en un mismo alcance:\"\n\t\t\treturn true\n\t\tend\n\tend",
"def using_insert(array, element)\n array.insert(4, element)\n end",
"def add_at_index(index, val)\n return if index > @list.size \n @list.insert(index, val)\n end",
"def insert_front(value)\n \n end",
"def insert(name, tag, value)\n set_text_content(name, tag, @klass, value)\n end",
"def add(value)\n @values << value\n end",
"def insert(x)\n @info.push(x)\n self\n end",
"def insert(x)\n @info.push(x)\n self\n end",
"def insert(x)\n @info.push(x)\n self\n end",
"def insert(index,element)\n return nil if index < 0 || index > @size\n if element.new?\n pair = [element,element.class]\n else\n pair = [element.rod_id,element.class]\n end\n @map.keys.sort.reverse.each do |key|\n if key >= index\n value = @map.delete(key)\n @map[key+1] = value\n end\n end\n @map[index] = @added.size\n @added << pair\n #@commands << [:insert,pair]\n @size += 1\n self\n end",
"def insert(**opts)\n add(**opts)\n save!\n end",
"def insert(value)\n node = @current\n @current = LinkNode.call(value, node, :circle_after, self, &@match_value)\n if self.size == 0 # only\n self.head = @current\n self.tail = @current\n elsif self.tail == node\n self.tail = @current\n @current.next = self.head\n self.head.prev = @current\n end\n self.size += 1\n end",
"def insert(item)\n @info << item\n changed\n notify_observers(self, :insert, item)\n self\n end",
"def insert_at(value, index, current_index = 0, node = @head)\n return 'Not a valid index' if index > size || index.negative?\n return append(value) if index == size\n return prepend(value) if index.zero?\n\n if current_index + 1 == index\n new_node = Node.new(value)\n new_node.next_node = node.next_node\n node.next_node = new_node\n return\n end\n insert_at(value, index, current_index + 1, node.next_node)\n end",
"def insert_at(value, index)\n prev = self.at(index - 1)\n next_node = prev.next_node\n prev.next_node = Node.new(value, next_node)\n end",
"def inserta\n\t\tnum_pago = 1\n\t\tmonto = divide_pagos()\n\t\tfecha_pago = suma_dias()\n\t\tpago_total = calcula_pago_total()\n\n\t\t\tpagos = Payment.new(num_pago: num_pago, monto: pago_total, fecha_pago: fecha_pago, registro: \"\", client_id: self.id)\n\t\t pagos.save!\n\n\tend",
"def set_listadeprecio\n @listadeprecio = current_user.empresa.listadeprecios.find(params[:id])\n end",
"def insert_head(value)\n if @head.nil?\n @head = Nodo.new(value, nil, nil)\n @tail = @head\n else\n @head[:prev] = Nodo.new(value, @head, nil)\n @head = @head[:prev]\n end\n end",
"def add_to_database\n CONNECTION.execute(\"INSERT INTO users (name) VALUES ('#{self.name}');\")\n @id = CONNECTION.last_insert_row_id\n end",
"def linsert(key, where, pivot, value)\n send_command([:linsert, key, where, pivot, value])\n end",
"def push value\n self.set( self.get_length + 1 , value)\n end",
"def insert_after(value)\n node = LinkedListNode(value)\n\n node.next = self.next if self.next\n self.next = node\n\n node\n end",
"def insert(value)\n\t\tcurrent_node = @head \n\t\tif current_node.value >= value \n\t\t\t@head = Node.new(value, current_node)\n\t\tend \n\t\tuntil current_node.next_node.value =< value \n\t\t\tbreak if current_node.next_node == nil \n\t\t\tcurrent_node = current_node.next_node\n\t\tend \n\t\tcurrent_node.next_node = Node.new(value, current_node.next_node)\n\tend",
"def insert(sql, name = nil, pk = nil, id_value = nil) end",
"def using_insert(array, element)\n array.insert(4,element)\nend",
"def insert_id!(arr, insertable)\n arr << insertable\n insertable\nend",
"def using_insert(array, element)\n array.insert(4, element)\nend"
] |
[
"0.6882546",
"0.647175",
"0.6304506",
"0.6233017",
"0.6184128",
"0.61449575",
"0.6086783",
"0.60759825",
"0.6065893",
"0.603101",
"0.59160805",
"0.5886279",
"0.5756945",
"0.57322973",
"0.5661064",
"0.56537473",
"0.5653499",
"0.56130576",
"0.559679",
"0.55945355",
"0.55945355",
"0.5576041",
"0.55547154",
"0.55371654",
"0.5511291",
"0.5478635",
"0.5459717",
"0.54426384",
"0.54205006",
"0.5419325",
"0.5419325",
"0.5413454",
"0.5397064",
"0.53777415",
"0.5373838",
"0.5373329",
"0.53538287",
"0.5352919",
"0.53460145",
"0.53350025",
"0.53332645",
"0.5330576",
"0.53154534",
"0.53128797",
"0.5312684",
"0.53003514",
"0.5295598",
"0.52882403",
"0.5279474",
"0.5275636",
"0.5263283",
"0.52618617",
"0.52544206",
"0.5251994",
"0.52495575",
"0.5235618",
"0.5232778",
"0.52310836",
"0.52015007",
"0.5200263",
"0.51943505",
"0.5193455",
"0.51902187",
"0.51845217",
"0.5184195",
"0.5184195",
"0.5184195",
"0.51713943",
"0.51704466",
"0.516869",
"0.51679534",
"0.5166306",
"0.5164347",
"0.5162697",
"0.51581925",
"0.5153132",
"0.51377183",
"0.51329905",
"0.51324284",
"0.5129922",
"0.5126704",
"0.5126704",
"0.5126704",
"0.5121554",
"0.5108711",
"0.510854",
"0.5106308",
"0.5105928",
"0.5104319",
"0.50998247",
"0.5099533",
"0.5086177",
"0.5085365",
"0.5082881",
"0.5081867",
"0.5070963",
"0.50655353",
"0.5058807",
"0.505865",
"0.5054908",
"0.5051222"
] |
0.0
|
-1
|
Inserta un valor al final de la lista.
|
def push_tail(value)
if value.class == Nodo
added_node = value
else
added_node = Node.new(value)
end
added_node.next = nil
added_node.prev = @tail
@tail.next = added_node unless @tail.nil?
@tail = added_node
@head = added_node if @head.nil?
@sz = @sz + 1
return nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def insert_last(value)\n \n end",
"def insertar_lista_final(referencia)\n if @final != nil\n @final = Nodo.new(referencia, nil, @final)\n n = @final.anterior\n n.siguiente = @final\n else\n @principio = Nodo.new(referencia, nil, nil)\n @final = @principio\n end\n end",
"def insert(value) \n self.head.nil? ? insert_empty_list(value) : insert_on_end(value)\n\n print \"=> Result insertion: \"\n print_simple_list(self.last)\n end",
"def insert_final(*val)\n \n val.each do |nuevo_nodo|\n \n if @tail != nil\n @tail.next = nuevo_nodo\n nuevo_nodo.previous = @tail\n @tail = nuevo_nodo\n else\n @head = @tail = nuevo_nodo\n end\n @num_nodos += 1\n end\n end",
"def insertarTail(value)\n nodo = Node.new(value)\n if @head == nil and @tail == nil\n @head = nodo\n @tail = nodo\n else\n @tail.prev = nodo\n nodo.next = @tail\n @tail = nodo\n end\n @size+=1\n end",
"def push_last(value)\n @driver_instance.push_list_last(@key, value)\n end",
"def insertar(texto,timestamp,usuario,fotousuario)\n\t\n\t\tlistaobjeto=[texto,timestamp,usuario,fotousuario]\n\t\t@Lista+=[listaobjeto]\n\tend",
"def add_at_tail(val)\n @list << val\n end",
"def insert_tail(value)\n if @head.nil?\n @head = Nodo.new(value, nil, nil)\n @tail = @head\n else\n @tail[:next] = Nodo.new(value, nil, @tail)\n @tail = @tail[:next]\n end\n end",
"def insert_tail(value)\n\n\t\tif empty()\n\t\t\t@head = Node.new(value,nil,nil)\n\t\t\t@tail = @head\n\t\telse\n\t\t\t@tail.next = Node.new(value,nil,@tail)\n\t\t\t@tail = @tail.next;\n\t\tend\n\n\t\t@size = @size + 1\n\t\t\t\n\tend",
"def insert_end(value)\n\n\t\tif (@head == nil)\n\n\t\t\t@head = @Node.new(value,nil,nil)\n\t\t\t@tail = @head\n\n\t\telse\n\n\t\t\t@tail[:next] = @Node.new(value,nil,@tail)\n\t\t\t@tail = @tail[:next]\n\n\t\tend\n\n\tend",
"def insert_by_end(value)\n\t\tif @head.nil?\n\t\t\t@head = @Node.new(value, nil, nil)\n\t\t\t@tail = @head\n\t\telse\n\t\t\t@tail[:next] = @Node.new(value, nil, @tail)\n\t\t\t@tail = @tail[:next]\n\t\tend\n end",
"def insert(value)\n node = @current\n @current = LinkNode.call(value, node, :after, self, &@match_value)\n self.head = @current if self.head.nil?\n self.tail = @current if self.tail.equal?(node)\n self.size += 1\n end",
"def insert_tail (value) # Insertar desde la cola ( este es el que usaremos para practica 7)\n\tnodo=Node.new(value,nil,nil)\n nodo.prev = @tail\n @tail = nodo\n if (@head == nil)\n @head = nodo\n end\n nodo.nest = nil\n if (nodo.prev != nil)\n nodo.prev.nest = nodo\n end\n end",
"def insert(value)\n #YOUR WORK HERE\n end",
"def insert(value)\n # YOUR WORK HERE\n end",
"def add_last(value)\r\n \r\n # if list is empty, insert the new value at the head\r\n if @head.nil?\r\n @head = Node.new(value, nil)\r\n return @head\r\n end \r\n \r\n # otherwise, traverse the list from start to last node ...\r\n current = @head\r\n until current.next.nil?\r\n current = current.next\r\n end\r\n \r\n # ... and insert new node after last node\r\n current.next = Node.new(value, nil)\r\n \r\n end",
"def insert_after value\n node = Node.new value, @nxt, self\n @nxt.prv = node if @nxt\n @nxt = node\n end",
"def insert(value)\n if @Max <= 15\n if @actual.nil?\n @actual = value\n @fin = value\n else\n value.next = @actual\n @actual.prev = value\n value.prev = nil\n @actual = value\n end\n @Max+= 1\n end\n end",
"def insertar(value)\n insert(Node.new(value, nil, nil))\n end",
"def insert_after(value)\n node = LinkedListNode(value)\n\n node.next = self.next if self.next\n self.next = node\n\n node\n end",
"def insert_tail(val)\r\n aux = Node.new(val,nil,@tail)\r\n @tail.next = aux\r\n @tail = aux\r\n end",
"def insert(v)\n \n end",
"def insert(clave, valor)\r\n @grafo[clave] = valor\r\n end",
"def insert_tail(value)\n\t\tif(empty?)\n\t\t\t@head = Node.new(value,nil,nil)\n\t\t\t@tail = @head\n\t\telse\n\t\t\t@tail[:next] = Node.new(value,nil,@tail)\n\t\t\t@tail = @tail[:next]\n\t\tend\t\t\t\n\tend",
"def insert(value)\n node = @current\n @current = LinkNode.call(value, node, :circle_after, self, &@match_value)\n if self.size == 0 # only\n self.head = @current\n self.tail = @current\n elsif self.tail == node\n self.tail = @current\n @current.next = self.head\n self.head.prev = @current\n end\n self.size += 1\n end",
"def insert(loc, data)\n insert_array = data.split.reverse\n insert_array.each do |item|\n if list.allowed(item)\n @list.insert(loc, item)\n else\n 0\n end\n end\n end",
"def add_last(value)\r\n new_node = Node.new(value)\r\n if !@head\r\n @head = new_node\r\n else\r\n cursor = @head\r\n while cursor.next\r\n cursor = cursor.next\r\n end\r\n cursor.next = new_node\r\n end\r\n end",
"def insert_after(value)\n node = Node(value)\n @next = node\n node\n end",
"def insert(value, index)\n end",
"def insert(value)\n if @tail\n @tail.next = Node.new(value, @tail)\n @tail = @tail.next\n else\n @head = Node.new(value)\n @tail = @head\n end\n @length += 1\n return @tail\n end",
"def insertar_por_cola(value)\n\t\tnodo=Node.new(value,nil,nil)\n if(@tail==nil)\n @tail=nodo\n @head=nodo\n else\n nodo.prev=@tail\n @tail.nest=nodo\n @tail=nodo\n\t\t\tnodo.nest=nil\n end\n\n\tend",
"def insert_tail(nodo)\n if (nodo.instance_of? Nodo) == false\n nodo = Nodo.new(nodo,nil,nil)\n end\n raise \"Error la lista debe contener nodos\" unless ( nodo.instance_of? Nodo )\n @tail.next = nodo\n nodo.prev = @tail\n nodo.next = nil\n @nodos = @nodos +1\n @tail = nodo\n end",
"def insertar_por_cabeza(value)\n\t\tnodo=Node.new(value,nil,nil)\n\t\tif(@head==nil)\n\t\t\t@tail=nodo\n\t\t\t@head=nodo\n\t\telse\n\t\t\tnodo.nest=@head\n\t\t\t@head.prev=nodo\n\t\t\t@head=nodo\n\t\t\tnodo.prev=nil\n\t\tend\n\n\tend",
"def add_last(value)\n raise NotImplementedError, \"Please implement add_last\"\n end",
"def insert(value)\n store.push value\n swim(length)\n self\n end",
"def insert(index, value)\n if index == @size\n append(value)\n else\n assert_in_range(index)\n \n current, previous = get_node(index)\n inserted = LinkedListNode.new(:successor => current, :value => value)\n previous.successor = inserted if previous\n \n @head = inserted if current == @head \n @size += 1\n end\n end",
"def insert(val)\n return false if @h[val]\n @a.push(val)\n @h[val] = @a.size - 1\n return true\n end",
"def insert_tail(val)\n return insert_head(val) unless @head\n\n node = Node.new(val, @tail, nil)\n @tail.next = node\n @tail = node\n @size += 1\n end",
"def insert(value, after_node)\n # when insert is called with the tail node\n # then it's the same as append method\n if tail == after_node\n append(value)\n return\n end\n\n # otherwise, you just need to link up\n # the new node with the rest of the list\n after_node.next_node = Node.new(value, after_node.next_node)\n after_node.next_node\n end",
"def append(val)\n if(@entries != @length)\n @position += 1\n @entries += 1\n @store[@position] = val\n end \n end",
"def insert_at(value, index)\n length = size - 1\n if @head.nil?\n set_head(value)\n elsif index > length\n puts \"the list does not have a value associated with your given index.\"\n else\n old_node = at_no_data(index)\n old_next_node = at_no_data(index + 1)\n prev_node = at_no_data(index - 1)\n prev_node.next_node.data = value\n prev_node.next_node = old_node\n end\nend",
"def insertarHead(value)\n nodo = Node.new(value)\n if @head == nil and @tail == nil\n @head = nodo\n @tail = nodo\n else\n @head.next = nodo\n nodo.prev = @head\n @head = nodo\n end\n @size+=1\n end",
"def push value\n self.set( self.get_length + 1 , value)\n end",
"def after(val, ignore_subsections = true) insertion(val, 1, ignore_subsections) end",
"def insert_last(value)\n if @queue.size < @size\n @queue.push(value)\n true\n else\n false\n end\n end",
"def add_at_tail(val)\n last = Node.new(val)\n current = @head\n if @length == 0 then\n @head = last\n @length += 1\n else\n while !current.next.nil?\n current = current.next\n end\n current.next = last\n @length += 1\n end\n end",
"def insert_after(pivot, item)\n conn.linsert key, :after, pivot, item\n end",
"def add(val)\n get_node(val) #every new element that has to be added should point to a new node correponding to it.\n list_size = @elements.size\n last_element_index = list_size - 1\n @elements[last_element_index].next_node = list_size\n new_element_index = list_size\n @elements[new_element_index] = @node\n end",
"def insert_after(value)\n node = DoublyLinkedListNode(value)\n\n # Need to implement this\n\n node\n end",
"def append( value )\n last.next = Node.new value\n end",
"def insert_tail(node_value)\n # Create a var to hold the current_node; init with head\n current_node = @head\n\n # If the SLL is empty, the head and tail are the same thing, set head to new node\n if empty?\n @head = Node.new(node_value)\n else\n # Otherwise, while there's another node after the current, i.e., while current is not tail\n while current_node.next\n # Get the current's next and set as the new current\n current_node = current_node.next\n end\n\n # The previous loop has ended, meaning current now points to tail\n # Set the current's next to the new node\n current_node.next = Node.new(node_value)\n # Move the pointer to the next node which was just inserted so that it can be returned\n current_node = current_node.next\n end\n\n # Increment size by 1, regardless of SLL size\n @size += 1\n # Return the current, which now points to tail\n current_node\n end",
"def insertTail(value)\n \n n = Node.new(value)\n \n if @head.nil?\n \n @tail = n\n @head = @tail\n \n else\n \n @tail.next = n\n n.prev = @tail\n @tail = n\n \n end\n \n end",
"def insert(data) \n set data, 1\n end",
"def insert(data) \n set data, 1\n end",
"def add value\n if @head.nil?\n @length = 1\n @head = GenericList::Node.new(value)\n else\n lst = @head\n ptr = @head.nxt\n while ptr && @proc.call(value, lst.value) <= 0\n lst = ptr\n ptr = ptr.nxt\n end\n @length += 1\n lst.insert value\n end\n end",
"def add_last(value)\n new_node = DoublyLinkedNode.new(value, @tail, nil)\n if @tail\n @tail.next = new_node\n new_node.prev = @tail\n @tail = new_node\n else\n @head = new_node\n @tail = new_node\n end\n end",
"def insert(value)\n #get hashed value\n hash_value = hash_function(value)\n # insert value\n @@collection[hash_value] = value\n\n # return confirmation\n \"value: \" << value << \" inserted at position: \" << hash_value.to_s\n end",
"def add_last(value)\n new_node = Node.new(value)\n\n if !@head\n @head = new_node\n return\n end\n\n current = @head\n while current.next\n current = current.next\n end\n current.next = new_node\n return\n end",
"def get_value(value)\n if @head == nil #Comprobamos si la lista no esta vacía\n raise RuntimeError, \"Lista vacía, no se puede extraer nodo\"\n else\n\t\t i = @tail\n\t\t @valor=nil\n\t\t while i != nil\n\t\t if i.value == value\n\t\t @valor = i.value\n\t\t end\n\t\t i = i.next\n\t\t end\n end\n @valor\n end",
"def insertar_elemento(nodo)\n \n @nodo = Nodo_.new(nil, nodo, nil)\n \n if @tail == nil\n @head = @nodo\n @tail = @nodo\n #@nodo\n else\n @nodo.next = @head\n @head.prev = @nodo\n @head = @nodo\n #@nodo\n end\n \n end",
"def insert_last(element)\n if @first_node == nil\n insert_first(element)\n else\n old_last_node = find_last_node\n old_last_node.insert_after(element)\n @size += 1\n end\n end",
"def append(value)\n # if the list is empty, you need to update head and tail. \n # you can do via push, because in the case append == push\n if isEmpty?\n push(value)\n return\n end\n\n # if the list is not empty, you need to create a new Node\n # after the tail\n @tail.next_node = Node.new(value)\n # since it's a tail-end insertion, the new node is also\n # the tail of the list\n @tail = @tail.next_node\n end",
"def insert(value)\n index = find(value)\n if index == -1\n @inner << value\n index = @inner.length - 1\n end\n return index\n end",
"def insert(item)\n\n\n\n\n end",
"def insertion(val, rel, recursive = T.unsafe(nil), list = T.unsafe(nil)); end",
"def add_last(value)\r\n return @head = Node.new(value) unless @head\r\n \r\n last = @head\r\n last = last.next while last.next\r\n last.next = Node.new(value)\r\n end",
"def add_at_tail(val)\n \n end",
"def append(value)\n #needs .last method\n #self.last\n last.next = Node.new(value)\n end",
"def push(value)\n insert(value)\n self\n end",
"def add element\n add_last(element)\n end",
"def add element\n add_last(element)\n end",
"def add_to_list(item)\n\t# Datenstruktur : voc.id \n\t\tlist = get_list \n\t\tlist.push(item)\n\t\tnew_list = list.join(\" \")\n\t\tcookies[:\"eList\"] = { :value => new_list } \n\tend",
"def insert value\r\n current_head = @head\r\n #create a new node with:\r\n #\"value\" that come from LIST-INSERT argument\r\n #\"next\" that point to the node that is currently at the head\r\n #\"prev\" that is NULL since it will be spliced onto the front of the list\r\n new_node = Node.new value, current_head, nil\r\n #if the list is not empty (L.head != NULL)(there exist at least one node in the list)\r\n if current_head != nil\r\n #point the old head node prev pointer to the new node\r\n current_head.set_prev_node new_node\r\n #OPTIONAL: if the list is empty, set tail to the the first node\r\n else\r\n @tail = new_node\r\n end\r\n #point L.head to the new node\r\n @head = new_node\r\n #You can return a pointer to the new node so you can access it quickly (e.g. for reading, updating or deleting)\r\n return new_node\r\n #You can return the list so that you can chain methods\r\n return self\r\n end",
"def add_to_list\n\n # Keep a copy of position to set after the change detail is saved, \n # because the entry will be put at the end of the list.\n position = self.position\n self.save\n\n if self.errors.empty?\n change_details = self.change_item.change_details.find(:all)\n position = 1 if !position\n change_details.last.insert_at(position)\n end\n end",
"def insert_after( node, value )\n # Find the specified node, and add a new node\n # with the given value between that found node\n # and the next\n node = find node\n node_after = node.next\n node_inserted = Node.new value\n node.next = node_inserted\n node_inserted.next = node_after\n node_inserted\n end",
"def insert_front(value)\n \n end",
"def insert(node)\n @tail.next = node\n @tail = @tail.next\n end",
"def inserir_item(item)\n # Insere um item no inicio do buffer\n BUFFER.unshift item\n end",
"def add(final_list, item, quan)\r\n p final_list[item] = quan\r\nend",
"def insert(etiqueta)\n nodo = Node.new(etiqueta, nil, nil)\n\n if self.empty\n nodo.next=nodo\n nodo.prev=nodo\n @head=nodo\n @tail=nodo\n\n else\n nodo.prev = @tail\n nodo.next = nil\n @tail.next = nodo\n @tail = nodo\n end\n end",
"def append(value)\n\t\tself.tail.next_node = Node.new(value, nil)\n\tend",
"def entrada(valor)\n update_attribute(:quantidade, quantidade+valor)\n end",
"def add_at_tail(val)\n if @llist\n node = @llist\n while node.next_node\n node = list.next_node\n end\n node.add_next_node Node.new(val)\n else\n add_at_head(val)\n end\n end",
"def add_last(value)\n if @head.nil?\n return @head = DoubleNode.new(value)\n end\n\n current = @head\n\n until current.next.nil?\n current = current.next\n end\n\n new_node = DoubleNode.new(value, current, nil)\n current.next = new_node \n end",
"def insert(val, index)\n node = LinkedListNode.new(val)\n prev_ele = self.nth_element(index - 1)\n next_ele = prev_ele.next\n node.next = next_ele\n prev_ele.next = node\n end",
"def insert(val)\n return false if @number_index_map.key?(val)\n @number_list << val\n @number_index_map[val] = @number_list.length - 1\n true\n end",
"def insert(value) # works according to VisualAlgo\n @values.push(value)\n index = @values.length - 1\n while index > 0 do\n parent_index = ((index-1)/2).to_i\n break if @values[parent_index] > @values[index]\n @values[index] = @values[parent_index]\n @values[parent_index] = value\n index = parent_index\n end\n return self\n end",
"def insertar_lista_principio(referencia)\n if @principio != nil && @principio.siguiente != nil\n n = @principio\n @principio = Nodo.new(referencia, n, nil)\n n.anterior = @principio\n elsif @principio != nil\n n = @principio\n @principio = Nodo.new(referencia, n, nil)\n n.anterior = @principio\n @final = n\n else\n @principio = Nodo.new(referencia, nil, nil)\n @final = @principio\n end\n end",
"def append(value)\n if @size == 0\n @head = @tail = LinkedListNode.new(:value => value)\n else\n old_tail = @tail\n @tail = LinkedListNode.new(:value => value)\n old_tail.successor = @tail\n end\n @size += 1\n end",
"def add_last(value)\r\n newNode = Node.new(value)\r\n \r\n if @head.nil? \r\n @head = newNode\r\n return\r\n end\r\n\r\n prev = nil\r\n curr = @head \r\n\r\n while curr\r\n if curr.next \r\n prev = curr\r\n curr = curr.next\r\n else\r\n curr.next = newNode\r\n return\r\n end\r\n end\r\n \r\n end",
"def append( value )\n\n # Find the last node in this list\n # i.e. keep looking at the next node\n # until the next node is 'nil'\n node = @head\n while node.next\n node = node.next\n # kind of like incrementing the loop counter\n end\n\n # puts \"End of loop:\"\n # p node\n\n node.next = Node.new value\n end",
"def insert_takoble\n\t\tsql = \"insert into TAKO_List values (?, ?)\"\n\t\treturn sql\n\tend",
"def add_at_index(index, val)\n return if index > @list.size \n @list.insert(index, val)\n end",
"def insert(value)\n\t\tcurrent_node = @head \n\t\tif current_node.value >= value \n\t\t\t@head = Node.new(value, current_node)\n\t\tend \n\t\tuntil current_node.next_node.value =< value \n\t\t\tbreak if current_node.next_node == nil \n\t\t\tcurrent_node = current_node.next_node\n\t\tend \n\t\tcurrent_node.next_node = Node.new(value, current_node.next_node)\n\tend",
"def move_to_bottom\n return unless in_list?\n insert_at_position bottom_position_in_list.to_i\n end",
"def add_value_beyond_tail(value,index)\n\t\tprevious_node = tail\t\t\n\t\t(index-size).times do\n\t\t\tcurrent_node = add_node(value: nil,previous_node: previous_node, next_node: nil)\n\t\t\tprevious_node.next_node = current_node\n\t\t\tprevious_node = current_node\n\t\t\tincrease_size\n\t\tend\n\t\tself.tail = add_node(\tvalue: value,\n\t\t\t\t\t\t\t\tprevious_node: previous_node, \n\t\t\t\t\t\t\t\tnext_node: nil)\n\t\tprevious_node.next_node = tail\n\t\tincrease_size\t\t\n\t\tupdate_cursor(node: tail,index: index)\n\tend",
"def insert(value)\n new_node = Node.new(value)\n @head.prev = new_node if @head\n new_node.next = @head\n @tail = new_node unless @tail\n @head = new_node\n @count += 1\n end",
"def insert_head (value) # Insertar desde la cabeza\n\t nodo=Node.new(value,nil,nil)\n nodo.nest = @head\n @head = nodo # el head ahora apunta a este nodo\n if (@tail == nil)\n @tail = nodo\n end\n nodo.prev = nil\n if (nodo.nest != nil)\n nodo.nest.prev = nodo\n end\n end",
"def insertar_elemento(nodo)\n \n if @elemento != nil\n \n nodo.next = @elemento\n @elemento = nodo\n end\n end"
] |
[
"0.6595191",
"0.6525332",
"0.65043175",
"0.6497196",
"0.60536987",
"0.5965677",
"0.59122384",
"0.5894111",
"0.5880826",
"0.5820758",
"0.5809455",
"0.578125",
"0.5775184",
"0.5722138",
"0.57116556",
"0.5693691",
"0.56821203",
"0.5681494",
"0.56771696",
"0.5665815",
"0.5651628",
"0.5587494",
"0.5554936",
"0.55347264",
"0.5532851",
"0.55284834",
"0.5513814",
"0.54918104",
"0.54705703",
"0.5462334",
"0.5459928",
"0.54560894",
"0.540968",
"0.53932774",
"0.5367422",
"0.5336852",
"0.5333549",
"0.53330547",
"0.5329898",
"0.5321775",
"0.5312142",
"0.5300104",
"0.52965206",
"0.52892303",
"0.52882093",
"0.5280882",
"0.527898",
"0.5278504",
"0.5277126",
"0.5259945",
"0.52545846",
"0.5253554",
"0.5251395",
"0.5241515",
"0.5241515",
"0.5234712",
"0.52336913",
"0.5230587",
"0.5212702",
"0.52035743",
"0.5199026",
"0.5186761",
"0.518378",
"0.5180131",
"0.5178731",
"0.5176367",
"0.51758766",
"0.51727855",
"0.51334584",
"0.5132579",
"0.5129782",
"0.5129782",
"0.51247036",
"0.51151514",
"0.5110801",
"0.51051235",
"0.51031065",
"0.5102593",
"0.5099822",
"0.5093829",
"0.50875413",
"0.50874645",
"0.5079542",
"0.50737774",
"0.50584865",
"0.50581664",
"0.5041606",
"0.50415176",
"0.503901",
"0.5038495",
"0.50366217",
"0.50360495",
"0.5020368",
"0.50070786",
"0.5003109",
"0.5002675",
"0.4981071",
"0.4969795",
"0.49687457",
"0.49686906"
] |
0.522523
|
58
|
Elimina un elemento al principio de la lista.
|
def pop_head
if(@head == nil)
return nil
else
val= @head
node = @head.next
@head = node
if @head != nil
@head.prev = nil
else
@tail = nil
end
@sz = @sz -1
end
return val
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete elemento\n borrar = []\n borrar << elemento\n @@Ordenadores = @@Ordenadores - borrar\n end",
"def remove_element(name)\n @element_list.delete_if{|e|\n e.name == name\n }\n end",
"def delete_element(element); end",
"def delete element\n self.delete_at index_of(element) \n end",
"def delete element\n self.delete_at index_of(element) \n end",
"def delete(element); end",
"def list_remover(list,item) #takes 2 arguments, 1 list and name of an item\n\tlist.delete(item)\t\n\t\nend",
"def eliminar_elem_arr(arreglo, index)\n arreglo[index] = nil\n arreglo.delete(nil)\n arreglo\nend",
"def remove_item(olist, item)\n olist.delete(item) \n olist\nend",
"def remove (list, item)\n\tlist.delete(item)\nend",
"def remove(list,item)\r\n\tlist.delete(item)\r\n\tlist\r\nend",
"def remove(list, item)\r\n list.delete(item)\r\n list\r\nend",
"def list_remover(list_input_remover, item_name_remove)\n list_input_remover.delete(item_name_remove)\nend",
"def remove_item(list,item)\r\n\r\n list.delete(item)\r\n list\r\nend",
"def remove_item (list, item)\n list.delete(item)\nend",
"def remove(list, item)\n\tlist.delete(item)\n\tlist\nend",
"def remove(list, item)\n\tlist.delete(item)\nend",
"def remove_item(list, item)\n\tlist.delete(item)\n\tlist\nend",
"def remove_item(list, item)\r\n list.delete(item)\r\n list\r\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list,item)\n\tlist.delete(item)\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove(final_list, item)\r\n final_list.delete(item)\r\n end",
"def remove_item (item,list)\nlist.delete(item)\nlist\nend",
"def remove(input_list, item)\n input_list.delete(item)\nend",
"def remove_item(list, item)\n\tlist.delete(item)\nend",
"def delete_item(list_item)\n @list.delete(list_item)\n @list\n end",
"def remove_item(list, item)\n list.delete(item)\nend",
"def remove_item(list, item)\n list.delete(item)\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list,item)\n\tlist.delete(item)\n\tp list\nend",
"def remove_item(item, list)\n\tlist.delete_if do |i|\n\t\ti == item \n\tend\nend",
"def remove_item(list, item)\n list.delete(item)\n return list\nend",
"def remove_item(list, item_name)\r\n list.delete(item_name)\r\n list\r\nend",
"def remove_item(list, name)\n list.delete(normalize_string(name))\n return list\nend",
"def remove_item(list, item)\r\n\tlist.delete(item)\r\n\treturn list\r\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend",
"def eliminar_ult_elem_arr(arreglo)\n arreglo.pop\n arreglo\nend",
"def remove_from_list(list, item)\n list.delete(item)\n p list\nend",
"def remove_item(list, item)\n list.delete(item)\nend",
"def remove_item(list, item)\n list.delete(item)\nend",
"def remove_entry(p)\n\t\t@person.delete(p)\n\tend",
"def remove_item (list, item)\n list.delete(item)\nend",
"def remove_item(list, item)\n list.delete(item)\n return list\nend",
"def remove_item(list,item)\n list.delete(item)\n p list\nend",
"def remove_item(list_name,item_to_remove)\n #find all array elements in given list with the given item name and delete them\n list_name.delete_if { |x| x[:item_name] == item_to_remove}\n end",
"def remove(list, item_name)\n\tlist.delete(item_name)\nend",
"def remove_item(list, item_name)\n list.delete(item_name)\n list\nend",
"def remove_item(name, list)\n list.delete(name)\n p list\n return list\nend",
"def remove_item(list, item)\n list.delete(item)\n p list\nend",
"def remove_item(list_item,user_list)\n user_list.delete(list_item)\n user_list\nend",
"def remove_item(list, item)\n list.delete(item)\n p list\nend",
"def remove_item(list, item)\n list.delete(item)\n p list\nend",
"def remove_from_list(list, item)\n\tlist.delete(item)\nend",
"def delete_item(list, item)\n\tlist.delete(item)\n\tlist\nend",
"def remove_item(item, list)\n list.delete(item)\nend",
"def remove_item!(list, item)\r\n list.delete(item)\r\n list\r\nend",
"def remove_item (item, list)\n list.delete(item)\n return list\nend",
"def remove_item(list, item_removed)\n list.delete(item_removed)\nend",
"def remove_item(item, list)\n list.delete(item)\n return list\nend",
"def del_item(list, item_to_del)\n list.delete(item_to_del)\nend",
"def remove_item(list, item)\r\n list.delete(item)\r\n p list\r\nend",
"def remove_item(list, item_name)\r\n # list.delete_if { |item, amount| item == item_name }\r\n list.delete(item_name)\r\nend",
"def remove_item(list, item_remove)\n list.delete(item_remove)\nend",
"def remove_item_from_list(list,item)\r\n list.delete(item)\r\n print_list(list)\r\nend",
"def remove_item(item, list)\n\t# steps: delete the item if it exists\n\tlist.delete_if {|list_item| list_item == item.to_sym}\n\t# output: updated list\n\tlist\nend",
"def remove_item(list, item_name)\n list.delete(item_name)\nend",
"def remove_item(item)\n index = @list.index(item)\n remove_item_at(index)\n end",
"def remove(list, food_item)\n\tlist.delete(food_item)\n\tlist\nend",
"def eliminar_pri_elem_arr(arreglo)\n arreglo[0] = nil\n arreglo.delete(nil)\n arreglo\nend",
"def remove_from_list(item,list)\n list.delete(item)\nend",
"def remove_item(item, list)\r\n list.delete(item)\r\n p list\r\n list\r\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tp list\nend",
"def remove(list, item_name)\r\n\tlist.delete(item_name)\r\n\tp list\r\nend",
"def remove list\n list_action list, \"remove\"\n end",
"def delete_item(list,item)\n\tlist.delete(item)\nend",
"def remove_item(item,first_list)\n\n first_list.delete(item)\n\nend",
"def delete_item(list, item)\n\tlist.delete(item)\n\treturn list\nend",
"def delete(item, list)\n\tlist.delete(item)\nend",
"def delete_item(item)\r\n @list.delete(item)\r\n end",
"def remove_item(list, key_name)\r\n\tlist.delete(key_name)\r\n\treturn list\r\nend",
"def remove\n return @exact.shift unless @exact.empty?\n @list.shift\n end",
"def remove_item(item_list, item)\r\n item_list.delete(item)\r\n item_list\r\nend",
"def remove_an_item(code_item_to_delete)\n to_do_list.delete_at(code_item_to_delete)\n end",
"def remove_an_item(list, item)\n #method to remove item\n list.delete(item)\nend",
"def remove_item(new_list, item)\n \n new_list.delete(item)\n \n new_list\nend",
"def delete_item(list,item)\n list.delete(item)\n return list\nend",
"def delete_item(list, item)\n\tdel_list = list.delete(item)\nend",
"def remove_item(item)\n # raises WrongListException if item.list != self\n # TODO\n end",
"def delete_item(list,item)\n list.delete(item)\n list\nend",
"def delete_item(list,item)\n list.delete(item)\n list\nend",
"def delete_item(unwanted)\r\n @arr.delete(unwanted)\r\n end",
"def eliminar(identificador)\n\t\t@tabla.delete(identificador)\n\t\t@tamanio.delete(identificador)\n\tend",
"def remove(el)\n raise NotImplementedError\n end",
"def delete(o); removeObject o end"
] |
[
"0.72610664",
"0.69059485",
"0.6837261",
"0.6740732",
"0.6740732",
"0.6642234",
"0.6482326",
"0.64353716",
"0.6434944",
"0.64272183",
"0.64153594",
"0.6406409",
"0.6401825",
"0.639435",
"0.6384169",
"0.63716197",
"0.63714886",
"0.6367462",
"0.63538873",
"0.6352113",
"0.63476145",
"0.6338487",
"0.6338487",
"0.6334992",
"0.63230777",
"0.63211924",
"0.630815",
"0.62981176",
"0.62759084",
"0.6270977",
"0.6270252",
"0.6270252",
"0.6270252",
"0.6270252",
"0.6256873",
"0.6250991",
"0.62504184",
"0.6248118",
"0.62328756",
"0.62288815",
"0.6226895",
"0.6226895",
"0.6226895",
"0.6224508",
"0.6223818",
"0.6213614",
"0.6213614",
"0.6206437",
"0.6202922",
"0.6196806",
"0.6195154",
"0.61898524",
"0.61881274",
"0.6187096",
"0.61832595",
"0.6180262",
"0.6179211",
"0.6178635",
"0.6178635",
"0.6177935",
"0.61732143",
"0.6168316",
"0.6167684",
"0.6166555",
"0.6150987",
"0.6138253",
"0.61376125",
"0.61369276",
"0.6122973",
"0.61194634",
"0.6119114",
"0.6108673",
"0.61084193",
"0.61082155",
"0.61063254",
"0.60955864",
"0.6093766",
"0.6093021",
"0.60897475",
"0.6083061",
"0.6078811",
"0.6077939",
"0.60674524",
"0.60599846",
"0.6043898",
"0.60438573",
"0.603766",
"0.6036602",
"0.60201573",
"0.6013289",
"0.60094625",
"0.5998826",
"0.5993092",
"0.5982594",
"0.597988",
"0.59792674",
"0.59792674",
"0.5971062",
"0.59635574",
"0.59551847",
"0.5954781"
] |
0.0
|
-1
|
Elimina un elemento del final de la lista.
|
def pop_tail
if(@tail == nil)
return nil
else
val= @tail
node = @tail.prev
@tail = node
if @tail != nil
@tail.next = nil
else
@head = nil
end
@sz = @sz -1
end
return val
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def remove_last_child\n @elements.pop\n end",
"def remove_last\n raise 'No such element' if @size == 0\n elt = @tail.value\n if @size == 1\n @head = nil\n @tail = nil\n else\n @tail = @tail.previous\n @tail.next.previous = nil\n @tail.next = nil\n end\n @size -= 1\n return elt\n end",
"def remove(final_list, item)\r\n final_list.delete(item)\r\n end",
"def delete elemento\n borrar = []\n borrar << elemento\n @@Ordenadores = @@Ordenadores - borrar\n end",
"def remove_last\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the tail node\n # Move the tail to the previous node\n data = @tail.data\n @tail = @tail.prev_node\n @size -= 1\n\n # removes the same element from @head, if it was final element/node\n if empty?\n @head = nil\n else\n # send to garbage collector\n @tail.next_node = nil\n end\n\n return data\n end",
"def remove_at_tail\n\t\t\treturn nil if self.empty?\n\t\t\telement = self.head\n\t\t\tprevious_element = @head\n\n\t\t\tuntil element.next.nil?\n\t\t\t\tprevious_element = element\n\t\t\t\telement = element.next\n\t\t\tend\n\n\t\t\tprevious_element.next = nil\n\t\t\telement\n\t\tend",
"def removeEnd\n @indices.delete(@content[-1])\n @content.pop\n end",
"def remove\n return @exact.shift unless @exact.empty?\n @list.shift\n end",
"def remove_last\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the tail node\n # Move the tail to the previous node\n data = @tail.data\n \n if size < 2\n return remove_first\n else\n each_cons(2) do |node, next_node|\n if next_node.next_node == nil\n @tail = node\n @tail.next_node = nil\n break\n end\n end\n end\n\n @size -= 1\n\n return data\n end",
"def del_final\n @tail = @tail.node_ant\n if @tail != nil\n @tail.edi_sig(nil)\n else\n @head = @tail\n end\n end",
"def delete_last()\n \n end",
"def remover_item\n # Remove um item do final do buffer\n BUFFER.pop\n end",
"def remove_last\n return nil if empty?\n node = @sentinel.prev\n e = node.data\n node.prev.next = @sentinel\n @sentinel.prev = node.prev\n e\n end",
"def remove_last\n return nil if empty?\n node = @sentinel.prev\n e = node.data\n node.prev.next = @sentinel\n @sentinel.prev = node.prev\n e\n end",
"def eliminar_ult_elem_arr(arreglo)\n arreglo.pop\n arreglo\nend",
"def deq\n\t\tremove(0)\n\tend",
"def delete_element(element); end",
"def remove_tail\n if self.head == nil # does nothing to an empty list\n return nil\n end\n \n delete (self.tail) # otherwise, deletes the tail\n end",
"def remove_at_head\n\t\t\treturn nil if self.empty?\n\t\t\telement = self.head\n\t\t\t@head.next = nil || element.next\n\t\t\telement\n\t\tend",
"def remove_from_list\n return unless in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end",
"def remove_last_component()\n remove_component_at(index: @child_components.size - 1)\n end",
"def pop\r\n removed_item = @data\r\n @data = @data.next_node\r\n removed_item.next_node = nil\r\n removed_item\r\n end",
"def delete element\n self.delete_at index_of(element) \n end",
"def delete element\n self.delete_at index_of(element) \n end",
"def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_list_position(nil)\n end\n end",
"def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end\n end",
"def pop\n raise 'No such element' if @elements.length == 0\n @elements.slice!(-1)\n end",
"def pop() #delete last element in the LL\n return nil if @head == nil #if list is empty return nil\n return @head = nil if self.list_size == 1 #list has 1 element(head) assign head to nil\n temp_node = @head #if list has more then 1 element, travres till last element\n #stop conditon is when second element from current link to nil, means that first\n #from current is last element in the list\n until temp_node.link.link == nil \n temp_node = temp_node.link\n end\n temp_node.link = nil #cat the link with last element by assigning previous link to nil\n end",
"def remove_max(list, last_pos)\n removed = list[0]\n list[0] = list[last_pos] \n list[last_pos] = removed\n heap_down(0, last_pos - 1, list)\nend",
"def pop\n delete_at(0)\n end",
"def delete(element); end",
"def eliminar_elem_arr(arreglo, index)\n arreglo[index] = nil\n arreglo.delete(nil)\n arreglo\nend",
"def delete_tail\r\n delete_node @tail\r\n end",
"def remove_tail\n if @current == @tail\n @head = nil\n @tail = nil\n else\n search_until(@tail)\n @tail = @current\n end\n end",
"def delete_at(index)\t\n\t\tif index==1\n\t\t\t@first = tmp.front\n\t\t\t@first.back = nil\n\t\telsif @length==index\n\t\t\tpop;\n\t\telse\n\t\t\ttmp = get(index)\n\t\t\ttmp.back.front = tmp.front \n\t\t\ttmp.front.back = tmp.back\n\t\tend\n\t\t@length-=1\n\tend",
"def remove_at(position)\n\t\t\t\tif @head != nil\n\t\t\t\t\tif position == 0\n\t\t\t\t\t\t_remove_head()\n\t\t\t\t\telsif position == @length -1\n\t\t\t\t\t\tpop()\n\t\t\t\t\telsif position < @length\n\t\t\t\t\t\t_remove_in_list(@head, position)\n\t\t\t\t\t\t@length -= 1\n\t\t\t\t\telse\n\t\t\t\t\t\traise RuntimeError.new(\"position out of range\")\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\traise RuntimeError.new(\"Cannot remove elements from empty list.\")\n\t\t\t\tend\n\t\t\tend",
"def remove_by_index(index)\n @items.delete_at(index-1)\n end",
"def end_arr_delete(arr)\n # delete the element from the end of the array and return the deleted element\n arr.pop\nend",
"def remove_element_from_end_of_array(array)\n array.pop\nend",
"def remove_element_from_end_of_array(array)\n array.pop\nend",
"def remove_from_end(arr)\n arr.pop\nend",
"def pop\n list.pop\n end",
"def remove_at(index)\n if index == 0\n @head = cur.next_node\n elsif index >= self.size\n pop\n else\n prev = nil\n cur = head\n i = 0\n until i == index\n prev = cur\n cur = cur.next_node\n i += 1\n end\n prev.next_node = cur.next_node\n end\n end",
"def remove!(child)\n @last_items_count -= +1 if child && child.last\n super\n end",
"def remove_at(index)\n if index < 0 || index >= @size\n return nil\n end\n\n if index == @size - 1\n return pop\n else\n search_index = @head\n next_to_last = nil\n index.times {|i|\n if i == index - 1\n next_to_last = search_index\n end\n search_index = search_index.next_node\n }\n next_to_last.next_node = search_index.next_node\n end\n @size -= 1\n end",
"def end_arr_delete(arr)\n # delete the element from the end of the array and return the deleted element\n return arr.pop\nend",
"def remove_last()\n\t\ttemp = @kb.pop\n\t\treturn !temp.nil?\n\tend",
"def pop\n return nil if @head.nil?\n\n to_remove = @head\n @head = @head.next\n to_remove.next = nil\n @count -= 1\n\n to_remove.value\n end",
"def remove_retrieve_last\n # @array.pop\n @array.slice!(0)\n end",
"def remove(item)\n # TODO\n # - removes first occurence of `item` in list.\n # - uses '==', so beware if expecting eql? or equals? logic instead\n # - shifts element in array to fill in spot\n\n (0...@array.size).each do |i|\n if @array[i] == item\n @array[i] = nil\n\n # TODO\n # - consider resizing array if load is under some threshold (maybe 0.25?)\n\n shift_elements\n break\n end\n end\n\n end",
"def removed(node)\n\t\t\t@size -= 1\n\t\t\treturn node\n\t\tend",
"def delete_at(index)\n return nil if index >= @size || index < 0\n element = self[index]\n if direct_index = @map[index]\n @added.delete_at(direct_index)\n @map.delete(index)\n @map.keys.sort.each do |key|\n if key > index\n value = @map.delete(key)\n value -= 1 if value > direct_index\n @map[key-1] = value\n else\n if (value = @map[key]) > direct_index\n @map[key] -= 1\n end\n end\n end\n else\n lazy_index = lazy_index(index)\n position = @deleted.bsearch_upper_boundary{|e| e <=> lazy_index }\n @deleted.insert(position,lazy_index)\n @map.keys.sort.each do |key|\n if key > index\n @map[key-1] = @map.delete(key)\n end\n end\n end\n #@commands << [:delete,[index]]\n @size -= 1\n element\n end",
"def eliminar_pri_elem_arr(arreglo)\n arreglo[0] = nil\n arreglo.delete(nil)\n arreglo\nend",
"def remove(index)\n assert_in_range index\n \n current, previous = get_node(index)\n previous.successor = current.successor if previous\n \n @head = current.successor if current == @head\n @tail = previous if current == @tail\n \n @size -= 1\n end",
"def pop_tail\n \n extraido = false\n \n if @head == nil #Comprobamos si la lista no esta vacía\n\t\t\traise RuntimeError, \"Lista vacía, no se puede extraer nodo\"\n\t\telse\n\t\t extraido = true\n\t\t\tif @head == @tail\n\t\t\t\t@head = nil\n\t\t\t\t@tail = nil\n\t\t\telse\n\t\t\t\t@tail = @tail.next\n\t\t\t\t@tail.prev = nil\n\t\t\tend\n end\n return extraido\n end",
"def remove(index)\n @size -= 1\n if index == 0\n @first_item = @first_item.next_list_item\n else\n previous_item = get_item( index -1)\n next_list_item = previous_item.next_list_item.next_list_item\n previous_item.next_list_item = next_list_item\n #get_item( index - 1).next_list_item = nil\n # return @first_item = @first_item.next_list_item if index == 0\n # item = @first_item\n # (index - 1).times do\n # item = item.next_list_item\n # # puts \"(((((((()))))))))))))((((((((((((((@item))))))))))))))\"\n # # puts @first_item.payload\n # # puts\"((((((((((((((item.next_list_Item)))))))))))))\"\n # # puts item.payload\n # end\n # raise IndexError if item.nil?\n # item.next_list_item = item.next_list_item.next_list_item\n end\nend",
"def delete_after\r\n result = @buffer.delete_at(@cursor)\r\n @buffer.compact! #needed?\r\n result\r\n end",
"def delete(value)\n index = find(value)\n return false if index == -1\n @inner[index] = @inner[@inner.length - 1]\n @inner.delete_at(@inner.length - 1)\n return true\n end",
"def remove_from_list\n # if in_list?\n # decrement_positions_on_lower_items\n # update_attribute position_column, nil\n # end \n return unless in_list?\n decrement_positions_on_lower_items\n update_attribute position_column, nil \n end",
"def pop\n\t\t\t\tif @length == 0\n\t\t\t\t\traise RuntimeError.new(\"Cannot pop from empty list.\")\n\t\t\t\telse\n\t\t\t\t\tif @tail.prev == nil\n\t\t\t\t\t\t# there is only one element\n\t\t\t\t\t\t@head = nil\n\t\t\t\t\t\t@tail = nil\n\t\t\t\t\telse\n\t\t\t\t\t\t@tail.prev.next = nil\n\t\t\t\t\t\t@tail = @tail.prev\n\t\t\t\t\tend\n\t\t\t\t\t@length -= 1\n\t\t\t\tend\n\t\t\tend",
"def remove_last_word\n @last_word_index = @words.keys.sort.last\n @words.delete(@last_word_index)\n end",
"def remove_item_at(index)\n @list.slice!(index)\n end",
"def remove_item(electives)\n electives.pop #removes last item\n puts electives\nend",
"def remove_first\n raise 'No such element' if @size == 0\n elt = @head.value\n if @size == 1\n @head = nil\n @tail = nil\n else\n @head = @head.next\n @head.previous.next = nil\n @head.previous = nil\n end\n @size -= 1\n return elt\n end",
"def remove_at(i)\n \t if @size==0 || i<0 || i>=@size\n \t \treturn nil\n \t end\n \t if i==0 && @size==1\n \t \t@root=nil\n \t \t@tail=nil \n \t elsif i==0\n @root=@root.next_node\n else\n \tpre_node=at(i-1)\n \ti_node= pre_node.next_node\n \tpre_node.next_node=i_node.next_node\n if i==@size-1#if last element was removed, update tails\n @tail=pre_node\n end\n end\n @size-=1\n\n end",
"def pop\n item = @first.val\n @first = @first.next\n @last = nil if(@first == nil)\n @size -= 1\n item\n end",
"def remove_tail\n remove_node(@tail)\n end",
"def pop\n return if list == nil\n\n lastElem = nil\n if list.nextNode == nil\n lastElem = list\n @list = nil\n else\n node = @list\n while (node != nil)\n if (node.nextNode != nil && node.nextNode.nextNode == nil)\n lastElem = node.nextNode\n node.nextNode = nil\n break\n end\n node = node.nextNode\n end\n end\n lastElem\n end",
"def pop\n @data.delete_at @data.length - 1 if @data.length > 0\n end",
"def delete_at(index)\n return if (index + 1) > count || index < 0\n\n if index.zero?\n deleted = @head\n @head = @head.next\n else\n prev_item = @head\n\n (index - 1).times { prev_item = prev_item.next }\n\n deleted = prev_item.next\n prev_item.next = deleted.next\n @tail = prev_item if prev_item.next.nil?\n end\n\n @count -= 1\n deleted.value\n end",
"def remove_element_from_end_of_array(array)\n return array.pop\nend",
"def remove(index)\n\t\tdir = index > @length/2? -1: 1\n\t\tcurr = go(dir: dir, index: index)\n\t\tif !curr.nil?\n\t\t\tcurr.previous.next = curr.next if !curr.previous.nil?\n\t\t\tcurr.next.previous = curr.previous if !curr.next.nil?\n\t\t\t@tail = curr.previous if curr == @tail\n\t\t\t@head = curr.next if curr == @head\n\t\t\tcurr.previous, curr.next = nil, nil\n\t\t\t@length -= 1\n\t\tend\n\t\tcurr.info if !curr.nil?\n\tend",
"def remove_first\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the head node\n # Move the head to the next node\n data = @head.data\n @head = @head.next_node\n @size -= 1\n\n # removes the same element from @tail, if it was final element/node\n if empty?\n @tail = nil\n else\n # send to garbage collector\n @head.prev_node = nil\n end\n\n return data\n end",
"def del_min\n min_elt = @head.value\n @size -= 1\n if not @head.left\n @head = nil\n return min_elt\n end\n merge_pairs(@head.left)\n return min_elt\n end",
"def remove(list,item)\r\n\tlist.delete(item)\r\n\tlist\r\nend",
"def remove_item(list, item)\n\tlist.delete(item)\n\tlist\nend",
"def extract_tail\n raise \"Error la lista no puede estar vacia\" unless (@nodos > 1)\n penultimo = @tail.prev\n penultimo.next = nil\n @nodos = @nodos-1\n oldtail = @tail\n @tail = penultimo\n oldtail\n end",
"def purge\n @items.delete_if(&:is_done) \n end",
"def remove_element(nums, val)\n n = nums.length\n pointer = 0\n\n while pointer < n\n if nums[pointer] == val\n nums[pointer] = nums[n - 1]\n n -= 1\n else\n pointer += 1\n end\n end\n\n pointer\nend",
"def remove\n @nxt.prv = @prv if @nxt\n @prv.nxt = @nxt if @prv\n end",
"def remove_element(name)\n @element_list.delete_if{|e|\n e.name == name\n }\n end",
"def delete(elem)\n deleted = @elements.delete(elem)\n build_heap unless deleted.nil?\n deleted\n end",
"def pop\n return nil if @count == 0\n\n # get the index of the las titem\n @store.store.reverse.each_with_index do |ele, i|\n if ele != nil \n @last_ele = capacity() - (i+1) \n break\n end\n end\n #val = @store.store.delete_at(@last_ele)\n val = @store.store[@last_ele]\n @store.store[@last_ele] = nil\n @count -= 1\n return val\n end",
"def remove(list, item)\n\tlist.delete(item)\n\tlist\nend",
"def remove()\n removed = @store[0].value\n swap(0, @store.length - 1)\n @store.pop\n heap_down(0)\n return removed\n end",
"def eldest\n @eldest\n end",
"def remove(value)\n\t\t\telement = self.head\n\t\t\tprevious_element = @head\n\t\t\twhile element.value != value\n\t\t\t\tif element.next.nil?\n\t\t\t\t\treturn nil\n\t\t\t\telse\n\t\t\t\t\tprevious_element = element\n\t\t\t\t\telement = element.next\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tprevious_element.next = element.next\n\t\t\telement\n\t\tend",
"def delete_at_index(index)\n if @llist\n if index == 0\n @llist = @llist.next_node\n else\n node = get(index)\n prev_node = get(index-1)\n prev_node.add_next_node node.next_node\n end\n else\n# todo: handle unknown index\n end\n end",
"def delete(val)\n count = self.lrem(0, val)\n if count > 0\n val\n else\n nil\n end\n end",
"def clear_for_new_position\n end_of_list = fund_grant.fund_items.maximum( :position )\n unless end_of_list && end_of_list < position\n fund_grant.fund_items.where { |i| i.id != id }.\n where { |i| i.position >= position }.update_all(\n 'fund_items.position = fund_items.position + 1' )\n end\n true\n end",
"def delete_item(index)\n LIST.delete_at(index)\nend",
"def delete_last()\n if @queue.size > 0\n @queue.pop\n return true\n end\n false\n end",
"def remove_item(list, item_removed)\n list.delete(item_removed)\nend",
"def remove\n @instantiations.dup.each(&:remove)\n @instantiations[0..-1] = []\n true\n end",
"def pop\n return nil if size.zero?\n\n temp = first\n self.last = nil if first == last\n self.first = first.next\n self.size -= 1\n temp.val\n end",
"def remove()\n return if @store.empty?\n if @store.size == 1\n return @store.pop\n end\n # swap the first and the last element in the underlying array\n @store[-1], @store[0] = @store[0], @store[-1]\n removed = @store.pop\n heap_down(0)\n return removed.value\n end",
"def remove_item(item, list)\n\tlist.delete_if do |i|\n\t\ti == item \n\tend\nend",
"def delete_at(idx)\n idx = Maglev::Type.coerce_to(idx, Fixnum, :to_int)\n sz = self.__size\n if idx < 0\n idx = sz + idx\n if idx < 0\n return nil\n end\n end\n if idx >= sz\n return nil\n end\n elem = self.__at(idx)\n oidx = idx + 1\n self.__remove_from_to_(oidx, oidx)\n return elem\n end",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove(entry); end",
"def remove(x)\n if include?(x)\n ind = @indices[x]\n ind2 = @content.size - 1\n swap(ind,ind2) # do this to ensure constant time\n removeEnd\n end\n end"
] |
[
"0.67286783",
"0.6566167",
"0.6516636",
"0.6512531",
"0.6476442",
"0.6436082",
"0.64167106",
"0.6372489",
"0.62897867",
"0.6251727",
"0.62279505",
"0.6204038",
"0.61898106",
"0.61898106",
"0.61263144",
"0.6085789",
"0.6070083",
"0.60444593",
"0.60370696",
"0.6025497",
"0.59845537",
"0.59792817",
"0.59544873",
"0.59544873",
"0.59272426",
"0.59256136",
"0.5918226",
"0.5905657",
"0.5900391",
"0.58830374",
"0.5851228",
"0.58248436",
"0.5809742",
"0.58024395",
"0.5777364",
"0.57610214",
"0.5715478",
"0.57085824",
"0.56960475",
"0.56960475",
"0.5692575",
"0.56849784",
"0.567977",
"0.56680554",
"0.56650907",
"0.56586814",
"0.5646624",
"0.5625197",
"0.5622885",
"0.56206113",
"0.5615282",
"0.56132877",
"0.5592329",
"0.5575794",
"0.5575384",
"0.5573729",
"0.5570989",
"0.55663425",
"0.55636156",
"0.55543286",
"0.55412346",
"0.5541177",
"0.5540227",
"0.55255866",
"0.5524693",
"0.5523773",
"0.5522117",
"0.5521197",
"0.551694",
"0.5513217",
"0.55058616",
"0.5475649",
"0.5474397",
"0.5472029",
"0.54707927",
"0.54704225",
"0.5457661",
"0.5457265",
"0.5446612",
"0.54372513",
"0.54346114",
"0.5429889",
"0.5427565",
"0.54260457",
"0.54242265",
"0.5422325",
"0.54223084",
"0.54207635",
"0.54196787",
"0.5417392",
"0.5399824",
"0.5399637",
"0.53992194",
"0.53966725",
"0.53958076",
"0.53861123",
"0.53812534",
"0.5380362",
"0.5378252",
"0.5369021",
"0.5368702"
] |
0.0
|
-1
|
Muestra la salida formateada de los elementos de la lista
|
def to_s
s = ""
each {|i| s += "#{i.nombre_alimento.to_s}\n"}
s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def clasificar_por_sal (lista)\n \n sal_recomendada = Lista.new()\n sal_excesiva = Lista.new()\n \n nodo = lista.extract\n \n while !(nodo.nil?)\n \n if nodo.value.sal > 6\n sal_excesiva.insert(nodo.value.sal)\n else\n sal_recomendada.insert(nodo.value.sal)\n end\n nodo = lista.extract\n end\n \n \"Los productos con una cantidad de sal menor o igual a la recomendada son #{sal_recomendada.to_s} y los que tienen una sal excesiva son #{sal_excesiva.to_s}\"\n \nend",
"def to_s\n recorrido = lista_alimentos.head\n cantidad = lista_cantidades.head\n formateo = []\n\n while (recorrido != nil && cantidad != nil)\n salida = cantidad.value.to_s + \"gr de \" + recorrido.value.nombre\n formateo.push(salida)\n\n recorrido = recorrido.next\n cantidad = cantidad.next\n end\n\n formateo\n end",
"def to_s\n recorrido = lista_alimentos.head\n cantidad = lista_cantidades.head\n formateo = []\n\n while (recorrido != nil && cantidad != nil)\n salida = cantidad.value.to_s + \"gr de \" + recorrido.value.nombre\n formateo.push(salida)\n\n recorrido = recorrido.next\n cantidad = cantidad.next\n end\n\n formateo.push(@emisiones_diarias)\n formateo.push(@metros_terreno)\n\n formateo\n end",
"def saludoFor (valor, arreglo)\n cadena = \"-Hola For:\" + valor\n for elem in arreglo\n cadena = cadena + elem.to_s\n end\n return cadena\nend",
"def saludoEach (valor, arreglo)\n cadena = \"-Hola Each:\" + valor\n arreglo.each do |elem|\n cadena = cadena + elem.to_s\n end\n return cadena\nend",
"def salons\n FindSalon::Salon.all.map do |salon|\n salon.id.to_s + ' ' + salon.name + ' | ' + 'Rating: ' + salon.rating.to_s + ' | ' + 'Address: ' + salon.vicinity\n end\n end",
"def to_s\n salida = \"\\n #{@operacion} \\n\"\n \n case @operacion\n when \"suma\" then salida << \"\\n#{(@operador[0]+@operador[1]).to_s}\\n\"\n when \"producto\" then salida << \"\\n#{(@operador[0]*@operador[1]).to_s}\\n\" \n end \n \n salida \n end",
"def terreno\n grtotal = 0\n sum = 0\n\t\t#recorre las dos listas a la vez para sacar el terreno\n #usado de cada ingrediente segun el peso de este\n @lista.zip(@listagr).each do |normal, gr|\n cant = gr/1000.0\n sum += normal.terreno*cant\n end\n @terreno = sum\n\n end",
"def salvar\n i = 0\n if @data.present?\n @data.each do |detalle|\n @detalle = Detail.new(producto: detalle[\"nombre\"], cantidad: detalle[\"cantidad\"] , precio: detalle[\"costo\"], precioventa: detalle[\"precio\"], total: detalle[\"total\"] , descuento: detalle[\"descuento\"], descuentoproveedor: detalle[\"descuentodistribuidor\"], ventum_id: @ventum.id )\n @detalle.save\n i = i + 1\n end\n end\n if @tiempo_instalar.present?\n @detalle = Detail.new(producto: @activacion, cantidad: @tiempo_instalar , precio: @precioinstalar, precioventa: @precioinstalar, total: @costo_instalar, descuento:@descuentoinstalar , venta_id: @ventum.id )\n @detalle.save\n end\n end",
"def ValorRetirado(billetes_retiro,valor_solicitado , tipo_cuenta)\n \tsalida = []\n \tsum = 0\n billetes_retiro.each { |a| sum+=a }\n \n\t puts \"total de esta\"\n\t puts sum == valor_solicitado.to_i\n retiro = Atm.new\n retiro.fecha_retiro = Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")\n retiro.valor_retiro = sum\n retiro.save\n if sum == valor_solicitado.to_i\n \tsalida = sum # Si el valor es exacto lo retorna\n else\t\n #Buscamos la diferencia de la cantidad\t\n valor_sobra = sum - valor_solicitado.to_i\n puts valor_sobra\n #Buscamos si un solo billete esta dando la diferencia\n if billetes_retiro.include?(valor_sobra)\n nuevo_array = billetes_retiro.delete(20)\n nuevo_array.each { |a| sum+=a } #relizamos la suma de nuevo\n salida = [nuevo_array, sum] # retornamos array con nuevos valores\n \t else\n \t \tsalida = sum\n end \n end \t\n\n end",
"def devolver_sal \n\t\treturn @sal\n\tend",
"def students_grow (list)\nlist.transform_values! {|v| v * 1.05}\nputs list\nend",
"def sum_lists()\nend",
"def calculateOutput(entradas)\n guardarEntradas(entradas)\n y = []\n for i in 0..(@numNeuronas-1)\n sum = 0\n for k in 0..(@entradas.length-1)\n sum = sum + matrixWeights[i][k] * @entradas[k]\n end\n sum = sigmoide(sum+@umbral[i], 30)\n y << sum\n end\n @salidas = y\n end",
"def show\n @ventum.Costo=List.where( ventum_id: params[:id]).sum(:costo)\n @ventum.save\n @list = List.new\n end",
"def to_s\n components = {}\n for element in elements.select\n if components.key?(representative(element))\n if representative(element) != element\n components[representative(element)] << element\n end\n else\n if representative(element) != element\n components[representative(element)] = [element]\n else\n components[representative(element)] = []\n end\n end\n end\n result = \"\"\n for rep in components.keys\n result << components[rep].reduce(prepare_for_save(rep)){ |total, element| total + ',' + prepare_for_save(element) } + \";\"\n end\n return result.chomp(\";\")\n end",
"def to_s\n\t\ti=0\n\t\tcadena = \"\"\n\t\twhile i<@lista_alimentos.size do\n\t\t\tcadena += \"#{@lista_alimentos[i].nombre} -> #{@lista_cantidades[i]} \"\n\t\t\ti += 1\n\t\t\n\t\tend\n\t\n\t\treturn cadena\n\tend",
"def to_s\r\n alimento = \"\"\r\n alimento +=\"Plato : #{@nombre} \\n\"\r\n @lista_alimentos.each do |i|\r\n alimento +=i.to_string\r\n end\r\n return alimento\r\n end",
"def opcion4(inventario)\n sum = 0\n inventario.each do |llave,valor|\n sum += valor\n end\n \n puts \"El stock total de la tienda es: #{sum}\"\nend",
"def salvar_calculados\n self.cif_dolares = fob_dolares.to_f + seguro.to_f + flete_I.to_f + flete_II.to_f + otros_gastos.to_f\n self.cif_bolivianos = 7.07 * cif_dolares.to_f\n self.ga = cif_bolivianos * 0.10\n self.iva = (cif_bolivianos.to_f + ga.to_f) * 0.1494\n self.ice = (cif_bolivianos.to_f + ga.to_f) * 0.18\n self.total_impuestos = ga.to_f + iva.to_f + ice.to_f + diu.to_f\n # otros_1 = ibmetro\n # otros_2 = ibnorca\n self.total_servicios = almacenaje.to_f + senasac.to_f + camara_comercio.to_f + otros_1.to_f + otros_2.to_f + nuestros_servicios.to_f + gastos_tramite.to_f\n \n self.total_despacho = total_impuestos.to_f + total_servicios.to_f\n end",
"def save_to_list(list_id)\n elements=CartItem.where(:cart_id=>self.id)\n list=List.find(list_id)\n elements.each do |element|\n item=Item.find(element.item_id)\n list.list_items.build(:item_id=>item.id, :quantity=>element.quantity)\n end\n list.save\n end",
"def after_taxes\n printed_list = \"\"\n @total = 0\n @list.each do |item, quantity|\n item_total = quantity * item.price\n @total += item_total\n printed_list += \"#{quantity} #{item.name}: #{MONEY_FORMAT % item.price}\\n\"\n end\n return printed_list\n end",
"def to_s\n printed_list = \"\"\n @list.each do |item, quantity|\n printed_list += \"#{quantity} #{item}\\n\"\n end\n return printed_list\n end",
"def lista\n @kontrahenci = Kontrahenci.find(params[:id])\n @faktury = Faktury.where(:kontrahenci_id => @kontrahenci.id)\n if @faktury.nil? then\n @faktury = []\n end\n @obroty = Obroty.where(:kontrahenci_id => @kontrahenci.id).last(6)\n if @obroty.nil? then\n @obroty = []\n end\n @osoby = OsobaKont.where(:kontrahenci_id => @kontrahenci.id)\n if @osoby.nil? then\n @osoby = []\n end\n \n @inf_dodatka_kontr = InfDodatkaKontr.where(:kontrahenci_id => @kontrahenci.id)\n if @inf_dodatka_kontr.nil? then\n @inf_dodatka_kontr = []\n end\n \n @odmowa_mark = OdmowaMark.where(:kontrahenci_id => @kontrahenci.id)\n if @odmowa_mark.nil? then\n @odmowa_mark = []\n end\n \n ktory= @kontrahenci.id\n m1=1.month.ago.month\n y1=1.month.ago.year\n m2=2.month.ago.month\n y2=2.month.ago.year\n m3=3.month.ago.month\n y3=3.month.ago.year\n \n @saldo1= Obroty.where({ kontrahenci_id: ktory, rok: y1, miesiac: m1 }).take\n @saldo2= Obroty.where({ kontrahenci_id: ktory, rok: y2, miesiac: m2 }).take\n @saldo3= Obroty.where({ kontrahenci_id: ktory, rok: y3, miesiac: m3 }).take\n \n \n if @saldo1.nil?\n @suma1=0\n else \n @suma1=@saldo1['kwota'].to_f\n end\n if @saldo2.nil?\n @suma2=0\n else\n @suma2 = @saldo2['kwota'].to_f\n end\n if @saldo2.nil?\n @suma3=0\n else\n @suma3= @saldo3['kwota'].to_f\n end\n @suma= @suma1 + @suma2 + @suma3\n end",
"def total_subordinate_salary\n sum = 0\n @subordinates.each do |sub|\n sum += sub.salary \n end\n sum\n end",
"def index\n sql = \"select s.data, sum(s.valor) as valor from saldos s group by s.data order by s.data desc\"\n @saldos = ActiveRecord::Base.connection.execute(sql).to_a\n end",
"def get_sal\n @_100=((@sal*100)/@peso)\n @ir_100=(@_100/6)*100\n @porcion=((@sal*@gramos_porciones)/@peso)\n @ir_porcion=(@porcion/6)*100\n\t\t#p \"| #{@sal} | #{@_100} | #{@ir_100.round(1)}% | #{@porcion} | #{@ir_porcion.round(1)}% |\"\n [ @sal , @_100 , @ir_100.round(1) , @porcion , @ir_porcion.round(1) ]\n end",
"def salida_jugadores\n @jugadores.each do |jugador|\n jugador.casilla_actual = @tablero.casillas.at(0)\n end\n random = Random.new\n \n primero_en_salir = random.rand(@jugadores.size)\n \n @jugador_actual = @jugadores.at(primero_en_salir)\n\n \n @estado_juego = ModeloQytetet::EstadoJuego::JA_PREPARADO;\n end",
"def calculate_vector_of_user_exercises\n \n if self.user_sequence.empty? \n\n new_order = self.statistic.order_exercises.map do |key, value| \n [key, value[\"actual_position\"], false, false]\n end\n new_order.sort! { |a,b| a[1] <=> b[1]} # ordena pela actual_position\n self.user_sequence = new_order \n end\n save\n end",
"def aniade_taxones_seleccionados\n notice = if params[:especies].present?\n @listas.each do |lista|\n lista = Lista.find(lista)\n lista.cadena_especies.present? ? lista.cadena_especies+= ',' + params[:especies].join(',') :\n lista.cadena_especies = params[:especies].join(',')\n lista.save\n end\n 'Taxones incluidos correctamente.'\n else\n 'Debes seleccionar por lo menos una lista y un taxon para poder incluirlo.'\n end\n\n redirect_to :back, :notice => notice\n end",
"def verTodasVentasCarrito(ventas)\n \n totalVentas=0\n for i in(0..ventas.size-1)\n totalVentas+=ventas[i][3]\n print \"ID: #{ventas[i][0]} Cantidad: #{ventas[i][1]} Valor: #{ventas[i][2]}, Valor Total: #{ventas[i][3]} \\n\"\n end\n print \"Total de ventas: #{totalVentas} \\n\"\nend",
"def promedio(restaurant_menu)\n suma_total = 0\n restaurant_menu.each { |k,v| suma_total += v }\n suma_total / restaurant_menu.length.to_f\nend",
"def terrenos\r\n terreno = 0\r\n @lista_alimentos.each do |i|\r\n terreno += i.terreno\r\n end\r\n return terreno\r\n end",
"def update_quantity(list_item,quantity,user_list)\n user_list[list_item] = quantity\n user_list\nend",
"def totalSimplificado\n @biblioteca.livrosComoLista.map(&:preco).inject(0){|total, preco| total += preco}\n end",
"def vct\n grtotal = 0\n sum = 0\n\t\t#recorre las dos listas a la vez para sacar el valor\n\t\t#nutricional de cada ingrediente segun el peso de este\n @lista.zip(@listagr).each do |normal, gr|\n cant = gr/1000.0\n sum += normal.val_en*cant\n end\n sum\n end",
"def save_list_tb\n @saved_list_tb = @list\n end",
"def to_s\n\ts = \"\\nLista de Individuos y sus alimentos\\n\"\n for j in 0..@individuos.length-1\n s << @individuos[j].to_s + \"\\n\"\n end\n s\n end",
"def clasificar_por_imc (lista)\n \n imc_bajo = Lista.new()\n imc_normal = Lista.new()\n imc_excesivo = Lista.new()\n\n nodo = lista.extract\n \n while !(nodo.nil?)\n\n if nodo.value.datos_ant.indice_masa_corporal >= 30\n imc_excesivo.insert(nodo.value.datos_ant.indice_masa_corporal)\n elsif nodo.value.datos_ant.indice_masa_corporal >=18.5\n imc_normal.insert(nodo.value.datos_ant.indice_masa_corporal)\n else\n imc_bajo.insert(nodo.value.datos_ant.indice_masa_corporal)\n end\n nodo = lista.extract\n end\n\n \"Los IMC por debajo de lo normal son #{imc_bajo.to_s}, los IMC dentro de lo normal son #{imc_normal.to_s} y los que tienen un IMC excesivo son #{imc_excesivo.to_s}\"\n\nend",
"def update_quantity(item, new_quantity, list)\r\n list[item] = new_quantity\r\n p list\r\n list\r\nend",
"def salutation\n end",
"def calculo_de_sueldo(attr={})\r\n retencion = @salario * 0.1\r\n salud = @salario * 0.07\r\n pension = @salario * 0.12\r\n sueldo = @salario - retencion - salud - pension\r\n end",
"def to_s\r\n @list.map{|el| el.to_s}.join ' '\r\n end",
"def sum (tableau)\n chiffre = 0\n tableau.each do |element|\n chiffre = chiffre + element\n end\n return chiffre\nend",
"def to_s\n i = 0\n temp = \"\"\n for pk in @pl\n i += 1\n temp += i.to_s + \". \" + pk.nombre + \"\\n\"\n end\n temp\n end",
"def update_quantity(list,item,quantity)\nlist[item]= quantity\n p list\nend",
"def saldo\n\t\t@saldo = 0\n\t\tself.categories.each do |cat|\n\t\t\t@saldo += cat.valor_receita_efetivado\n\t\t\t@saldo -= cat.valor_despesa_efetivado\n\t\tend\n\t\t@saldo\n\tend",
"def update\n #@existingList = $todolist_collection.find({:_id => BSON::ObjectId(params['id']) } ).to_a[0]\n newtodolist = params['todolist']\n newtodolist['_id'] = BSON::ObjectId(params['id'])\n \n totalEstManHours = calcTotalEstimatedManHours newtodolist\n newtodolist['totalEstManHours'] = totalEstManHours\n \n $todolist_collection.save(newtodolist)\n \n #calculate total estimated hours\n\n \n\n redirect_to action: 'show', id: newtodolist['_id']\n \n end",
"def update_quantity(list, string, integer)\n\tlist[string]=integer\n\treturn list\nend",
"def update_quantity(list, string, integer)\n\tlist[string]=integer\n\treturn list\nend",
"def to_s\n #create an array to hold the values\n array_values = []\n #loop through array\n @store.each do |element|\n #check if it's not empty, then add element to the array that was created\n if !element.nil?\n array_values.append(element)\n end\n end\n #return the array and make sure to do to_s to ensure string in case it mutated somewhere\n return array_values.to_s\n end",
"def valor_energetico\n\t\ti = 0\n\t\tvalorC = 0.0\n\t\twhile i< @lista_alimentos.size do\n\t\t\tvalorC += @lista_alimentos[i].valorEnergetico\n\t\t\ti+=1\n\t\tend\n\t\treturn valorC\n\tend",
"def to_string\n list.to_string\n end",
"def suma_valores\n resultados = {}\n self.totales = {}\n self.totales_por_comprobante = {}\n\n # revisa todas las monedas\n EmpCuentab.monedas.each do |moneda, id_moneda|\n resultados[moneda] = {\n valor: 0.0,\n descuento: 0.0,\n desc_general: 0.0,\n subtotal: 0.0,\n iva: 0.0,\n ieps: 0.0,\n total: 0.0,\n }\n \n com_det_compra.where(moneda: moneda).each do |cdc|\n valor = cdc.precio * cdc.cantidad\n desc_cdc = valor * (cdc.descuento / 100)\n subtotal_temp = valor - desc_cdc\n desc_gral = subtotal_temp * (descuento / 100)\n subtotal = valor - desc_cdc - desc_gral\n iva = subtotal * (cdc.iva / 100)\n ieps = subtotal * (cdc.ieps / 100)\n total = subtotal + iva + ieps\n\n resultados[moneda][:valor] += valor\n resultados[moneda][:descuento] += desc_cdc\n resultados[moneda][:desc_general] += desc_gral\n resultados[moneda][:subtotal] += subtotal\n resultados[moneda][:iva] += iva\n resultados[moneda][:ieps] += ieps\n resultados[moneda][:total] += total\n\n # actualiza totales\n totales[moneda] = 0.0 unless totales[moneda]\n totales[moneda] += total\n\n # actualiza totales por comprobante\n comprobante = cdc.comprobante ? cdc.comprobante : \"Sin comprobante\"\n tipo_comp = cdc.tipo_comprobante ? cdc.tipo_comprobante : nil\n # total, moneda, nombre del departamento, id del departamento, comprobante, tipo de comprobante\n totales_por_comprobante[comprobante] = [0.0, nil, nil, nil, nil] unless totales_por_comprobante[comprobante]\n totales_por_comprobante[comprobante][0] += total\n totales_por_comprobante[comprobante][1] = cdc.moneda\n totales_por_comprobante[comprobante][2] = cdc.emp_locacion.nombre\n totales_por_comprobante[comprobante][3] = cdc.emp_locacion.id\n totales_por_comprobante[comprobante][4] = comprobante\n totales_por_comprobante[comprobante][5] = tipo_comp\n end\n end\n\n resultados\n end",
"def salvage\n return @salvage\n end",
"def salvage\n return @salvage\n end",
"def to_s\r\n @list.map{|el| el.to_s}.join ' | '\r\n end",
"def eficiencia_energetica\n auxNodo1 = @lista_alimentos.head\n auxNodo2 = @gramos.head\n eficiencia_total = 0\n while(auxNodo1 != nil && auxNodo2 != nil)\n eficiencia_total += ((auxNodo1.value.terreno * auxNodo1.value.gei) / auxNodo1.value.terreno + auxNodo1.value.gei ) * auxNodo2.value\n auxNodo1 = auxNodo1.next\n auxNodo2 = auxNodo2.next\n end\n return eficiencia_total.round(1)\n end",
"def ahorrodinero(año)\n\n i = 0\n final = Array.new \n final1 = Array.new \n final2 = Array.new \n \n\n datos = Valore.where(:año => año)\n \n datos.each do |datos|\n \n \n final[i] = datos.read_attribute(\"es\")\n final1[i] = datos.read_attribute(\"tarifa\")\n final2[i] = final1[i]*final[i]\n \n i = i +1\n \n \n end\n \n return final2\n\n\n\n end",
"def update_quantity (item,list, quantity)\n list[item] = quantity\nlist\nend",
"def emisiones\n grtotal = 0\n sum = 0\n\t\t#recorre las dos listas a la vez para sacar los gases emitidos\n\t\t# de cada ingrediente segun el peso de este\n @lista.zip(@listagr).each do |normal, gr|\n cant = gr/1000.0\n sum += normal.gases*cant\n end\n @gei = sum\n\n end",
"def save_save_list\n save_list.each do |obj|\n obj.save!\n end\n end",
"def secuenciasugerida \n #recupera los hijos del padre de la cuenta a crear \n\t\thijos = Catalogo.where(\"padre_id = ? AND activo = ?\", idcuenta, true)\n\n #configuracion del nivel a crear\n\t\tidnivel = Catalogo.find_by(id: idcuenta).nivel_id\n\t\tnivelh = Nivel.find_by(id: idnivel).numnivel + 1\n\n nivel = Nivel.find_by(numnivel: nivelh)\n nrodigitos = nivel.nrodigitos\n nrodigitostotal = nivel.nrodigitostotal\n digito = 0\n aux = 0\n\n hijos.each do |e|\n \taux = e.codigo.last(nrodigitos).to_i\n \t\tif digito < aux\n\t\t\t\tdigito = aux\n \t\tend\n \tend\n \tdigito = digito + 1\n \tc =\"\"\n \tnrodigitos.times { c = c + \"0\" }\n \tc = c.to_s + digito.to_s \t\n \t\t\n #codigo sugerido\n \treturn c.last(nrodigitos).to_s\n\tend",
"def update_list(item,quantity,list)\n list[item]=quantity\nend",
"def sum(list)\n\ttotal = 0\n list.each { |ele| total += ele }\n total\nend",
"def insertar(texto,timestamp,usuario,fotousuario)\n\t\n\t\tlistaobjeto=[texto,timestamp,usuario,fotousuario]\n\t\t@Lista+=[listaobjeto]\n\tend",
"def executa(lista_intervalos)\n\t\tsoma_qtd_numeros_magicos(lista_intervalos)\n\tend",
"def cobrar_alquiler costeAlquiler\n @propietario.modificar_saldo(costeAlquiler) \n end",
"def update_quantity(list, item, quantity)\n list[item] = quantity.to_i\n list\nend",
"def to_s\n\n\t\tsuma_gramos = 0\n\t\tcantidades.collect{|i| suma_gramos += i}\n\n\t\tresult = \"\\n#{@nombre}:\\n\\n\"\n\t\t\n\t\t\n\t\t@plato.collect{|i| result += i.to_s + \"\\n\"}\n\t\tresult += \"Emisiones de gases de efecto invernadero diarias: #{emisionesEfectoInvDiarias}\\nTerreno total utilizado: #{terrenoTotal}\"\n\n\t\tresult\n\tend",
"def to_s\n\t\tstring = @nombre + \" ,Ingredientes: \"\n\t\t@lista.zip(@listagr).each do |normal, gr|\n string += normal.nombre + \" \" \n\t\t\tstring += gr.to_s + \" gr \"\n end\n\t\tstring\n\tend",
"def new_quantity(list, item, qty)\n list[item] += qty\n p list\nend",
"def update (str,qty,list)\n list[str]=qty\n list\nend",
"def save\n @data.map(&:save)\n end",
"def compute_total_and_print()\n @total_price=0\n $final_price_list.each do |element| \n @total_price = @total_price + element\n end\n @total_sales_tax=0\n $sales_tax_list.each do |element|\n @total_sales_tax = @total_sales_tax + element\n end\n puts \"Sales Tax : #{@total_sales_tax.round(2)}\"\n puts \"Total : #{@total_price.round(2)}\"\nend",
"def update_total_sales_array\n $TOTAL_SALES << [@seats_price, @service_tax, @swach_bharath_cess, @krishi_kalyan_cess]\n end",
"def void_last_transaction\n#save add item to last transaction\n#take total and items list, and remove last transaction\n self.total -= self.last_transaction\n @title.pop\n end",
"def summ\n result = 0.0\n self.propose_items.each do |item|\n result += item.price\n end\n return result\n end",
"def update_quant (olist, item, quant)\n olist[item] = quant\n olist\nend",
"def update_quantity(list, item, quantity)\n list[item] = quantity\n p list\nend",
"def stringify(list) \n list.each do |item, qty|\n puts item + \" ==> \" + qty.to_s\n end\nend",
"def idols_data\n\n\t\t[[ \"Last name\", \"First name\", \"Description\" ]] + [[ @view_context.number_to_currency(1), 2, 3] ] +\n\t\t@idols.map { |idol| [idol.last_name, idol.first_name, idol.talents.first.description] }\n\n\tend",
"def to_s() # :nodoc:\n mano_seleccionada = super.to_s # Hago un llamado al metodo to_s de mi padre que maneja\n # la impresion de la mano seleccionada\n if not @estrategias.nil?\n return \"Las estrategias suministradas son \" + @estrategias.to_s + \" \" + mano_seleccionada\n end\n return \"La lista de estrategias provista no es valida\"\n end",
"def hash\n [id, limite_global, limite_compra, limite_parcelado, limite_parcelas, limite_saque_global, limite_saque_periodo, limite_consignado, limite_internacional_compra, limite_internacional_parcelado, limite_internacional_parcelas, limite_internacional_saque_global, limite_internacional_saque_periodo, limite_maximo, saldo_disponivel_global, saldo_disponivel_compra, saldo_disponivel_parcelado, saldo_disponivel_parcelas, saldo_disponivel_saque, saldo_pontos_fidelidade, saldo_disponivel_compra_internacional, saldo_disponivel_saque_internacional].hash\n end",
"def update_quantity(item, list, quantity)\n list[item] = quantity\n return list\nend",
"def amount( item, list )\n \"#{ list.size } #{ item }#{ pl list }\"\nend",
"def updated_quantity(list, item_name, quantity)\r\n\tlist[item_name] = quantity\r\n\tlist\r\nend",
"def save formatted_time,arr\n # add it to the sum\n arr.each do |n| \n next unless @block.call(*arr[1..-1]) if @block\n i = Integer(n) rescue return\n @value[formatted_time] += i;\n end\n end",
"def salvar\n @aliquotum = Aliquotum.find(params[:id])\n \n @aliquotum.empregador_perc = params[:empregador_perc]\n @aliquotum.empregado_perc = params[:empregado_perc]\n\n\n data = params[:ano_base]\n @aliquotum.ano_base = data\n\n @aliquotum.update_attributes(params[:aliquotum])\n\n respond_to do |format|\n format.html { redirect_to action: :index }\n end\n end",
"def update_quantity(name, quantity, list)\n list[name] += quantity\nend",
"def salIR\n\t\t((valorEnergeticoKJ.to_f*6)/8400).round(2)\n\tend",
"def verTodasVentas()\n totalVentas=0\n for i in(0..$ventas.size-1)\n for j in(0..$ventas[i].size-1)\n end\n totalVentas=totalVentas\n end\n puts \"Total Vendido: #{totalVentas}\"\n end",
"def update_quantity(list, item, quantity)\nlist[item] = quantity\nlist\nend",
"def saludar (has)\n puts \"Tu nombre es #{has[:nombre]}\"\n puts \"Tu edad es #{hash[:edad]}\"\nend",
"def store_values\n self.parent.write_attribute(self.field_name, self.ids)\n end",
"def update(item,quantity,list)\n\tlist[item] = quantity\nend",
"def calcular_promedio(hash)\n file = File.open('promedios.csv', 'w')\n hash.each do |key, value|\n suma = 0\n value.each do |n|\n suma += n.to_i\n end\n file.puts \"El alumno #{key} tiene : promedio #{suma.to_f/value.count}\"\n puts \"El alumno #{key} tiene : promedio #{suma.to_f/value.count}\"\n end\n file.close\n puts ''\nend",
"def sumar_insumo(nombreInsumo, cantidad)\n\t\tcase nombreInsumo\n\t\t\twhen \"cebada\" then (@cebada += cantidad)\n\t\t\twhen \"arroz_maiz\" then (@arroz_maiz += cantidad)\n\t\t\twhen \"levadura\" then (@levadura += cantidad)\n\t\t\twhen \"lupulo\" then (@lupulo += cantidad)\n\t\t\twhen \"producto_silos_cebada\" then \n\t\t\t\t(@producto_silos_cebada += cantidad)\n\t\t\twhen \"producto_molino\" then \n\t\t\t\t(@producto_molino += cantidad)\n\t\t\twhen \"producto_paila_mezcla\" then \n\t\t\t\t(@producto_paila_mezcla += cantidad)\n\t\t\twhen \"producto_cuba_filtracion\" then \n\t\t\t\t(@producto_cuba_filtracion += cantidad)\n\t\t\twhen \"producto_paila_coccion\" then \n\t\t\t\t(@producto_paila_coccion += cantidad)\n\t\t\twhen \"producto_tanque_preclarificador\" then \n\t\t\t\t(@producto_tanque_preclarificador += cantidad)\n\t\t\twhen \"producto_enfriador\" then \n\t\t\t\t(@producto_enfriador += cantidad)\n\t\t\twhen \"producto_tcc\" then (@producto_tcc += cantidad)\n\t\t\twhen \"producto_filtro_cerveza\" then \n\t\t\t\t(@producto_filtro_cerveza += cantidad)\n\t\t\twhen \"producto_tanque_cerveza\" then \n\t\t\t\t(@producto_tanque_cerveza += cantidad)\n\t\t\twhen \"cerveza\" then (@cerveza += cantidad)\n\t\tend\n\tend",
"def add(final_list, item, quan)\r\n p final_list[item] = quan\r\nend",
"def update_quantity_of_item(list,item,quantity)\r\n add_item_to_list(list,item,quantity)\r\n list\r\nend"
] |
[
"0.6974224",
"0.66611624",
"0.64479166",
"0.59883237",
"0.5746366",
"0.55472875",
"0.541903",
"0.5385529",
"0.53465086",
"0.5268247",
"0.51594764",
"0.5157395",
"0.5152861",
"0.51268274",
"0.51021373",
"0.51011205",
"0.50794977",
"0.50656784",
"0.5064048",
"0.50478065",
"0.503616",
"0.50360394",
"0.5035871",
"0.50263774",
"0.5017234",
"0.5015198",
"0.50111973",
"0.49581984",
"0.49527615",
"0.49456096",
"0.4943102",
"0.4932107",
"0.49191725",
"0.49108702",
"0.49064702",
"0.48877266",
"0.48773342",
"0.48660246",
"0.48523486",
"0.48513612",
"0.48446473",
"0.4838862",
"0.4837446",
"0.48343152",
"0.48311424",
"0.4830189",
"0.4826881",
"0.48250958",
"0.4821825",
"0.4821825",
"0.48197758",
"0.4816109",
"0.48140872",
"0.4812598",
"0.47913742",
"0.47913742",
"0.47819397",
"0.47818503",
"0.47791308",
"0.47726497",
"0.47705626",
"0.47641653",
"0.4751053",
"0.47489482",
"0.474644",
"0.4739122",
"0.47262728",
"0.47257897",
"0.47218108",
"0.47116375",
"0.47020373",
"0.470118",
"0.4698996",
"0.4697731",
"0.46963835",
"0.46929687",
"0.46918184",
"0.46883172",
"0.46814966",
"0.46795395",
"0.46682054",
"0.46647322",
"0.46611664",
"0.46598125",
"0.46566987",
"0.4656348",
"0.46560472",
"0.4655233",
"0.4651665",
"0.464546",
"0.46445093",
"0.46433437",
"0.4635942",
"0.46356726",
"0.46338165",
"0.46333817",
"0.46315712",
"0.4631252",
"0.46308187",
"0.4620574"
] |
0.4759796
|
62
|
Metodo para enumerar la lista, poder aplicarle metodos de ordenacion, como collect,sort... todos del modulo enumerable
|
def each
iterator = @head
while iterator != nil do
yield iterator.value
iterator = iterator.next
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def each(&block)\n @@list.each(&block)\n end",
"def each\n return enum_for(:each) unless block_given?\n @list.each do |item|\n yield item\n end\n end",
"def each(&block)\n @list.each(&block)\n end",
"def all_items\n all_items = []\n collections.each do |c|\n c.items.each do |i|\n all_items.push i\n end\n end\n all_items\n end",
"def each(&block)\n list.each &block\n end",
"def ordered_list; end",
"def list\n return @enumerable\n end",
"def each(&block)\n list_items.each(&block)\n end",
"def each_list\n unless block_given?\n return enum_for(:each_list)\n end\n\n fsp_header.each do |key, value|\n yield key, value if value.is_a?(Innodb::List)\n end\n end",
"def my_select(coll)\n # your code here!\n mod_coll = []\n i=0\n while i < coll.length\n if (yield(coll[i]))\n mod_coll.push(coll[i])\n end\n i = i+1\n end\n mod_coll\nend",
"def lists\n @lists.sort_by { |list| -list.items.size }\n end",
"def each(&block)\n @list.each_value &block\n end",
"def each(&block)\n\t\t\t@ordered.each(&block)\n\t\tend",
"def items\n items, iter = [], @obj.items\n while (i = iter.next) do\n items << i\n end\n items\n end",
"def items\n @lists.collect(&:items).flatten\n end",
"def each\n items.each { |itm| yield itm }\n end",
"def iterator\n AlphabeticalOrderIterator.new(@collection)\n end",
"def ordenar_for\n\t @lista = self.map{ |a| a }\n\t \tfor i in (0..@lista.count-1)\n\t\t\tfor j in (0..@lista.count-1)\n\t\t\t\tif j+1 != @lista.count\n if @lista[j+1] < @lista[j]\n\t\t\t\t\t\t@lista[j],@lista[j+1] = @lista[j+1],@lista[j]\n \t\t\t\tend\n\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t@lista\n end",
"def each\n self.to_a.each do |el|\n yield(el)\n end\n end",
"def list_items\n @items.each do |type,list|\n puts \"#{type}\"\n puts \"--------------------\"\n list.each {|item, key| puts \"#{item} #{key}\"}\n puts \"\"\n end\n end",
"def each(&block)\n @ordered_elements.each(&block)\n end",
"def all\n @list\n end",
"def all\n @list.values\n end",
"def list\n return @lists\n end",
"def items\n items = []\n iter = @obj.items\n\n while (i = iter.next)\n items << i\n end\n\n items\n end",
"def list_items\r\n begin\r\n expand_combo\r\n get(:type => :list_item, :scope => :children, :how_many => :all)\r\n ensure\r\n collapse_combo\r\n end\r\n end",
"def _summary_list(list)\n list_for_display = []\n\n if list\n list.each do |item|\n display_item = yield(item, list_for_display)\n list_for_display += display_item if display_item\n end\n end\n\n list_for_display\n end",
"def each_inode_list\n return enum_for(:each_inode_list) unless block_given?\n\n INODE_LISTS.each do |name|\n yield name, list(name)\n end\n end",
"def list_sort(lists, &block)\n incomplete_lists = {}\n complete_lists = {}\n\n complete_lists, incomplete_lists = lists.partition {|list| is_complete?(list)}\n\n incomplete_lists.each { |list| yield list, lists.index(list) }\n complete_lists.each { |list| yield list, lists.index(list) }\n end",
"def list(*) end",
"def each\n \n nodo = @head\n while nodo != nil\n \n yield nodo.value\n nodo = nodo.next\n \n end\n \n end",
"def each\n return to_enum unless block_given?\n list = self\n until list.empty?\n yield(list.head)\n list = list.tail\n end\n end",
"def sort_lists(lists, mode, &blk)\n # separate the lists into a groups (hashes) of incomplete and completed lists\n # hashes are ordered for R. versions >= 1.9\n complete_lists, incomplete_lists = lists.partition { |list| all_complete?(list, mode) }\n # since we are only passing the list and not its ndx, we can yield the blk directly\n incomplete_lists.each(&blk)\n complete_lists.each(&blk)\n end",
"def elements\n # execute query\n ordered_objects.compact.uniq\n end",
"def each(&blk)\n to_a.each(&blk)\n end",
"def each(&blk)\r\n to_a.each(&blk)\r\n end",
"def each\n return [].to_enum if predicate.nil?\n\n if block_given?\n objects do |object|\n converted_object = convert_object(object)\n yield converted_object unless converted_object.nil?\n end\n end\n\n to_enum\n end",
"def each\n all.each do |el|\n yield el\n end\n end",
"def test_0690_group_by\n @@log.debug \"test_0690_group_by starts\" if @@log.debug?\n assert_respond_to(@list, :group_by, \"test_0690_group_by_respond\")\n # Type check\n enum = @list.group_by\n result = enum.is_a? Enumerator\n assert(result,\"test_0690_group_by_class\") \n # Build basic Hash groups\n hash = @list.group_by {|item| item.ndata <= 2 ? \"le2\" : \"gt2\"}\n assert_equal(hash,\n {\"gt2\" => [@aen, @bsb], \"le2\" => [@cab, @dad]},\n \"test_0690_group_by_hash\")\n @@log.debug \"test_0690_group_by ends\" if @@log.debug?\n end",
"def order_by(&blk)\n OrderedCollection.new(@things.sort_by(&blk))\n end",
"def each()\n self.to_a.each { |elt| yield elt }\n end",
"def list\n order_items\n end",
"def each\n all.each do |el|\n yield el\n end\n end",
"def each\n #if head is not nil we have a list and can interate.\n #simply iterate and yield data from each node\n if !@head.nil?\n current = @head\n while current.next_node != nil\n yield current.data\n current = current.next_node\n end\n yield current.data\n\n end\n end",
"def sort_by(&block)\n super(&block).extend(OperationList)\n end",
"def each_in_list(list)\n for i in 0..(list.length - 1)\n yield list[i]\n end\nend",
"def each\n @collection.each { |c| yield c }\n end",
"def each\n @items.each { |i| yield i }\n end",
"def each\n enum = @head\n while (enum != nil) \n yield enum.value\n enum = enum.next\n end\n end",
"def sort(lists)\n completed, incomplete = lists.partition { |list| list_completed?(list)}\n incomplete.each { |list| yield list }\n completed.each { |list| yield list }\n end",
"def list; end",
"def list; end",
"def list; end",
"def list; end",
"def list; end",
"def liste()\n puts(\"LISTE DES ORDRES\\n\");\n printf(\"%8s %8s %5s %10s\\n\",\n \"ID\", \"DEBUT\", \"DUREE\", \"PRIX\")\n printf(\"%8s %8s %5s %10s\\n\",\n \"--------\", \"-------\", \"-----\", \"----------\")\n @listOrdre = @listOrdre.sort{ |a,b| a.debut <=> b.debut } \n @listOrdre.each { |ordre| afficherOrdre(ordre) }\n printf(\"%8s %8s %5s %10s\\n\",\n \"--------\", \"-------\", \"-----\", \"----------\");\n end",
"def each\n return enum_for(:each) unless block_given?\n\n @data.collection.each { |item| yield item }\n end",
"def list\n raise NotImplementedError\n end",
"def each\n list.each { |rolegroup| yield rolegroup }\n end",
"def each_option(&block)\n list.each(&block)\n end",
"def each\n @items.each {|x| yield x}\n end",
"def each(&block)\n if block_given?\n EMPTY_LIST.each(&block)\n self\n else\n EMPTY_LIST.each\n end\n end",
"def each( args )\n\t\tsortby = args.select{ |v| v =~ /^[\\+\\-].*$/ }\n\t\tfilters = args-sortby\n\t\tstatuses = filters.select{ |i| @options.status.include?( i ) }\n\t\t#statuses = filters.select{ |i| @tags.include?( i ) }\n\t\tif statuses.length > 0\n\t\t\tfiltered = @cache.select{ |i| statuses.include?( i.data.status ) }\n\t\telse\n\t\t\tfiltered = @cache\n\t\tend\n\t\tsorted = filtered\n\t\tif sortby.length > 0\n\t\t\tsort = sortby[0][1, 100]\n\t\t\tdir = '+'==sortby[0][0,1] ? 1 : -1\n\t\t\tputs \"#{dir} #{sort} #{sortby[0][0]}\"\n\t\t\tsorted = filtered.sort{ |a,b| dir * (a.data.send( sort )<=> b.data.send( sort )) } \n\t\tend\n\t\tsorted.each do |i|\n\t\t\tyield( i )\n\t\tend\n\tend",
"def each\n pomodoros.each do |pomo|\n yield pomo\n end\n end",
"def each\n @items.each { |_item| yield _item }\n end",
"def each(&block)\n internal_collection.each(&block)\n end",
"def each # :nodoc:\n return enum_for __method__ unless block_given?\n\n @exact.each do |requirement|\n yield requirement\n end\n\n @list.each do |requirement|\n yield requirement\n end\n end",
"def each(&block)\n to_a.each(&block)\n end",
"def map(collection)\n result = []\n collection.each { |el| result << yield(el)}\n result\nend",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block)\n @collection.each do |collectable|\n if block_given?\n block.call collectable\n else \n yield collectable\n end\n end \n end",
"def each(&block)\n to_a.each(&block)\n end",
"def each(&block)\n @items.each(&block)\n end",
"def each(&block)\n @collection.each(&block)\n end",
"def iterate\n raise \"You should implement this\"\n end",
"def each(&blk)\n list.each do |key|\n yield key, get(key)\n end\n end",
"def each(&block)\n @collection.each(&block)\n end",
"def each_xdes_list\n return enum_for(:each_xdes_list) unless block_given?\n\n XDES_LISTS.each do |name|\n yield name, list(name)\n end\n end",
"def each(&block)\n @all.each(&block)\n end",
"def each(&block)\n block_given? ? all.each(&block) : all.to_enum\n end",
"def accessible_lists\n list_copy = lists.clone\n list_copy.concat subscribed_lists\n list_copy\n end",
"def ordenEach ()\n ordenado = []\n each do\n |nodo|\n if ordenado.empty?\n ordenado.push(nodo)\n else\n indice = 0\n while indice < ordenado.length\n if nodo <= ordenado[indice]\n ordenado.insert(indice, nodo)\n break\n elsif indice == ordenado.length-1\n ordenado.insert(indice+1, nodo)\n break\n end\n indice+=1\n end\n end\n end\n return ordenado\n end",
"def each\n # Include every to be inside enumerable:\n yield \"pizza\"\n yield \"spaghetti\"\n yield \"salad\"\n yield \"water\"\n yield \"bread\"\n end",
"def each # And define each on top of next\n loop {yield self.next }\n end",
"def enumerator ; end",
"def enumerator ; end",
"def each\n to_a.each\n end",
"def each\n to_a.each\n end",
"def each\n to_a.each\n end",
"def list \n @@Ordenadores\n end",
"def traverse_list\n return self unless block_given?\n x = @head\n until x.nil?\n yield x\n x = x.next_node\n end\n end",
"def each(&block)\n all.each(&block)\n end",
"def each\n @listA.each do |listA|\n @listB.each { |listB| yield [listA, listB] }\n end\n end",
"def each(&block)\n return all.each(&block)\n end",
"def each\n return enum_for(:each) unless block_given?\n\n item = @head\n\n while item do\n yield item.value\n item = item.next\n end\n end",
"def my_select(list)\n result = []\n list.each do |n|\n result << n if yield(n)\n end\n result\nend"
] |
[
"0.59900475",
"0.59386235",
"0.57080483",
"0.5618742",
"0.551421",
"0.5466715",
"0.5462922",
"0.53820074",
"0.53797877",
"0.53553206",
"0.53399265",
"0.5308958",
"0.5299828",
"0.5285202",
"0.52692133",
"0.52680117",
"0.5261699",
"0.52409166",
"0.5221012",
"0.52178836",
"0.5214399",
"0.5212306",
"0.5210874",
"0.5188714",
"0.5172015",
"0.51711035",
"0.5164995",
"0.5159468",
"0.515804",
"0.51536137",
"0.5149892",
"0.513891",
"0.5135967",
"0.5125025",
"0.5108635",
"0.51066464",
"0.5104766",
"0.51019454",
"0.5095938",
"0.5095713",
"0.50814205",
"0.5081358",
"0.507702",
"0.5060392",
"0.5059324",
"0.50508463",
"0.5045611",
"0.5033893",
"0.5031779",
"0.50127095",
"0.5008774",
"0.5008774",
"0.5008774",
"0.5008774",
"0.5008774",
"0.5008015",
"0.499628",
"0.49900472",
"0.49855366",
"0.49815267",
"0.49756974",
"0.49647254",
"0.4961583",
"0.4953023",
"0.49495134",
"0.49466774",
"0.49465328",
"0.4937919",
"0.49214536",
"0.49143207",
"0.49143207",
"0.49143207",
"0.49143207",
"0.49143207",
"0.49143207",
"0.4908839",
"0.49058992",
"0.48964384",
"0.48946673",
"0.48928595",
"0.48921108",
"0.48895067",
"0.48876077",
"0.4886389",
"0.488358",
"0.4881411",
"0.4879264",
"0.4873916",
"0.4869238",
"0.48557198",
"0.48557198",
"0.4854172",
"0.4854172",
"0.4854172",
"0.48533386",
"0.4851947",
"0.48488232",
"0.48404157",
"0.4837625",
"0.48359057",
"0.483223"
] |
0.0
|
-1
|
GET /online_judges/1 GET /online_judges/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @judges = Judge.all\n end",
"def index\n @game_judges = GameJudge.all\n end",
"def index\n authorize Judge\n @judges = Judge.all\n @title = I18n.t('judges.index.title')\n end",
"def new_judgings(n = 100)\n\t\tresult = api_get('judgings', cid: contest_id, limit: n,\n\t\t fromid: last_judging)\n\t\tself.last_judging = result.last['id'] + 1 unless result.empty?\n\t\tresult\n\tend",
"def badges\n get(\"user/#{user_id}/badges.json\")\n end",
"def fetch_judge_details\n fail NoJudgesProvided if @judges.keys.empty?\n\n VACOLS::Staff.load_users_by_css_ids(@judges.keys).map do |judge|\n @judges[judge.sdomainid][:staff_info] = judge\n end\n end",
"def index\n session[:admin] = true\n @badges = Badge.order('approved_at desc,id')\n @fri_count = Badge.select { |b| b.friday? }.size\n @sat_count = Badge.select { |b| b.saturday? }.size\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @badges }\n end\n end",
"def show\n @badge = Badge.find(params[:id])\n @users = @badge.users\n respond_with @badge\n end",
"def upcoming_interviews\n future_interviews_count = @interviewer.upcoming_interviews.count\n if [1, 2].include? future_interviews_count\n render json: @interviewer\n else\n render json: {error: \"No Upcoming Interviews found\"}, status: 404\n end\n end",
"def index\n @announcements = Announcement.visible.where(locale: I18n.locale || 'en').paginate(:page => params[:page], :per_page => 10)\n \n @announcements.first.increase_views unless @announcements.empty?\n\n @title = \"News\"\n\n logger.debug @announcement.inspect\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @announcements }\n end\n end",
"def set_online_judge\n @online_judge = OnlineJudge.find(params[:id])\n end",
"def badges(id)\n get(\"users/#{id}/badges\")\n end",
"def index\n @messies = Messy.all\n\n render json: @messies\n end",
"def show\n @user = User.find(params[:id])\n unless @user.uuid == current_user.uuid\n unless current_user.rels(dir: :outgoing, type: :visits, between: @user).blank?\n rel = current_user.rels(dir: :outgoing, type: :visits, between: @user)\n rel[0].count = rel[0].count + 1\n rel[0].save!\n else\n rel = Visit.new\n rel.from_node = current_user\n rel.to_node = @user\n rel.count = 1\n rel.save!\n end\n current_user.save!\n end\n #@b = current_user.badges(:u, :r).where( uuid: @user.uuid ).pluck(:r)\n #@badges = @b.map {|b| b.badgeType}.uniq\n @uniq_badges = @user.rels(dir: :incoming, type: :badges).each.map {|r| r.badgeType}.uniq\n @all_badges = {}\n @uniq_badges.each do |badge|\n @all_badges[badge] = @user.rels(dir: :incoming, type: :badges).each.select{|r| r.badgeType == badge }.count\n end\n @my_badges = []\n @badges_count = @user.rels(dir: :incoming, type: \"badges\").count\n if current_user.uuid != @user.uuid\n current_user.rels(dir: :outgoing, type: :badges, between: @user).each do |r|\n #current_user.badges(:u, :r).where( uuid: @user.uuid ).each_with_rel do |u, r| \n @my_badges << r[:badgeType]\n end\n end\n @pictures = @user.pictures\n @testimonials = @user.testimonials\n\n unless @user.uuid == current_user.uuid\n @like = current_user.rels(dir: :outgoing, type: :likes, between: @user).blank? ? true : false\n end\n @likes_count = @user.rels(dir: :incoming, type: \"likes\").count\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def index\n @judge_activities = JudgeActivity.all\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def get_digg\n\nresponse = JSON.parse(RestClient.get 'http://digg.com/api/news/popular.json')\n# puts response['data']['feed'][0]['content']['title']\n\nstories = []\n\nresponse['data']['feed'].each do |story|\n\tstory_hash = {}\n\tstory_hash[:title] = story['content']['title']\n\tstory_hash[:category] = story['content']['tags'][0]['display']\n\tcalculate_upvotes(story_hash)\n\tstories.push(story_hash)\n\tend\n\tshow_all_stories(stories)\nend",
"def online\n current_user.online!\n render :juggernaut do |page|\n page.go_online current_user\n end\n render :nothing => true \n end",
"def room_descriptions_method\r\n my_port = 8081\r\n htttproomnumber = $roomnumber\r\n roomsNtext = \"/#{htttproomnumber}\"\r\n rooms_message = \"/rooms#{roomsNtext}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{rooms_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n return my_json[\"room\"].to_s\r\nend",
"def index\n @recent = Highfive.recent.approved\n @leaders = User.leaders\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @highfives }\n end\n end",
"def showbadge\n authorize! :read, Operator\n @operator = Operator.find_by_badge(params[:badge])\n if @operator\n render json: @operator, except: :badge\n else\n render json: {error: ['Cannot find user']}, status: :unprocessable_entity\n end\n end",
"def online\n current_user.online!\n render :juggernaut do |page|\n page.go_online User.current\n end\n render :nothing => true \n end",
"def check\n\n\t\t@unseenNotifications = {notifications: current_user.notifications.unseen.count}\n\t\trespond_to do |format|\n\n\t\t\tformat.json { render json: @unseenNotifications }\n\n\t\tend\n\n\tend",
"def visitors(id, date)\n begin\n # json = Net::HTTP.get_response(URI.parse(\"https://api-metrika.yandex.ru/stat/v1/data?date1=today&metrics=ym:s:users&filters=ym:pv:URL=@'ships'&id=33242200&oauth_token=8d3f347e9bfe4be49785fc3922ccc4e1\"))\n json = Net::HTTP.get_response(URI.parse(\"https://api-metrika.yandex.ru/stat/v1/data?date1=#{date.strftime(\"%Y-%m-%d\")}&metrics=ym:s:users&filters=ym:pv:URL=@%27ships/#{id}%27&id=33242200&oauth_token=AQAAAAADvq36AAQsNhxUuZrk40_bsQtY8fXNqrU\"))\n rescue Exception => e\n logger.debug(\"---------------------- #{e}\")\n retry\n end\n\n if (json.present? and json.code == \"200\")\n data_hash = JSON.parse(json.body)\n if data_hash[\"data\"].present?\n visitors = data_hash[\"data\"][0][\"metrics\"][0] \n else\n visitors = nil\n end\n else\n visitors = nil\n end\n\n return visitors\n end",
"def msau\n render json: get_msau(@visits)\n end",
"def index\n @jeons = Jeon.all\n end",
"def index\n user_id = params[:user_id]\n unless session[:initializing] == nil\n retry_cnt = session[:init_retry]\n if retry_cnt == nil\n retry_cnt = 0\n session[:init_retry] = 1\n else\n retry_cnt +=1\n session[:init_retry] = retry_cnt\n end\n\n init = @@redis.hget(user_id,\"initialized\")\n if init != nil\n session.delete(:initializing)\n end\n #stop trying after 50 retries\n if init == nil and retry_cnt.to_i < 50\n if retry_cnt.to_i < 50\n if retry_cnt.to_i > 40\n retry_time=40000\n elsif retry_cnt.to_i > 30\n retry_time=30000\n elsif retry_cnt.to_i > 20\n retry_time=20000\n elsif retry_cnt.to_i > 10\n retry_time=10000\n else\n retry_time=5000\n end\n else\n end\n respond_to do |format|\n format.json { render :json => {:retry=>retry_time,:retry_cnt=>retry_cnt} }\n end\n return\n end\n end\n session.delete(:init_retry)\n if(params[:limit] == nil)\n @moods = User.find(user_id).moods.order(\"report_time DESC\")\n else\n @moods = User.find(user_id).moods.order(\"report_time DESC\").limit(params[:limit].to_i)\n end\n respond_to do |format|\n format.json { render :json => @moods }\n end\n end",
"def show\n @metric = Metric.find(params[:id])\n\n render json: @metric\n end",
"def show\n @unidade_metrica = UnidadeMetrica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unidade_metrica }\n end\n end",
"def index\n @conns = current_user.conns\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @conns }\n end\n end",
"def show\n @gauge = Gauge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gauge }\n end\n end",
"def index\n gateway_alive = GatewayAlive.all\n render json: gateway_alive.to_json(:except => [:id])\n end",
"def show\n @title = @judge.name\n @crumbs = [[I18n.t('judges.index.title'), judges_path], [@judge.name, '#']]\n end",
"def show\n @grumble = Grumble.find(params[:id])\n render status: 200, json: @grumble.to_json\n end",
"def index\n users = User.all\n # cheer_ups = CheerUp.all\n render json: users\n end",
"def show\n @online_answer = OnlineAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @online_answer }\n end\n end",
"def index\n @mini_games = MiniGame.all\n render json: @mini_games, status: :ok\n end",
"def online_avail_data(url, note, materials = nil)\n if url.start_with?(CLASSIC_JOSIAH_URL)\n url = url.gsub(CLASSIC_JOSIAH_URL, NEW_JOSIAH_URL)\n else\n url = url\n if !url.start_with?(\"http://\") && !url.start_with?(\"https://\")\n url = \"http://#{url}\"\n end\n end\n\n label = \"\"\n if note == nil && materials == nil\n label = \"Available online\"\n elsif note == nil && materials != nil\n label = materials\n elsif note != nil && materials == nil\n label = note\n else\n label = \"#{note} (#{materials})\"\n end\n\n {url: url, text: label}\nend",
"def index\n messages = Message.all\n render json: messages\n end",
"def index\n \n respond_to do |format|\n format.html # index.html.erb\n format.json {\n @interviews = Interview.select(\"annotations, interviews.id, interviews.slug, storyteller_name\").where(\"is_demo = ? AND annotations != ?\", 0, \"\")\n render json: @interviews\n }\n end\n end",
"def index\n @mugshots = Mugshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mugshots }\n end\n end",
"def index\n @users = User.where(:alive => true).order(\"nick ASC\")\n @headline = t(:all_users)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users }\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 profile_communities\n messages = MessageQuery.new(current_user).communities(\n params[:limit], params[:offset]\n )\n\n render json: {\n messages: messages.as_json(\n methods: %i[\n avatar_url image_urls video_urls like_by_user legendary_by_user user\n text_with_links post_url expire_at has_expired\n ]\n )\n }, status: 200\n end",
"def popular\n render json: {\n success: true,\n issues: Issue.popular.limit(5)\n }\n end",
"def index\n @seen_comments = SeenComment.active.where(:seen_id => @seen.id).order('posted_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @seen_comments }\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 to_json()\n {\n \"teamA\" => @team_a.name,\n \"teamB\" => @team_b.name,\n \"judges\" => (@judges.map {|j| j.name}).join(\", \")\n }\n end",
"def badges(options={})\n get('/user_badge', options)\n end",
"def index\n @undergraduate_majors = UndergraduateMajor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @undergraduate_majors }\n end\n end",
"def get_json_url(url) \n useragent = \"NotubeMiniCrawler/0.1\"\n u = URI.parse url\n\n req = Net::HTTP::Get.new(u.request_uri,{'User-Agent' => useragent})\n\n begin\n\n res = Net::HTTP.new(u.host, u.port).start {|http|http.request(req) }\n\n end\n j = nil\n begin\n j = JSON.parse(res.body)\n rescue OpenURI::HTTPError=>e\n case e.to_s\n when /^404/\n raise 'Not Found'\n when /^304/\n raise 'No Info'\n end\n end\n return j\n end",
"def full_badges\n client.user_badges(id)\n end",
"def index\n notifications = params[:unread].nil? || params[:unread] == 0 ? current_user.notifications : Notification.where(user: current_user, status: :unread).all\n\n render json: {\n status: 'Success',\n message: '',\n notifications: notifications.as_json(except: [\n :created_at,\n :updated_at\n ])\n }, status: 200\n end",
"def show\n @judgement = Judgement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @judgement }\n end\n end",
"def show\n @judgement = Judgement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @judgement }\n end\n end",
"def index\n @announces = Announce.not_finished.order(\"stime DESC\")\n\t\t@pannounces = Announce.finished.last_24_hours.limit(20).order(\"etime DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @announces }\n end\n end",
"def show\n render json: @heartbeat\n end",
"def index\n @notification_counts = NotificationCount.all\n\n render json: @notification_counts\n end",
"def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end",
"def badges(user_id: '-')\n return get(\"#{API_URI}/#{PROFILE_API_VERSION}/user/#{user_id}/badges.json\")\n end",
"def online\n\n @cloud = fetch_cloud()\n @users = @cloud.online_users\n @users.each { |u| u.instance_variable_set(:@status,:online) }\n\n render :index, status: 200\n\n end",
"def index\n @visits = Visit.all\n render json: { \"count\": @visits.count, \"all_visits\": @visits }\n #render json: {\"all_visits\": @visits} \n end",
"def show\n @jiage = Jiage.find(params[:id])\n @jiages = @jiage.resource.jiages.limit(12).order(\"published_at DESC\")\n end",
"def show\n @medium = OnlineResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @online_resource }\n format.ris\n end\n end",
"def index\n @users = User.all\n render json: { users: @users }, methods: :visit_ids\n end",
"def show\n render json: @notification_count\n end",
"def show\n @badge = Badge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @badge }\n end\n \n rescue ActiveRecord::RecordNotFound\n logger.error \"Attempt to access invalid flag #{params[:id]}\"\n redirect_to root_path, notic: 'Invalid page'\n end",
"def nick_history\n _uuid = uuid.gsub(/-/, '')\n url = \"https://api.mojang.com/user/profiles/#{_uuid}/names\"\n response = Net::HTTP.get_response(URI.parse(url))\n json = JSON.parse(response.body)\n end",
"def index\n @messages = Message.all\n\n render json: @messages\n end",
"def index\n render :json => UserInterest.all\n end",
"def show\n render json: @dice\n end",
"def index\n @communities = Community.all\n render json: {items: @communities}\n end",
"def new\n @profile = Profile.find(params[:profile_id])\n @joke = @profile.jokes.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @joke }\n end\n end",
"def index\n @bookjudges = Bookjudge.all\n end",
"def index\n\t@instruction = Instruction.find( params[ :instruction_id ] )\n @testimonies = @instruction.testimonies.page( params[ :page ] ).per(20)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testimonies }\n end\n end",
"def index\n user = User.includes(message_threads: [:messages])\n .find(params[:user_id])\n\n if user.role === \"patient\"\n unread_messages = user.messages.where(read: false)\n render json: {\n unread_messages_count: unread_messages.count,\n unread_messages: unread_messages\n }\n elsif user.role === \"care_manager\"\n threads = user.patients.as_json(include: :messages)\n render json: threads\n end\n end",
"def show\n @announcement = Announcement.find(params[:id])\n render json:@announcement\n end",
"def show\n @messege = Messege.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @messege }\n end\n end",
"def getOnline\n @userListAndInfo = {}\n innerHashUserdata = {}\n allUsers = Pusher.get('/channels/presence-chat/users')\n allUsers[:users].each do |userHash|\n # get the user object from the id and populate the hash\n onlineUser = User.find(userHash[\"id\"])\n # skip the loop if the onlineUser is not a classmate of the current user\n next if !current_user.getAllClassmates.include?(onlineUser)\n innerHashUserdata[\"email\"] = onlineUser.email \n innerHashUserdata[\"name\"] = onlineUser.first_name + \" \" + onlineUser.last_name\n innerHashUserdata[\"commonClass\"] = current_user.firstCommonClass(onlineUser.id)\n # getting all the messages between current user and the online user\n allMessages = Message.where(\"receiver_id = '#{onlineUser.id}' OR \n receiver_id = '#{current_user.id}' AND\n sender_id = '#{current_user.id}' OR\n sender_id = '#{onlineUser.id}'\"\n ).order(\"created_at asc\")\n innerHashUserdata[\"messageHistory\"] = allMessages\n @userListAndInfo[onlineUser.id] = innerHashUserdata\n innerHashUserdata = {}\n end\n \trender \"show\"\n end",
"def index\n @messages = Message.all\n render json: @messages\n end",
"def index\n @messages = Message.all\n render json: @messages\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_dungeons.to_ext_json(:class => Dungeon, :count => Dungeon.count(options_from_search(Dungeon))) }\n end\n end",
"def index\n @pledges = Pledge.where('user_id = ?', current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pledges }\n end\n end",
"def index\n @user = current_user\n @search = @user.loops.search(params[:q]) \n @loops = @search.result \n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loops }\n end\n end",
"def index\n @encounters = @user.encounters\n end",
"def index\n @users = []\n User.all.each do |u|\n if u.online?\n @users.append({user: u, sign_in_at: u.attributes['current_sign_in_at']})\n end\n end\n\n render json: @users.to_json\n end",
"def index\n @allergen_warnings = AllergenWarning.all\n\n render json: @allergen_warnings\n end",
"def index\n render json: Message.all\n end",
"def index\n if params[:show] == \"upcoming\"\n @games = Game.where(:final => false).order(\"kickoff\")\n else\n @games = Game.order(\"kickoff\")\n end\n\n # Find all tips for the currently logged in user\n setup_user_tips_hash\n setup_winners_right_now\n calculate_odds\n\n # Get the leaders for the sidebar\n @leaders = User.order(\"points DESC\").limit(10)\n\n # Find the latest comment. For the polling to work.\n @last_comment = Comment.order(\"updated_at DESC\").first\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def show\n @jornada = Jornada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jornada }\n end\n end",
"def get_default_profile \n get(\"/profiles.json/default\")\nend",
"def index\n @users = User.order(:idnum)\n respond_to do |format|\n format.html { render json: {:message => \"Here are the details of all #{@users.size} users.\", :users => @users }}\n end\n end",
"def index\n \n @meeting_threads = @current_user.available_jobs\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meeting_threads }\n end\n end",
"def user_info\n user = User.find_by(id: params[:id])\n progresses = user.progresses.select {|p| p.habit.user.id == params[:id]} \n \n render json: progresses\n end",
"def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@current_release_id}\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend",
"def index\n @online_students = OnlineStudent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @online_students }\n end\n end",
"def create\n @judge = @competition.judges.build(judge_params)\n authorize @judge\n if @judge.save\n flash[:notice] = 'Association was successfully created.'\n redirect_to competition_judges_path(@competition)\n else\n index\n render :index\n end\n end",
"def index\n render json: {\n status: :success,\n urls: ShortUrl::top_100\n }\n end",
"def index\n @jednanis = Jednani.all\n end",
"def index # Essentially the main page of the application proper. This is the discover page.\n #@outlets = Outlet.where(inactive: false).order(:name).paginate(page: params[:page], per_page: 20)\n offset = params[:offset].to_i\n if offset == nil\n offset = 0\n end\n if current_user.trial == true\n puts \"current_user is trial user\"\n fetch_trial_outlets\n else\n fetch_outlets(offset)\n end\n render json: @outlets\n end",
"def index \n misses = Miss.all.order(created_at: :desc)\n render json: misses \n end"
] |
[
"0.62971824",
"0.61262345",
"0.6072168",
"0.603899",
"0.5925974",
"0.5668425",
"0.56333584",
"0.5567288",
"0.54829997",
"0.5468081",
"0.5459955",
"0.5444159",
"0.5419589",
"0.54134595",
"0.53835493",
"0.53771144",
"0.53731656",
"0.53531194",
"0.5345417",
"0.5342932",
"0.53423476",
"0.53310376",
"0.5329435",
"0.5308168",
"0.5266546",
"0.5255097",
"0.52418035",
"0.52405137",
"0.52331346",
"0.52302104",
"0.5221707",
"0.52137",
"0.5212153",
"0.5191291",
"0.5190476",
"0.51793855",
"0.5179109",
"0.5173255",
"0.5169904",
"0.5169383",
"0.5169072",
"0.5165602",
"0.5164368",
"0.5163952",
"0.51583064",
"0.5157494",
"0.5148101",
"0.5144258",
"0.514305",
"0.5142064",
"0.51389426",
"0.5130504",
"0.512415",
"0.51197493",
"0.51197493",
"0.51155233",
"0.51150984",
"0.5102983",
"0.50966984",
"0.50934386",
"0.5093371",
"0.5090025",
"0.50847125",
"0.50841695",
"0.50831246",
"0.5079532",
"0.50726134",
"0.5059458",
"0.5058544",
"0.5057454",
"0.5051021",
"0.50504243",
"0.504642",
"0.5046352",
"0.5044547",
"0.5043419",
"0.5043295",
"0.5042496",
"0.50413746",
"0.5041211",
"0.5041211",
"0.50397897",
"0.5035769",
"0.5031896",
"0.5029288",
"0.5028954",
"0.50288755",
"0.5028608",
"0.50248015",
"0.50229967",
"0.5018989",
"0.50158036",
"0.50150627",
"0.5006357",
"0.50035125",
"0.5002204",
"0.4999305",
"0.4996647",
"0.49960914",
"0.49937192",
"0.4990161"
] |
0.0
|
-1
|
POST /online_judges POST /online_judges.json
|
def create
@online_judge = OnlineJudge.new(online_judge_params)
@online_judge.user = current_user
respond_to do |format|
if @online_judge.save
format.html { redirect_to current_user, notice: 'Online judge was successfully created.' }
format.json { render :show, status: :created, location: @online_judge }
else
format.html { render :new }
format.json { render json: @online_judge.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new_judgings(n = 100)\n\t\tresult = api_get('judgings', cid: contest_id, limit: n,\n\t\t fromid: last_judging)\n\t\tself.last_judging = result.last['id'] + 1 unless result.empty?\n\t\tresult\n\tend",
"def create\n @judge = @competition.judges.build(judge_params)\n authorize @judge\n if @judge.save\n flash[:notice] = 'Association was successfully created.'\n redirect_to competition_judges_path(@competition)\n else\n index\n render :index\n end\n end",
"def create\n # Create Nudge for issueing user\n @nudge = Nudge.new\n @nudge.user_id = params[:user_id]\n @nudge.pet_id = params[:pet_id]\n @nudge.group_id = Pet.find(params[:pet_id]).group.id\n @nudge.response = -1\n @nudge.nudge_token = @nudge.generate_token\n\n respond_to do |format|\n if @nudge.save\n # Create Nudge for group memebers\n Group.find(@nudge.group_id).users.each do |user|\n next if user.id == @nudge.user_id || user.device.nil?\n @nudge_member = Nudge.new\n @nudge_member.user_id = user.id\n @nudge_member.pet_id = params[:pet_id]\n @nudge_member.group_id = Pet.find(params[:pet_id]).group.id\n @nudge_member.response = 0\n @nudge_member.nudge_token = @nudge.nudge_token\n\n if @nudge_member.save\n # Send push notification\n @apn = Houston::Client.development\n device_token = User.find(@nudge_member.user_id).device.device_token\n notification = Houston::Notification.new(device: device_token)\n notification.alert = User.find(@nudge.user_id).first_name + ': Has ' + Pet.find(@nudge.pet_id).name + ' been fed?'\n notification.category = 'fed.category'\n notification.content_available = true\n notification.sound = 'sosumi.aiff'\n notification.custom_data = { nudge_id: @nudge.id, nudge_token: @nudge.nudge_token }\n @apn.push(notification)\n end\n end\n format.json { render :show, status: :created, location: @nudge }\n else\n format.json { render json: @nudge.errors, status: :unprocessable_entity }\n end \n end\n end",
"def index\n @judges = Judge.all\n end",
"def online_judge_params\n params.require(:online_judge).permit(:site, :account_name)\n end",
"def index\n @game_judges = GameJudge.all\n end",
"def create\n @jam = Jam.new(params[:jam])\n @jam.up_votes = 0\n @jam.down_votes = 0\n respond_to do |format|\n if @jam.save\n format.html { redirect_to @jam, notice: 'Jam was successfully created.' }\n format.js \n format.json { render json: @jam, status: :created, location: @jam }\n else\n format.html { render action: \"new\" }\n format.js \n format.json { render json: @jam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n @idea = Idea.new(idea_params)\n @idea.user_id = current_user.id\n @idea.save!\n if params[:idea][:tags]\n params[:idea][:tags].each do |new_tag|\n tag_title = new_tag[:title]\n tag = Tag.find_by title: tag_title\n if tag.present?\n tag.used = tag.used + 1\n tag.save!\n else\n tag = Tag.new\n tag.title = tag_title.downcase\n tag.used = 1 \n tag.save!\n end\n @idea.tags << tag\n end\n end\n Notification.generate(current_user, @idea)\n Notification.push(@idea) \n render json: @idea.to_json(include: [{user: {only: [:name, :id, :image_url]}}, {comments: {include: {user: {only: [:name, :image_url]}}}}], methods: [:voted])\n end",
"def create\n #client scale 1-very happy 7-angry, lets revers it, later on we will add mor complex\n @mood = Mood.new(params[:mood])\n @mood.mood = (8-@mood.mood)\n @user = User.find(params[:user_id])\n @mood.user_id = params[:user_id]\n @mood.report_time = Time.now\n @mood_desc = @mood.desc\n if params[:fb_id] != nil\n @mood.fb_id = params[:fb_id]\n end\n updateMoodCounters(@mood.mood,@mood.user_id)\n Resque.enqueue(WordCounter,@mood.desc, @mood.mood, @mood.user_id)\n respond_to do |format|\n if @mood.save\n format.json { render :json => {:report_time=>@mood.report_time,:val=>@mood.mood,:desc=>@mood.desc,:id=>@mood.id}, :status => :created}\n format.js # redirect_fbct_fb.js.erb\n else\n format.json { render :json => @mood.errors, :status => :unprocessable_entity }\n format.js { render 'fail_create.js.erb' }\n end\n end\n end",
"def create\n @online_answer = OnlineAnswer.new(params[:online_answer])\n\n respond_to do |format|\n if @online_answer.save\n format.html { redirect_to @online_answer, notice: 'Online answer was successfully created.' }\n format.json { render json: @online_answer, status: :created, location: @online_answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @online_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n authorize Judge\n @judges = Judge.all\n @title = I18n.t('judges.index.title')\n end",
"def create\n @badge = Badge.new(params[:badge])\n\n respond_to do |format|\n if @badge.save\n format.html { redirect_to @badge, :notice => 'Badge was successfully created.' }\n format.json { render :json => @badge, :status => :created, :location => @badge }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @badge.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @meetup = Meetup.new(meetup_params)\n @meetup.on_ranking = true\n authorize @meetup\n respond_to do |format|\n if @meetup.save\n @meetup.sessions.create(location_id: Location.where(active: true).first.id)\n @activity = @meetup.create_activity(current_user.id)\n @notifications = @activity.create_notification\n @meetup.holdings.create(user_id: current_user.id)\n notify_collaborators\n format.html { redirect_to meetup_path(@meetup) }\n format.json do\n render :show,\n status: :created, location: @meetup\n end\n else\n format.html { render :new }\n format.json do\n render json: @meetup.errors,\n status: :unprocessable_entity\n end\n end\n end\n end",
"def set_online_judge\n @online_judge = OnlineJudge.find(params[:id])\n end",
"def create\n @judge = Judge.new(judge_params)\n\n respond_to do |format|\n if @judge.save\n format.html { redirect_to @judge, notice: 'Judge was successfully created.' }\n format.json { render :show, status: :created, location: @judge }\n else\n format.html { render :new }\n format.json { render json: @judge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @badge = Badge.new(params[:badge])\n \n\n respond_to do |format|\n if @badge.save\n format.html { redirect_to @badge, notice: 'Badge was successfully created.' }\n format.json { render json: @badge, status: :created, location: @badge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @badge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @judge_activity = JudgeActivity.new(judge_activity_params)\n\n respond_to do |format|\n if @judge_activity.save\n format.html { redirect_to @judge_activity, notice: 'Judge activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @judge_activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @judge_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gauge = Gauge.new(params[:gauge])\n\n respond_to do |format|\n if @gauge.save\n format.html { redirect_to @gauge, notice: 'Gauge was successfully created.' }\n format.json { render json: @gauge, status: :created, location: @gauge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gauge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @online_judge.update(online_judge_params)\n format.html { redirect_to current_user, notice: 'Online judge was successfully updated.' }\n format.json { render :show, status: :ok, location: @online_judge }\n else\n format.html { render :edit }\n format.json { render json: @online_judge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def jyanken_params\n params.require(:jyanken).permit(:human, :computer, :judgment)\n end",
"def fetch_judge_details\n fail NoJudgesProvided if @judges.keys.empty?\n\n VACOLS::Staff.load_users_by_css_ids(@judges.keys).map do |judge|\n @judges[judge.sdomainid][:staff_info] = judge\n end\n end",
"def create\n @jeon = Jeon.new(jeon_params)\n\n respond_to do |format|\n if @jeon.save\n format.html { redirect_to @jeon, notice: 'Jeon was successfully created.' }\n format.json { render :show, status: :created, location: @jeon }\n else\n format.html { render :new }\n format.json { render json: @jeon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n # current_user.add_badge(1)\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Postagem criada com sucesso.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def nudge_params\n params.require(:nudge).permit(:nudge_token, :user_id, :pet_id, :group_id, :response)\n end",
"def upvote\n\n\t\t@interview = InterviewReview.find(params[:id])\n\t\t@interview.upvotes.create(job_seeker_id: current_user.job_seeker.id)\n\t\t@total_votes = @interview.upvotes.count\n\t\trespond_to do |format|\n\t\t\t\n\t\t\tformat.js\n\t\tend\n\tend",
"def create\n @unidade_metrica = UnidadeMetrica.new(params[:unidade_metrica])\n\n respond_to do |format|\n if @unidade_metrica.save\n format.html { redirect_to unidade_metricas_url }\n format.json { head :no_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @unidade_metrica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def judge_params\n params.require(:judge).permit(:first_name, :last_name, :isSitting, :biography, :email, :pol_Aff, :ballot_id, :precinct_id)\n end",
"def create\n @diagnosis = Diagnosis.new(params[:diagnosis])\n @diagnosis.prof_inspection_id = @prof_inspection.id\n\n respond_to do |format|\n if @diagnosis.save\n format.html { redirect_to client_prof_inspections_path(@prof_inspection.client), notice: I18n.t(:record_created) }\n format.json { render json: @diagnosis, status: :created, location: @diagnosis }\n else\n format.html { render action: \"new\" }\n format.json { render json: @diagnosis.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @badge = Badge.find(params[:badge_id])\n @presence = @badge.presences.build(params[:presence])\n if @presence.value == nil\n \t@presence.value = 1\n end\n\n respond_to do |format|\n if @presence.save\n# format.html { redirect_to @presence, notice: 'Presence was successfully created.' }\n format.html { render json: @presence, status: :created, location: @presence }\n format.json { render json: @presence, status: :created, location: @presence }\n else\n format.html { render action: \"new\" }\n format.json { render json: @presence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @judgement = Judgement.new(params[:judgement])\n\n respond_to do |format|\n if @judgement.save\n format.html { redirect_to @judgement, notice: 'Judgement was successfully created.' }\n format.json { render json: @judgement, status: :created, location: @judgement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @judgement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @judgement = Judgement.new(params[:judgement])\n\n respond_to do |format|\n if @judgement.save\n format.html { redirect_to @judgement, notice: 'Judgement was successfully created.' }\n format.json { render json: @judgement, status: :created, location: @judgement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @judgement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def to_json()\n {\n \"teamA\" => @team_a.name,\n \"teamB\" => @team_b.name,\n \"judges\" => (@judges.map {|j| j.name}).join(\", \")\n }\n end",
"def create\n @dice = Dice.new(dice_params)\n\n if @dice.save\n render json: @dice, status: :created, location: @dice\n else\n render json: @dice.errors, status: :unprocessable_entity\n end\n end",
"def create\n @unlimited = Unlimited.new(unlimited_params)\n\n respond_to do |format|\n if @unlimited.save\n format.html { redirect_to @unlimited, notice: 'Unlimited was successfully created.' }\n format.json { render action: 'show', status: :created, location: @unlimited }\n else\n format.html { render action: 'new' }\n format.json { render json: @unlimited.errors, status: :unprocessable_entity }\n end\n end\n end",
"def judge_params\n params.require(:judge).permit(:name, :recommendation, :details, :judicial_district)\n end",
"def judge_params\n params.require(:judge).permit(:houhou, :houhou_eng)\n end",
"def create\n @user = User.find(current_user.id)\n @new_thread = NewThread.friendly.find(params[:new_thread_id])\n @dislike_count = @user.add_new_thread_dislike(@new_thread.id)\n @thread_user = @new_thread.user\n respond_to do |format|\n if @dislike_count.save\n if current_user != @thread_user\n @thread_user.update_attributes(points: @thread_user.points -= 10)\n @badge = @thread_user.update_badge(@user.id)\n @thread_user.update_attributes(badge: @badge)\n end\n format.html { redirect_to(action: 'index', controller: 'new_threads') }\n format.js\n format.json { render :show, status: :created, location: @dislike_count }\n else\n format.html { render :new }\n format.json do\n render json: @dislike_count.errors,\n status: :unprocessable_entity\n end\n end\n end\n end",
"def create\n @niche = current_user.niches.new(processed_params)\n if @niche.save\n render json: { status: 'ok' }\n else\n render json: { status: @niche.errors.to_a.join('base') }\n end\n end",
"def ga_datum_params\n params.require(:ga_datum).permit(:ga_label_id, :profile, :json)\n end",
"def create\n @jednani = Jednani.new(jednani_params)\n\n respond_to do |format|\n if @jednani.save\n format.html { redirect_to @jednani, notice: 'Jednani was successfully created.' }\n format.json { render action: 'show', status: :created, location: @jednani }\n else\n format.html { render action: 'new' }\n format.json { render json: @jednani.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @online_answer = OnlineAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @online_answer }\n end\n end",
"def add_winner_badges\n\t\trespond_to do |format|\n\t\t\tformat.json{\n\t\t\t\tscrimage = Scrimage.find(params[:scrimage_id])\n\n\t\t\t\tmaxVotes = scrimage.photos.maximum(\"votes\")\n\n\t\t\t\twinningPhotoIDs = scrimage.photos.where(\"votes = ?\", maxVotes)\n\n\t\t\t\tscrimage.winner_id = winningPhotoIDs.first.id\n\t\t\t\t\n\t\t\t\tscrimage.save()\n\n\t\t\t\twinningPhotoIDs.each do |photoID|\n\t\t\t\t\tphoto = Photo.find(photoID)\n\t\t\t\t\tnotification = Notification.new(:user_id => photo.user_id, :message => \"100 Points Awarded - You won the scrimage with your photo, \"+photo.description+\"!\")\n\n\t\t\t\t\t#Ensures that all winners receive points for their winning photos\n\t\t\t\t\tuser = User.find(photo.user_id)\n\t\t\t\t\tuser.update(points: user.points + 100)\n\n\t\t\t\t\tnotification.save()\n\t\t\t\tend\n\n\t\t\t\t#render :json => {:winningPhotoID => winningPhotoIDs} \n\t\t\t\trender :json => {:html => render_to_string({:partial => \"scrimages/displayChildPhotos\", :formats => [:html, :js], :locals => {:scrimage => scrimage, :layout => false}})}\n \t\t\t}\t\t\t\n \t\tend\n\tend",
"def create\n @judge = Judge.new(judge_params)\n\n respond_to do |format|\n if @judge.save\n format.html #{ redirect_to @judge, notice: 'Judge was successfully created.' }\n format.json { render action: 'show', status: :created, location: @judge }\n else\n format.html { render action: 'new' }\n format.json { render json: @judge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @heartbeat = Heartbeat.new(heartbeat_params)\n\n if @heartbeat.save\n render json: @heartbeat, status: :created, location: @heartbeat\n else\n render json: @heartbeat.errors, status: :unprocessable_entity\n end\n end",
"def create\n # @attention = Attention.new(attention_params)\n # @attention.participants = params[:participants]\n # @attention.responsible = params[:responsible]\n # @attention.nro_involved = params[:participants].count + 1\n\n # respond_to do |format|\n # if @attention.save\n # format.html { redirect_to @attention, notice: 'Attention was successfully created.' }\n # format.json { render :show, status: :created, location: @attention }\n # else\n # format.html { render :index }\n # format.json { render json: @attention.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n params_medium = params.require(:medium).permit(:recording_note, :resource_type_id, :taken_on,\n :capture_device_model_id, :quality_type_id, :private_note, web_address_attributes: [:parent_resource_id, :url])\n web_address_params = params_medium.delete('web_address_attributes')\n @medium = OnlineResource.new(params_medium)\n @medium.ingest_taken_on(params_medium)\n respond_to do |format|\n if @medium.save && @medium.create_web_address(web_address_params)\n format.html { redirect_to @medium, :notice => 'Online resource was successfully created.' }\n format.json { render :json => @medium, :status => :created, :location => @medium }\n else\n @quality_types = QualityType.order('id')\n @resource_types = Topic.find(2636).children\n format.html { render :action => \"new\" }\n format.json { render :json => @medium.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 send_to_pagerduty(alert)\n # This creates and updates alerts from nagios.\n # It requires the following json data (at a minimum):\n # {\n # \"service_key\": @alert_api_key, # this comes from the CONTACTPAGER var passed by nagios\n # \"inicident_key\": @problemid, # this comes from nagios PROBLEMID\n # \"event_type\": \"trigger\"||\"acknowledge\"||\"resolved\",\n # \"description\": \"Reason for failure\", # this gets posted as the SMS details.\n # \"details\": {\n # \"someotherdetail\": \"value\"\n # }\n # }\n\n\n @jdata = alert.to_json\n Log.info(\"going to send: #{JSON.pretty_generate(JSON.parse(@jdata))}\") if VERBOSE\n Log.info(\"connecting to #{PAGERDUTY_INCIDENTS_API}\")\n\n res = RestClient.post PAGERDUTY_INCIDENTS_API, @jdata, :content_type => :json, :accept => :json\n result = JSON.parse(res)\n unless result['status'] == 'success'\n Log.fatal(\"Failure to send data to pagerduty, result: #{result['status']}\")\n Log.fatal(\"Message response: #{result['message']}\")\n fail(\"Could not send to Pagerduty, result: #{result['status']}\")\n else \n Log.info(\"Pagerduty status: #{result['status']}\")\n Log.info(\"Pagerduty incident_key: #{result['incident_key']}\")\n Log.info(\"Pagerduty message: #{result['message']}\") if VERBOSE\n end\n end",
"def create\n @onske = Onske.new(params[:onske])\n\n respond_to do |format|\n if @onske.save\n format.html { redirect_to @onske, notice: 'Onske was successfully created.' }\n format.json { render json: @onske, status: :created, location: @onske }\n else\n format.html { render action: \"new\" }\n format.json { render json: @onske.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @profile = Profile.find(params[:profile_id])\n @joke = @profile.jokes.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @joke }\n end\n end",
"def create\n @joke = Joke.new(params[:joke].except(:tags))\n str_tags = params[:joke][:tags].split(',')\n @tags = str_tags.map {|tag_name|\n Tag.find_or_create_by_name(tag_name)\n }\n @joke.user = current_user\n @joke.tags = @tags\n \n respond_to do |format|\n if @joke.save\n format.html { redirect_to @joke, :notice => 'Joke was successfully created.' }\n format.json { render :json => @joke, :status => :created, :location => @joke }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @joke.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @messege = Messege.new(params[:messege])\n\n respond_to do |format|\n if @messege.save\n format.html { redirect_to @messege, notice: 'Messege was successfully created.' }\n format.json { render json: @messege, status: :created, location: @messege }\n else\n format.html { render action: \"new\" }\n format.json { render json: @messege.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n reviews = []\n params[:scores].keys.each{ |name|\n score = params[:scores][name]\n peer_review = PeerReview.new(name:name, score:score, miniproject_id:params[:project][:id])\n peer_review.save\n reviews << peer_review\n }\n\n render json: reviews\n\n end",
"def create\n # @nanny_job = NannyJob.new(nanny_job_params)\n @nanny_job = current_user.nanny_jobs.build(nanny_job_params)\n\n respond_to do |format|\n if @nanny_job.save\n format.html { redirect_to @nanny_job, notice: 'Nanny job was successfully created.' }\n format.json { render :show, status: :created, location: @nanny_job }\n else\n format.html { render :new }\n format.json { render json: @nanny_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @objective = @goal.objectives.create(objective_params)\n render json: @objective\n end",
"def create\n @dumb_counter = DumbCounter.new(dumb_counter_params)\n\n respond_to do |format|\n if @dumb_counter.save\n format.html { redirect_to @dumb_counter, notice: 'Dumb counter was successfully created.' }\n format.json { render :show, status: :created, location: @dumb_counter }\n else\n format.html { render :new }\n format.json { render json: @dumb_counter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @notification_count = NotificationCount.new(notification_count_params)\n\n if @notification_count.save\n render json: @notification_count, status: :created, location: @notification_count\n else\n render json: @notification_count.errors, status: :unprocessable_entity\n end\n end",
"def create\n @joke = current_user.jokes.build(joke_params)\n if @joke.save\n upvote_on_post\n redirect_to @joke\n else\n render 'new'\n end\n end",
"def create\n @showdown = Showdown.new(showdown_params)\n if params.has_key?(:contestant)\n contestants = []\n params[:contestant].each_with_index do |contestant, index|\n if Contestant.where(name: contestant).count > 0\n contestants << Contestant.where(name: contestant).first\n else\n contestant = Contestant.create(name: contestant)\n contestant.portrait_url = JSON.parse(params[\"portrait#{index + 1}\"])[0]['url']\n if contestant.save\n contestants << contestant\n end\n end\n end\n if params.has_key?(:stats)\n params[:stats].each do |index, stat_row|\n stat = Stat.create(showdown: @showdown, description: stat_row[:description])\n ContestantStat.create(stat: stat, value: stat_row[:contestant1], contestant: contestants.first)\n ContestantStat.create(stat: stat, value: stat_row[:contestant2], contestant: contestants.last)\n end\n end\n @showdown.contestants = contestants\n end\n\n respond_to do |format|\n if @showdown.save\n format.html { redirect_to @showdown, notice: 'Showdown was successfully created.' }\n format.json { render :show, status: :created, location: @showdown }\n else\n format.html { render :new }\n format.json { render json: @showdown.errors, status: :unprocessable_entity }\n end\n end\n end",
"def jornada_params\n params.require(:jornada).permit(:jornada)\n end",
"def create\n @enroll = Enroll.new(params[:enroll])\n @enroll.view =0\n if @enroll.save\n render json: JSON.parse(@enroll.to_json)\n else\n render json: JSON.parse(@enroll.errors.to_json)\n end\n end",
"def create\n answer = Answer.new(content: params[:content], upvotes: 0, downvotes:0, user_id: params[:user_id], question_id: params[:question_id])\n \n if answer.save\n render json: {answer: answer, create_time: (answer.created_at.to_f * 1000).to_i, success: true}\n else\n render json: @answer.errors, success: false\n end\n end",
"def create\n\n @jour = current_user.jours.new(jour_params)\n\n respond_to do |format|\n if @jour.save\n format.html { redirect_to jours_url, notice: 'Jour was successfully created.' }\n format.json { render :show, status: :created, location: @jour }\n else\n format.html { render :new }\n format.json { render json: @jour.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_badge = UserBadge.new(user_badge_params)\n @user_badge.active = true\n @user_badge.user_id = @user.id\n\n respond_to do |format|\n if @user_badge.save\n format.html { redirect_to team_user_path(@team, @user), notice: 'User badge was successfully created.' }\n format.json { render :show, status: :created, location: @user_badge }\n else\n format.html { render :new }\n format.json { render json: @user_badge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new\n @message.create_one!(params[:message])\n #Juggernaut.publish(1, parse_chat_message(params[:message][:message], current_user))\n respond_to do |format|\n format.html { redirect_to :index }\n format.js\n end\n end",
"def update\n respond_to do |format|\n if Nudge.where(:nudge_token => params[:nudge_token], :user_id => params[:user_id]).first.update(:response => params[:response])\n # Find asking user\n asking_nudge = Nudge.where(:nudge_token => params[:nudge_token], :response => -1).first\n\n # Send push notification\n response = ''\n if params[:response] == \"1\"\n response = 'Yes, ' + Pet.find(asking_nudge.pet_id).name + ' is fed.'\n elsif params[:response] == \"2\"\n response = 'No, ' + Pet.find(asking_nudge.pet_id).name + \" isn't fed.\"\n elsif params[:response] == \"3\"\n response = \"I don't know if \" + Pet.find(asking_nudge.pet_id).name + ' is fed.'\n end\n\n @apn = Houston::Client.development\n device_token = User.find(asking_nudge.user_id).device.device_token\n notification = Houston::Notification.new(device: device_token)\n notification.alert = User.find(params[:user_id]).first_name + ' responded: ' + response\n notification.sound = 'sosumi.aiff'\n notification.custom_data = { nudge_id: @nudge.id, nudge_token: @nudge.nudge_token, response: params[:response] }\n @apn.push(notification)\n\n format.json { render :show, status: :ok, location: @nudge }\n else\n format.json { render json: @nudge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @proxy_votes_collected = ProxyVotesCollected.new(proxy_votes_collected_params)\n\n respond_to do |format|\n if @proxy_votes_collected.save\n format.html { redirect_to @proxy_votes_collected, notice: 'Proxy votes collected was successfully created.' }\n format.json { render :show, status: :created, location: @proxy_votes_collected }\n else\n format.html { render :new }\n format.json { render json: @proxy_votes_collected.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @adj = Adj.new(adj_params)\n\n respond_to do |format|\n if @adj.save\n format.html { redirect_to @adj, notice: 'Adj was successfully created.' }\n format.json { render :show, status: :created, location: @adj }\n else\n format.html { render :new }\n format.json { render json: @adj.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @neighborhood = Neighborhood.new(neighborhood_params)\n if @neighborhood.threshold.nil?\n @neighborhood.threshold = 100\n end\n @neighborhood.users << current_user\n @neighborhood.leads << current_user\n misc = Category.new()\n misc.name = 'Miscellaneous'\n misc.description = 'Default Category'\n @neighborhood.categories << misc\n if @neighborhood.save\n set_active\n else\n respond_to do |format|\n format.html { redirect_to neighborhoods_url }\n end\n end\n # respond_to do |format|\n # if @neighborhood.save\n # format.html { redirect_to @neighborhood, notice: 'Neighborhood was successfully created.' }\n # format.json { render :show, status: :created, location: @neighborhood }\n # else\n # format.html { render :new }\n # format.json { render json: @neighborhood.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @announcement = Announcement.new({title: params[:title], description: params[:description], price: params[:price], photo: params[:photo], user_id: params[:user_id], latitude: params[:latitude], longitude: params[:longitude], subcategory_id: params[:subcategory_id], place: params[:place]})\n @announcement.save\n render json:@announcement\n end",
"def create\n @idea = Idea.find(params[:idea_id])\n @vote = @idea.votes.new(params[:vote])\n @vote.username = current_user.to_s\n respond_to do |format|\n if @vote.save \n format.json { render json: @vote, status: :created, location: @vote }\n else \n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n # call to create will generate a new post with these information and on this aspect\n text=params[:text]\n logger.info('activities_controller.new [text] '+text)\n # OLD # message = {'status_message'=>{'text'=>text},'aspect_name' => params[:id]}\n # OLD # @response =JSON.parse(current_user.access_token.token.post('/api/v0/posts/new', message))\n if (text.include?(\" enter \") || text.include?(\" leave \"))\n user = text.split[0] # split already separates using spaces between words\n domain = \"@idea.itu.dk:3000\"\n mention = \"@{\"+user+\"; \"+user+domain+\"}\" \n text_el = text.split\n msg = mention + \" \"+ text_el[1]+\" \"+text_el[2]\n else\n msg=text\n end \n message = {'status_message'=>{'text'=>msg},'aspect_name' => params[:id],'tag'=> params[:id]}\n @response =JSON.parse(current_user.access_token.token.post('/api/v0/create', message))\n \n\n\n # Generate a post on the genie hub\n # POST http://tiger.itu.dk:8004/informationbus/publish\n # (form encoded)\n # event=<event>\n getConn\n event = {\"activity\"=>params[:id],\"actor\"=>current_user.diaspora_id.split('@')[0],\"content\"=>text,\"timestamp\"=>\"\",\"generator\"=>\"server\"}.to_json\n @gh_respons = @conn.post '/informationbus/publish', {:event=>event}\n \n @status_message = @response\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}#{render json: @response}\n end\n \n end",
"def create\n # @alert_message = \"Meter Maid is around.\"\n @sighting = current_user.sightings.build(sighting_params)\n # @sighting.notify\n respond_to do |format|\n\n # send_message(\"+17049955069\", @alert_message)\n\n if @sighting.save\n\n format.html { redirect_to @sighting, notice: 'Sighting was successfully created.' }\n format.json { render :show, status: :created, location: @sighting }\n\n ################################################################\n @sighting.alert_users(InterestLocation.all)\n \n # users = @sighting.target_users(post_array, locations)\n # @sighting.send_email(users)\n ################################################################\n else\n format.html { render :new }\n format.json { render json: @sighting.errors, status: :unprocessable_entity }\n end\n end\n\n\n end",
"def create\n @metric = Metric.new(params[:metric])\n\n if @metric.save\n render json: @metric, status: :created, location: @metric\n else\n render json: @metric.errors, status: :unprocessable_entity\n end\n end",
"def random_judge()\n @judges[rand(@judges.length)]\n end",
"def submitSessionLabels\n # check if data submission is offline\n is_offline_sensor_data_collection = false\n\n # not having valid device id or device type. \n if (\n params.has_key?(:uid) && (params[:uid].empty? == false)\n )\n @deviceType = nil\n if (\n params.has_key?(:did) == false || params[:did].empty? || \n params.has_key?(:dtype) == false || params[:dtype].empty? ||\n (@deviceType = DeviceType.where(name: params[:dtype]).first) == nil || \n params.has_key?(:experiment_id) == false || params[:experiment_id].empty? ||\n (@experiment = UteExperiment.where(:experiment_code => params[:experiment_id], :is_active => true).first) == nil\n ) \n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n if (\n params.has_key?(:label_info) == false || params[:label_info].empty? || \n params[:label_info][:data].kind_of?(Array) == false || params[:label_info][:data].count == 0\n )\n render json: { 'status' => 'OK' }.to_json\n end\n\n # check device pairing. \n @deviceId = params[:did]\n if isPairedDeviceValid(@deviceId, params[:uid]) == false\n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n # check if devicepairconnotp is not expired yet\n @devicepairconnections = @devicepairs.ute_device_pair_connections.where(\n :expire_by.gte => Time.now.getutc.to_f, \n :is_active => true\n )\n firststartdate = params[:label_info][:data][0][:t_start]\n @devicepairconnections.each do |devicepairconnection|\n si = devicepairconnection.ute_ex_session\n if si != nil\n if firststartdate > si.range_start_at && firststartdate < si.range_end_at \n #found the paired connection\n @devicepairconnection = devicepairconnection\n break\n end\n end\n\n if @devicepairconnection == nil || @devicepairconnection.ute_ex_session == nil \n #session to pair is not found\n render json: { 'status' => 'FAILED', 'code' => 404 }.to_json\n return\n end\n end\n\n if @devicepairconnection == nil\n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n @session = @devicepairconnection.ute_ex_session\n @sessionId = @session.session_code\n\n if @session\n @sessionConnection = @session.ute_ex_session_connections.create!(device_id: @deviceId, device_model: params[\"model\"], device_type: @deviceType.id, is_active: true, connected_at: params[:label_info][:data][0][:t_start])\n\n is_offline_sensor_data_collection = true\n end\n end \n\n if isDataSubmissionInvalidForExpAndSession(request, params) \n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n UteDataSubmissionService.delay.handleintervallabels(@session, @sessionConnection, params)\n\n if is_offline_sensor_data_collection\n render json: { 'status' => 'OK', 'session_id' => @session.session_code }.to_json\n else\n render json: { 'status' => 'OK' }.to_json\n end\n end",
"def create\n sheeps = params[:sheeps]\n return if params_are_empty(sheeps)\n \n @activity = Activity.new date: convert_date_to_i(params[:date]), comment: params[:comment], a_type: params[:type_of_a], total_costs:params[:total_costs], location: 'farma'\n sheeps.each do |p|\n @vacination = Vacination.new sheep_id:p[:sheep_id], reason: params[:reason], vaccin_name: params[:vaccin_name]\n @activity.vacinations.push(@vacination)\n end\n \n respond_to do |format|\n if @activity.save\n desrtoy_activity(params[:activity_id])\n format.html { redirect_to '/vacinations/'+ @activity.id.to_s, notice: 'Vacination was successfully created.' }\n format.json { render action: 'show', status: :created, location: @vacination }\n else\n format.html { render action: 'new' }\n format.json { render json: @vacination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def online\n current_user.online!\n render :juggernaut do |page|\n page.go_online current_user\n end\n render :nothing => true \n end",
"def create\n @janken = Janken.new(janken_params)\n @janken.hand = params[:commit]\n @janken.name = '名無しさん' if @janken.name == \"\"\n @janken.room = 1 unless @janken.room\n\n respond_to do |format|\n if @janken.save\n\n\t# 対戦相手を取得\n\t@enemy = @janken.previous if @janken.previous\n\n\t@result = @janken.judge\n\n format.html { render :result, notice: 'Janken was successfully created.' }\n format.json { render :index, status: :created, location: @janken }\n else\n format.html { render :new }\n format.json { render json: @janken.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @advertisement = current_user.advertisements.new(advertisement_params)\n @advertisement.status = INACTIVE\n respond_to do |format|\n if @advertisement.save\n \n format.html { redirect_to @advertisement, notice: 'Advertisement was successfully created.' }\n format.json { render :show, status: :created, location: @advertisement }\n message = \"Heyy new advertisement: #{@advertisement.title} is added by #{current_user.user_profile.name}\"\n User.get_customer_dealer(message)\n else\n format.html { render :new }\n format.json { render json: @advertisement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @answer = current_user.answers.build(params[:answer])\n if @answer.save\n @post = @answer.post\n Notifier.delay.new_answer(@post.user, @answer)\n if @post.user != current_user\n current_user.update_attributes(cred_count: current_user.cred_count + 10)\n end\n return render status: 200, json: { success: true }\n else\n return render :status => :unprocessable_entity,\n :json => { success: false, :error => \"There was a problem posting your advice.\" }\n end\n end",
"def new\n @badge = Badge.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @badge }\n end\n end",
"def create\n puts \"==========================\"\n puts \"CREATE\"\n JSON[params[\"updates\"].read].each do |notification|\n user = User.find(notification[\"subscriptionId\"])\n if user\n case notification[\"collectionType\"]\n when \"sleep\"\n user.fitbit.client.sleep_on_date(notification[\"date\"])[\"sleep\"].each do |data|\n sleep_event = { user_id: notification[\"subscriptionId\"], provider: params[:app_id], body: data }\n sleep_logger.info sleep_event\n end\n end\n end\n end\n render text: \"\", status: 204\n end",
"def create\n @api_v1_answer_upvote = Api::V1::AnswerUpvote.new(api_v1_answer_upvote_params)\n\n respond_to do |format|\n if @api_v1_answer_upvote.save\n format.html { redirect_to @api_v1_answer_upvote, notice: 'Answer upvote was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_answer_upvote }\n else\n format.html { render :new }\n format.json { render json: @api_v1_answer_upvote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @jornada = Jornada.new(params[:jornada])\n\n respond_to do |format|\n if @jornada.save\n format.html { redirect_to jornadas_path, notice: 'La jornada se ha creado correctamente' }\n format.json { render json: @jornada, status: :created, location: @jornada }\n else\n format.html { render action: \"new\" }\n format.json { render json: @jornada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_answer_votes\n\t\tif @answer.vote_not_present?(current_user)\n vote = @answer.votes.new\n vote.user = current_user\n end\n if vote.save\n render json: { success: true,message: \"Vote Successfully Created.\"},:status=>200\n else\n render :json=> { success: false, message: \"Answers are not present\" },:status=> 203\n end\n\tend",
"def add_badge(badge_id)\n badges = JSON.parse(self.badges)\n badges[\"#{badge_id}\"][\"earned\"] = true\n badges[\"#{badge_id}\"][\"earn_date\"] = Date.current\n self.update(badges: badges.to_json)\n end",
"def upcoming_interviews\n future_interviews_count = @interviewer.upcoming_interviews.count\n if [1, 2].include? future_interviews_count\n render json: @interviewer\n else\n render json: {error: \"No Upcoming Interviews found\"}, status: 404\n end\n end",
"def send_notification(message, title = nil, url = nil, label = nil)\n response = JSON.parse(User.notifo.send_notification(self.username, message, title, url, label))\n if response[\"response_code\"] == Pachube::NOTIFO_OK\n # increment global counters\n db.transaction do\n db[:statistics].filter(:id => 1).update(:monthly_count => :monthly_count + 1, :total_count => :total_count + 1)\n # increment count on user record\n db[:users].filter(:username => self.username).update(:message_count => :message_count + 1, :monthly_message_count => :monthly_message_count + 1)\n end\n end\n response\n end",
"def create\n params[:interview][:scheduler_id] = current_user.id\n @interview = @candidate.interviews.new(params[:interview])\n params[:other_interviewers].split(\",\").each do |interviewer|\n @interview.interviewers.new({:user_id => interviewer})\n end\n respond_to do |format|\n if @interview.save\n format.html { redirect_to candidate_path(@candidate), notice: 'Interview was successfully created.' }\n format.js { render :index }\n format.json { render json: @interview, status: :created, location: @interview }\n else\n format.html { render action: \"new\" }\n format.js { render :index }\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n ip = remote_ip\n geolocation_data = RestClient.get \"freegeoip.net/json/#{ip}\"\n @geolocation_data = JSON.parse(geolocation_data, :symbolize => true) \n if @short_url.present? \n short_visit = @short_url.short_visits.create(visitor_ip: geolocation_data[\"ip\"], visitor_city: geolocation_data[\"city\"],visitior_state: geolocation_data[\"country_name\"],visitor_country_iso: geolocation_data[\"country_code\"])\n render json: { short_visit: short_visit, status: \"Created\" } \n else\n render json: { errors: \"something went wrong\" , status: \"failed\" } \n end \n end",
"def postlikes\n render json: @likes.length, status: 200\n end",
"def create\n @jiankong = Jiankong.new(jiankong_params)\n\n respond_to do |format|\n if @jiankong.save\n format.html { redirect_to @jiankong, notice: 'Jiankong was successfully created.' }\n format.json { render :show, status: :created, location: @jiankong }\n else\n format.html { render :new }\n format.json { render json: @jiankong.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gongjijin = Gongjijin.new(gongjijin_params)\n\n respond_to do |format|\n if @gongjijin.save\n format.html { redirect_to @gongjijin, notice: 'Gongjijin was successfully created.' }\n format.json { render :show, status: :created, location: @gongjijin }\n else\n format.html { render :new }\n format.json { render json: @gongjijin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @judgement = Judgement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @judgement }\n end\n end",
"def new\n @judgement = Judgement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @judgement }\n end\n end",
"def create\n @minnpaku = Minnpaku.new(minnpaku_params)\n\n respond_to do |format|\n if @minnpaku.save\n format.html { redirect_to @minnpaku, notice: 'Minnpaku was successfully created.' }\n format.json { render :show, status: :created, location: @minnpaku }\n else\n format.html { render :new }\n format.json { render json: @minnpaku.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n msg = params[:msg]\n # @post = Post.new(params[:post])\n @current_user= current_user\n\n # call to create will generate a new post with these information and on this aspect\n message = {'status_message'=>{'text'=>msg},'aspect_ids' => '9'}\n @status_message =JSON.parse(current_user.access_token.token.post(\n '/api/v0/create', message))\n \n\n respond_to do |format|\n if @status_message.status.equals(\"201\")\n format.html { render action: \"done\" }\n # if @post.save\n # format.html { redirect_to @post, notice: 'Post was successfully created.' }\n # format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @advertisement = current_user.advertisements.build(advertisement_params)\n @advertisement.state = \"waiting\"\n\n respond_to do |format|\n if @advertisement.save\n format.html { redirect_to @advertisement, notice: 'Advertisement was successfully created.' }\n format.json { render :show, status: :created, location: @advertisement }\n else\n format.html { render :new }\n format.json { render json: @advertisement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gudang = Gudang.new(gudang_params)\n\n respond_to do |format|\n if @gudang.save\n format.html { redirect_to @gudang, notice: 'Gudang was successfully created.' }\n format.json { render :show, status: :created, location: @gudang }\n else\n format.html { render :new }\n format.json { render json: @gudang.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.58430684",
"0.5757473",
"0.56651497",
"0.54522693",
"0.5367972",
"0.5334164",
"0.5315734",
"0.5271995",
"0.5180628",
"0.51660585",
"0.51344687",
"0.50466317",
"0.50420463",
"0.5015169",
"0.4998017",
"0.49963892",
"0.4977875",
"0.491329",
"0.4897295",
"0.4892257",
"0.48823705",
"0.484564",
"0.48408076",
"0.48379922",
"0.4833824",
"0.48302633",
"0.48274556",
"0.48220617",
"0.48144788",
"0.48140988",
"0.48140988",
"0.48112494",
"0.48109978",
"0.48014238",
"0.47984305",
"0.47931266",
"0.47783795",
"0.4777338",
"0.47768113",
"0.4773561",
"0.47688028",
"0.4763597",
"0.47568396",
"0.4750749",
"0.4747649",
"0.47474647",
"0.47461092",
"0.47397694",
"0.47320718",
"0.47292992",
"0.47288015",
"0.4728734",
"0.47245035",
"0.47225696",
"0.47220019",
"0.4717502",
"0.4714769",
"0.47143307",
"0.47121775",
"0.47046632",
"0.46996588",
"0.4669811",
"0.46694222",
"0.46638507",
"0.46629715",
"0.46578735",
"0.46560606",
"0.46522373",
"0.46490335",
"0.46435204",
"0.46382612",
"0.46359748",
"0.46357235",
"0.46235755",
"0.46187514",
"0.46106827",
"0.4609315",
"0.4608434",
"0.46083292",
"0.46082792",
"0.46077204",
"0.4607388",
"0.46069115",
"0.4606808",
"0.46058786",
"0.4604653",
"0.46039757",
"0.46039444",
"0.46002215",
"0.45980805",
"0.45905438",
"0.45901904",
"0.45900673",
"0.4589731",
"0.45896587",
"0.45879743",
"0.45872614",
"0.45871928",
"0.4584674",
"0.45833206"
] |
0.5990504
|
0
|
PATCH/PUT /online_judges/1 PATCH/PUT /online_judges/1.json
|
def update
respond_to do |format|
if @online_judge.update(online_judge_params)
format.html { redirect_to current_user, notice: 'Online judge was successfully updated.' }
format.json { render :show, status: :ok, location: @online_judge }
else
format.html { render :edit }
format.json { render json: @online_judge.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @badge = Badge.find(params[:id])\n\n respond_to do |format|\n if @badge.update_attributes(params[:badge])\n format.html { redirect_to @badge, notice: 'Badge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @badge.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 respond_to do |format|\n if @badge.update(badge_params)\n format.html { redirect_to @badge, notice: 'Badge was successfully updated.' }\n format.json { render :show, status: :ok, location: @badge }\n else\n format.html { render :edit }\n format.json { render json: @badge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @judge_activity.update(judge_activity_params)\n format.html { redirect_to @judge_activity, notice: 'Judge activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @judge_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @jam = Jam.find(params[:id])\n if params[:vote] == 'up'\n @jam.up_votes = @jam.up_votes + 1\n @jam.save\n elsif params[:vote] == 'down'\n @jam.down_votes = @jam.down_votes + 1\n @jam.save\n end\n respond_to do |format|\n if @jam.update_attributes(params[:jam])\n format.html { redirect_to @jam, notice: params }\n format.js\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jam.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 @judge.update(permitted_attributes(Judge))\n format.html { redirect_to @judge, notice: I18n.t('controllers.updated', model: Judge.model_name.human) }\n format.json { render :show, status: :ok, location: @judge }\n else\n format.html { render :edit }\n format.json { render json: @judge.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 get_my_badge\n respond_to do |format|\n if @my_badge.update_attributes(params[:my_badge])\n flash[:notice] = 'Your badge was successfully updated.'\n format.html { redirect_to user_my_badge_url(@my_badge) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @my_badge.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @onske = Onske.find(params[:id])\n\n respond_to do |format|\n if @onske.update_attributes(params[:onske])\n format.html { redirect_to @onske, notice: 'Onske was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @onske.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @kickoff = Kickoff.find(params[:id])\n\n respond_to do |format|\n if @kickoff.update_attributes(params[:kickoff])\n format.html { redirect_to @kickoff, notice: 'Kickoff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kickoff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end",
"def update\n respond_to do |format|\n if @jj.update(jj_params)\n format.html { redirect_to @jj, notice: 'Jj was successfully updated.' }\n format.json { render :show, status: :ok, location: @jj }\n else\n format.html { render :edit }\n format.json { render json: @jj.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gauge = Gauge.find(params[:id])\n\n respond_to do |format|\n if @gauge.update_attributes(params[:gauge])\n format.html { redirect_to @gauge, notice: 'Gauge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gauge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @judge.update(judge_params)\n format.html { redirect_to @judge, notice: 'Judge was successfully updated.' }\n format.json { render :show, status: :ok, location: @judge }\n else\n format.html { render :edit }\n format.json { render json: @judge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @diet.update(diet_params)\n head :no_content, status: 204\n else\n render json: @diet.errors, status: 422\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @unidade_metrica = UnidadeMetrica.find(params[:id])\n\n respond_to do |format|\n if @unidade_metrica.update_attributes(params[:unidade_metrica])\n format.html { redirect_to unidade_metricas_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @unidade_metrica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @uginuce.sheep.id!= params[:uginuce][:sheep_id].to_i\n @old_sheep = Sheep.find_by id: @uginuce.sheep_id\n @old_sheep.update status:'na farmi'\n @new_sheep = Sheep.find_by id: params[:uginuce][:sheep_id]\n @new_sheep.update status:'uginulo'\n end\n \n @uginuce.activity.update date: convert_date_to_i(params[:uginuce_date]), comment:params[:uginuce_comment]\n respond_to do |format|\n if @uginuce.update(uginuce_params)\n format.html { redirect_to @uginuce, notice: 'Uginuce was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @uginuce.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if @penalty.update(penalty_params)\n\n render json: @penalty,status: :ok\n\n else\n\n render json: {error: true,errors: @penalty.errors},status: :unprocessable_entity\n\n end\n\n \t\tend",
"def update\n respond_to do |format|\n if Nudge.where(:nudge_token => params[:nudge_token], :user_id => params[:user_id]).first.update(:response => params[:response])\n # Find asking user\n asking_nudge = Nudge.where(:nudge_token => params[:nudge_token], :response => -1).first\n\n # Send push notification\n response = ''\n if params[:response] == \"1\"\n response = 'Yes, ' + Pet.find(asking_nudge.pet_id).name + ' is fed.'\n elsif params[:response] == \"2\"\n response = 'No, ' + Pet.find(asking_nudge.pet_id).name + \" isn't fed.\"\n elsif params[:response] == \"3\"\n response = \"I don't know if \" + Pet.find(asking_nudge.pet_id).name + ' is fed.'\n end\n\n @apn = Houston::Client.development\n device_token = User.find(asking_nudge.user_id).device.device_token\n notification = Houston::Notification.new(device: device_token)\n notification.alert = User.find(params[:user_id]).first_name + ' responded: ' + response\n notification.sound = 'sosumi.aiff'\n notification.custom_data = { nudge_id: @nudge.id, nudge_token: @nudge.nudge_token, response: params[:response] }\n @apn.push(notification)\n\n format.json { render :show, status: :ok, location: @nudge }\n else\n format.json { render json: @nudge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @badge = Badge.find(params[:id])\n respond_to do |format|\n if @badge.update_attributes(params[:badge])\n flash[:notice] = 'Badge was successfully updated.'\n format.html { redirect_to organization_segment_badge_url(@organization,@segment, @badge) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @badge.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @badge.update(badge_params)\n format.html { redirect_to([:admin, @badge], notice: 'Badge was successfully updated.') }\n format.xml { head :ok }\n website.add_log(user: current_user, action: \"Updated badge: #{@badge.name}\")\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @badge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @metric = Metric.find(params[:id])\n\n if @metric.update(params[:metric])\n head :no_content\n else\n render json: @metric.errors, status: :unprocessable_entity\n end\n end",
"def update\n @heartbeat = Heartbeat.find(params[:id])\n\n if @heartbeat.update(heartbeat_params)\n head :no_content\n else\n render json: @heartbeat.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @game_judge.update(game_judge_params)\n format.html { redirect_to @game_judge, notice: 'Game judge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game_judge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @unlimited.update(unlimited_params)\n format.html { redirect_to @unlimited, notice: 'Unlimited was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @unlimited.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend",
"def update\n render json: @tag.errors unless @tag.update(tag_params)\n end",
"def update\n if params[:kid][:id]\n @kid = Kid.find(params[:kid][:id])\n else\n @kid = Kid.find_by_user_id_and_local_id(params[:kid][:user_id],params[:kid][:local_id])\n end\n params[:kid].delete(:user_id)\n params[:kid].delete(:id)\n if @kid.update_attributes(params[:kid])\n render json: @kid\n else\n render json: @kid.errors, status: :unprocessable_entity\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update\n @online_answer = OnlineAnswer.find(params[:id])\n\n respond_to do |format|\n if @online_answer.update_attributes(params[:online_answer])\n format.html { redirect_to @online_answer, notice: 'Online answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @online_answer.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 render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n @badge = Badge.find_by_key(params['id'])\n @badge.approved_at = Time.now unless session[:admin]\n respond_to do |format|\n if @badge.update_attributes(params[:badge])\n format.html { redirect_to @badge, :notice => 'Badge was successfully updated.' }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def update\n message = Message.find(params[:id])\n message.update(message_params)\n render json: message\n end",
"def UpdateForum id,params = {}\n \n APICall(path: \"forums/#{id}.json\",method: 'PUT',payload: params.to_json)\n \n end",
"def update\n job = Job.find(params[:id])\n job.update_attributes(job_params)\n render json: job\n end",
"def update\n respond_to do |format|\n format.json { render json: { status: :not_implemented } }\n end\n end",
"def update\n respond_to do |format|\n if @status.update(isshared: params[:isshared])\n format.json { head :no_content }\n else\n format.json {\n render json: @status.errors,\n status: :unprocessable_entity\n }\n end\n end\n end",
"def update(model, id, opts = {})\n name = model_name(model)\n do_restful_action(\"update\", name) do\n self.nagyo[\"#{name}/#{URI.encode(id)}/edit\"].put(:format => :js, name => opts)\n end\n end",
"def update\n @client.update(client_params)\n render json: @client\n end",
"def update\n @v1_message = V1::Message.find(params[:id])\n\n if @v1_message.update(message_params)\n render json: @v1_message, status: :ok\n else\n render json: @v1_message.errors, status: :unprocessable_entity\n end\n end",
"def update\n @fucker = Fucker.find(params[:id])\n\n respond_to do |format|\n if @fucker.update_attributes(params[:fucker])\n format.json { head :no_content }\n else\n format.json { render json: @fucker.errors, status: :internal_server_error }\n end\n end\n end",
"def update\n @feat = @person.feats.find(params[:id])\n level_old = @person.level\n\n if params[:feat][:completed] == '1'\n @feat.complete\n else\n @feat.uncomplete\n end\n sign = params[:feat][:completed] == '1' ? '+': '-'\n \n has_leveled = @person.level > level_old\n\n respond_to do |format|\n format.json { render :json => {\n :xpGained => \"#{sign}#{@feat.xp}\",\n :xpTotal => @person.xp,\n :next_level_ratio => @person.next_level_ratio,\n :extra_life => @person.level_to_string,\n :has_leveled => has_leveled,\n :completed => @feat.completed,\n :streak => @feat.calculate_streak}}\n \n end\n\n end",
"def update\n params.require(:id)\n msg = Message.find(params[:id])\n msg.read = true\n msg.save\n render :json => msg.as_json, status: :ok\n end",
"def update\n @heartbeat = Heartbeat.find(params[:id])\n\n respond_to do |format|\n if @heartbeat.update_attributes(params[:heartbeat])\n format.html { redirect_to @heartbeat, notice: 'Heartbeat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @heartbeat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format|\n if @giang_vien.update_attributes(params[:giang_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @giang_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @messege = Messege.find(params[:id])\n\n respond_to do |format|\n if @messege.update_attributes(params[:messege])\n format.html { redirect_to @messege, notice: 'Messege was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @messege.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @kolegij = Kolegij.find(params[:id])\n\n respond_to do |format|\n if @kolegij.update_attributes(params[:kolegij])\n format.html { redirect_to @kolegij, notice: 'Kolegij was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kolegij.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mechon.update(mechon_params)\n format.html { redirect_to @mechon, notice: 'Mechon was successfully updated.' }\n format.json { render :show, status: :ok, location: @mechon }\n else\n format.html { render :edit }\n format.json { render json: @mechon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if User.update(current_user.id, :game_id => params[:id])\n format.json { head :no_content }\n end\n end\n end",
"def update\n respond_to do |format|\n if @minor.update(minor_params)\n format.html { redirect_to :show, notice: 'Minor was successfully updated.' }\n format.json { render :show, status: :ok, location: @minor }\n else\n format.html { render :edit }\n format.json { render json: @minor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @diet = @profile.diets.find(params[:id])\n\n if @diet.update_attributes(params[:diet])\n redirect_to profile_diets_url, notice: 'Diet was successfully updated.'\n else\n render json: @diet.errors, status: :unprocessable_entity\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @kolegiji = Kolegiji.find(params[:id])\n\n respond_to do |format|\n if @kolegiji.update_attributes(params[:kolegiji])\n format.html { redirect_to @kolegiji, notice: 'Kolegiji was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kolegiji.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render status: 501, json: { errors: ['Action not implemented yet!'] }\n end",
"def update\n mk = connect_mikrotik\n respond_to do |format|\n\n \n @plan_old = @plan.as_json # Guarda os parâmetros antigos do registro para retornar caso não consiga mudar no mikrotik\n \n id = mk.get_reply(\"/ppp/profile/print\", \"?name=#{@plan.profile_name}\")[0][\".id\"]\n puts \"Id do registro a ser mudado\"\n puts id\n\n if @plan.update(plan_params)\n \n result = mk.get_reply(\"/ppp/profile/set\",\n \"=name=#{plan_params[\"profile_name\"]}\",\n \"=rate-limit=#{plan_params[\"rate_limit\"]}\",\n \"=.id=#{id}\")[0][\"message\"]\n\n @notice = 'Plan was successfully updated.'\n if result != nil\n @notice = \"It wasn't possible to update mikrotik\"\n @plan.update(@plan_old)\n end\n\n format.html { redirect_to @plan, notice: @notice }\n format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_interview = Interview.find(params[:id])\n\n respond_to do |format|\n if @admin_interview.update_attributes(params[:interview])\n format.html { redirect_to [:admin, @admin_interview], notice: 'Entrevista atualizada com sucesso' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: [:admin, @admin_interview.erros], status: :unprocessable_entity }\n end\n end\n end",
"def meeting_update_status(*args)\n options = Zoom::Params.new(Utils.extract_options!(args))\n options.require(%i[meeting_id])\n Utils.parse_response self.class.put(\"/meetings/#{options[:meeting_id]}/status\", body: options.except(:meeting_id).to_json, headers: request_headers)\n end",
"def update\n @judgement = Judgement.find(params[:id])\n\n respond_to do |format|\n if @judgement.update_attributes(params[:judgement])\n format.html { redirect_to @judgement, notice: 'Judgement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @judgement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @judgement = Judgement.find(params[:id])\n\n respond_to do |format|\n if @judgement.update_attributes(params[:judgement])\n format.html { redirect_to @judgement, notice: 'Judgement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @judgement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end",
"def update\n respond_to do |format|\n if @jednani.update(jednani_params)\n format.html { redirect_to @jednani, notice: 'Jednani was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @jednani.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@user = User.find(params[:id])\n \n if @trainer.update(trainer_params)\n render json: @trainer\n else\n render json: @trainer.errors, status: :unprocessable_entity\n end\nend",
"def update\n if @niche.update(processed_params)\n render json: { status: 'ok' }\n else\n render json: { status: @niche.errors.to_a.join('base') }\n end\n end",
"def update\n @mood = Mood.find(params[:id])\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n if @mood.update_attributes(params[:mood])\n format.json { head :ok }\n else\n format.json { render :xml => @mood.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 update\n respond_to do |format|\n if @jio.update(jio_params)\n format.html { redirect_to @jio, notice: 'Jio was successfully updated.' }\n format.json { render :show, status: :ok, location: @jio }\n else\n format.html { render :edit }\n format.json { render json: @jio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @big_emergency.update(big_emergency_params)\n format.html { redirect_to @big_emergency, notice: 'Big emergency was successfully updated.' }\n format.json { render :show, status: :ok, location: @big_emergency }\n else\n format.html { render :edit }\n format.json { render json: @big_emergency.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n notification = Notification.find(params[:id])\n notification.update(\n params.permit(:title, :description)\n )\n notification.active = false\n notification.save\n render json: notification\n end",
"def update\n @joke = Joke.find(params[:id])\n\n respond_to do |format|\n if @joke.update_attributes(params[:joke])\n format.html { redirect_to @joke, :notice => 'Joke was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @joke.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @testmonial = Testmonial.find(params[:id])\n\n if @testmonial.update(testmonial_params)\n head :no_content\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end",
"def update\n streak, success = jsonapi_update.to_a\n\n if success\n render_jsonapi(streak, scope: false)\n else\n render_errors_for(streak)\n end\n end",
"def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def update_cheer_up\n user = User.find(params[:id])\n updating_cheer_up = CheerUp.find(params[:cheer_up_id])\n updating_cheer_up.update(cheer_up_params)\n render json:\n {\n status: 200,\n user: user,\n cheer_ups: user.cheer_ups,\n updated_cheer_up: updating_cheer_up\n } # end render json\n end",
"def update\n @jamb = Jamb.find(params[:id])\n\n respond_to do |format|\n if @jamb.update_attributes(params[:jamb])\n format.html { redirect_to(@jamb, :notice => 'Jamb was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @jamb.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @jingle.update(jingle_params)\n format.html { redirect_to @jingle, flash: { notice: 'Jingle was successfully updated.' }}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @jingle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hail.update(hail_params)\n format.json { render :show, status: :ok, location: @hail }\n else\n format.json { render json: @hail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mueble.update(mueble_params)\n format.html { redirect_to @mueble, notice: 'Mueble was successfully updated.' }\n format.json { render :show, status: :ok, location: @mueble }\n else\n format.html { render :edit }\n format.json { render json: @mueble.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end"
] |
[
"0.5928994",
"0.59072495",
"0.5810702",
"0.58060664",
"0.580363",
"0.5769774",
"0.57471496",
"0.5739974",
"0.5702337",
"0.56777084",
"0.56761044",
"0.5673122",
"0.5670219",
"0.5668757",
"0.566013",
"0.5654656",
"0.56453514",
"0.56266946",
"0.5622915",
"0.5618859",
"0.5608668",
"0.56055",
"0.5597738",
"0.55899364",
"0.5584169",
"0.55826133",
"0.5580907",
"0.55559593",
"0.55427694",
"0.5540436",
"0.55147994",
"0.55098027",
"0.55098027",
"0.55098027",
"0.55080736",
"0.5505896",
"0.5505894",
"0.5500641",
"0.5497656",
"0.54947096",
"0.5494487",
"0.5493255",
"0.54896486",
"0.548312",
"0.5482027",
"0.5480854",
"0.5478747",
"0.5478405",
"0.5468721",
"0.546731",
"0.54649836",
"0.5462725",
"0.54582286",
"0.5456483",
"0.5456353",
"0.5452861",
"0.54502463",
"0.54501575",
"0.544277",
"0.5439055",
"0.54369575",
"0.5436568",
"0.543448",
"0.5432291",
"0.54290867",
"0.54290867",
"0.54256064",
"0.5423662",
"0.54174006",
"0.5417205",
"0.54162264",
"0.54140955",
"0.5412952",
"0.54106617",
"0.5410026",
"0.54094225",
"0.54063636",
"0.5403067",
"0.53986543",
"0.53985864",
"0.53960586",
"0.5391193",
"0.53911674",
"0.5384901",
"0.53778857",
"0.53778857",
"0.53778857",
"0.53778857",
"0.53778857",
"0.53778857",
"0.53778857",
"0.53778857",
"0.53778857",
"0.53778857",
"0.53778857",
"0.53778857",
"0.53778857",
"0.53778857",
"0.53778857",
"0.53778857"
] |
0.6276049
|
0
|
DELETE /online_judges/1 DELETE /online_judges/1.json
|
def destroy
@online_judge.destroy
respond_to do |format|
format.html { redirect_to current_user, notice: 'Online judge was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @nudge.destroy\n respond_to do |format|\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 @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to badges_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 delete\n api_client.delete(url)\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @gauge = Gauge.find(params[:id])\n @gauge.destroy\n\n respond_to do |format|\n format.html { redirect_to gauges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @judge_activity.destroy\n respond_to do |format|\n format.html { redirect_to judge_activities_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @unidade_metrica = UnidadeMetrica.find(params[:id])\n @unidade_metrica.destroy\n\n respond_to do |format|\n format.html { redirect_to unidade_metricas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @badge.destroy\n respond_to do |format|\n format.html { redirect_to(admin_badges_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted badge: #{@badge.name}\")\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 delete\n request(:delete)\n end",
"def destroy\n @badge.destroy\n respond_to do |format|\n format.html { redirect_to badges_url, notice: 'Badge was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @heartbeat = Heartbeat.find(params[:id])\n @heartbeat.destroy\n\n respond_to do |format|\n format.html { redirect_to heartbeats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @judge.destroy\n respond_to do |format|\n format.html { redirect_to judges_url, notice: 'Judge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unlimited.destroy\n respond_to do |format|\n format.html { redirect_to unlimiteds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uginuce.sheep.update status:'na farmi'\n @uginuce.destroy\n respond_to do |format|\n format.html { redirect_to uginuces_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @judge.destroy\n respond_to do |format|\n format.html { redirect_to judges_url, notice: I18n.t('controllers.destroyed', model: Judge.model_name.human) }\n format.json { head :no_content }\n end\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/meetings/#{shortcode_url}.json\"\n end",
"def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end",
"def destroy\n @game_judge.destroy\n respond_to do |format|\n format.html { redirect_to game_judges_url }\n format.json { head :no_content }\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 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 @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to(badges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to(organization_segment_badges_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n \n end",
"def delete\n api(\"Delete\")\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @judge = @competition.judges.find(params[:id])\n authorize @judge\n\n respond_to do |format|\n if @judge.destroy\n format.html { redirect_to competition_judges_path(@competition), notice: \"Judge Deleted\" }\n format.json { head :no_content }\n else\n flash[:alert] = \"Unable to delete judge\"\n format.html { redirect_to competition_judges_path(@competition) }\n format.json { head :no_content }\n end\n end\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @online_test.destroy\n respond_to do |format|\n format.html { redirect_to admin_online_tests_url, notice: 'Online test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(url)\n do_request(\"delete\", url)\n end",
"def delete\n delete_from_server single_url\n end",
"def destroy\n @metric = Metric.find(params[:id])\n @metric.destroy\n\n head :no_content\n end",
"def destroy\n @ai_contest = AiContest.find(params[:id])\n @ai_contest.destroy\n\n respond_to do |format|\n format.html { redirect_to ai_contests_url }\n format.json { head :no_content }\n end\n end",
"def delete_json(url)\n JSON.parse(delete(url, :json, :json))\n end",
"def delete\n supprimer = SondageService.instance.supprimerSondage(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\nend",
"def destroy\n @dataload_ga = DataloadGa.find(params[:id])\n @dataload_ga.destroy\n\n respond_to do |format|\n format.html { redirect_to dataload_gas_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 delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @jedi = Jedi.find(params[:id])\n @jedi.destroy\n\n respond_to do |format|\n format.html { redirect_to jedis_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aki_diagnosis.destroy\n respond_to do |format|\n format.html { redirect_to aki_diagnoses_url, notice: 'Diagnosis aki was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @jamaat = Jamaat.find(params[:id])\n @jamaat.destroy\n\n respond_to do |format|\n format.html { redirect_to jamaats_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @onske = Onske.find(params[:id])\n @onske.destroy\n\n respond_to do |format|\n format.html { redirect_to onskes_url }\n format.json { head :ok }\n end\n end",
"def delete\n\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @threshold = Threshold.find(params[:id])\n @threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to thresholds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def destroy\n @mensagem = Mensagem.find(params[:id])\n api_client.delete_object(@mensagem.post_id)\n @mensagem.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.js { head :ok }\n end\n end",
"def destroy\n @mk_missatge.destroy\n respond_to do |format|\n format.html { redirect_to mk_missatges_url, notice: 'Mk missatge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @health.destroy\n respond_to do |format|\n format.html { redirect_to \"/dashboard\" }\n format.json { head :no_content }\n end\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 delete\n end",
"def destroy\n @dice.destroy\n\n head :no_content\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n @uuid = params[:uuid]\n respond_to do |format|\n format.html { redirect_to :controller => 'ads', :action => 'admin_dash', :id => 1, :uuid => @uuid }\n format.json { head :no_content }\n end\n end",
"def delete\n \n end",
"def destroy\n @giang_vien = GiangVien.find(params[:id])\n @giang_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @jornada = Jornada.find(params[:id])\n @jornada.destroy\n\n respond_to do |format|\n format.html { redirect_to jornadas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @online_answer = OnlineAnswer.find(params[:id])\n @online_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to online_answers_url }\n format.json { head :no_content }\n end\n end",
"def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end",
"def destroy\n @admin_counter_agent.destroy\n respond_to do |format|\n format.html { redirect_to admin_counter_agents_url, notice: \"Counter agent was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete datapoints\n datapoints = [*datapoints]\n datapoints.each do |dp|\n @user.delete \"/users/me/goals/#{@slug}/datapoints/#{dp.id}.json\"\n end\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n render json:@announcement\n\n end",
"def destroy\n @green = Green.find(params[:id])\n @green.destroy\n\n respond_to do |format|\n format.html { redirect_to scaffold_greens_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @mood_datum.destroy\n respond_to do |format|\n format.html { redirect_to mood_data_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: UserBoards.delete(params[\"id\"])\n end",
"def destroy\n @admin_interview = Interview.find(params[:id])\n @admin_interview.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_interviews_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_badge = User::MyBadge.find(params[:id])\n @my_badge.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_my_badges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @diagnoz = Diagnoz.find(params[:id])\n @diagnoz.destroy\n\n respond_to do |format|\n format.html { redirect_to diagnozs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adj.destroy\n respond_to do |format|\n format.html { redirect_to adjs_url, notice: 'Adj was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @online_resource = OnlineResource.find(params[:id])\n @online_resource.destroy\n\n respond_to do |format|\n format.html { redirect_to online_resources_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @medium_dungeon = MediumDungeon.find(params[:id])\n @medium_dungeon.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_dungeons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client.delete( name )\n end",
"def destroy\n @admin_sub_metric.destroy\n respond_to do |format|\n format.html { redirect_to admin_sub_metrics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visit.destroy\n respond_to do |format|\n format.html { redirect_to visits_url, notice: 'Visita eliminada con exito' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food.destroy\n @food.image.destroy\n @j = Joint.where(food_id: @food.id)\n if @j == true\n @j.destroy_all\n end\n respond_to do |format|\n format.html { redirect_to foods_url, notice: 'Food was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @objective = Objective.find(params[:id])\n @objective.destroy\n render json: @objective \n end",
"def destroy\n @ujumbe.destroy\n respond_to do |format|\n format.html { redirect_to ujumbes_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"
] |
[
"0.69018865",
"0.6886463",
"0.66399264",
"0.66161466",
"0.6552659",
"0.6510419",
"0.6502761",
"0.6501989",
"0.6499238",
"0.6486003",
"0.64774436",
"0.6473374",
"0.64520854",
"0.643434",
"0.6402962",
"0.6402962",
"0.6402962",
"0.6402962",
"0.6402254",
"0.63799936",
"0.63739085",
"0.63599366",
"0.6341627",
"0.6321999",
"0.63188654",
"0.6311236",
"0.6288927",
"0.6280019",
"0.6275596",
"0.62682885",
"0.62527525",
"0.62447983",
"0.6243358",
"0.62398696",
"0.62385887",
"0.62382823",
"0.6223121",
"0.6216468",
"0.6215331",
"0.62109727",
"0.62085426",
"0.62026536",
"0.62025994",
"0.61928004",
"0.61872655",
"0.61854833",
"0.6176258",
"0.6176258",
"0.6172492",
"0.6172418",
"0.6171866",
"0.61693114",
"0.6161564",
"0.61595017",
"0.61583614",
"0.6157329",
"0.6148937",
"0.6139048",
"0.61375153",
"0.61375153",
"0.61375153",
"0.61375153",
"0.61375153",
"0.61375153",
"0.61375153",
"0.6128987",
"0.6128559",
"0.6126959",
"0.6123624",
"0.6121708",
"0.6120214",
"0.61105084",
"0.61081123",
"0.61071676",
"0.610698",
"0.6105032",
"0.6102065",
"0.6100196",
"0.60949415",
"0.6091925",
"0.6089344",
"0.6084713",
"0.60844225",
"0.6084124",
"0.6082814",
"0.6082579",
"0.60814136",
"0.60791576",
"0.60781074",
"0.6078095",
"0.60775673",
"0.6066938",
"0.6062835",
"0.60603213",
"0.6059753",
"0.6058137",
"0.60541385",
"0.6053531",
"0.60531044",
"0.60519063"
] |
0.6682734
|
2
|
Use callbacks to share common setup or constraints between actions.
|
def set_online_judge
@online_judge = OnlineJudge.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 online_judge_params
params.require(:online_judge).permit(:site, :account_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
|
returns whether reorientation was necessary
|
def orient! direction, edge
return false if edge_to_the(direction) == edge
ensure_unplaced
2.times do
DIRECTIONS.count.times do
rotate!
return true if edge_to_the(direction) == edge
end
flip!
end
raise "Could not orient piece so that edge matched."
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def correct_orientation?\n if !Move::ORIENTATIONS.include?(orientation)\n errors.add(:orientation, :orientation_error) \n end\n end",
"def needs_rotate?\n false\n end",
"def mirror_move_affected?\n return data.mirror_move\n end",
"def restore?\n @restore || false\n end",
"def reverted?\n version != last_version\n end",
"def restore?\n @restore.nil? ? false : @restore\n end",
"def corrupt?\n checksum_invalid? || torn? || misplaced?\n end",
"def reparent?\n !!@last_reparent_try\n end",
"def resizing?\n state == :RESIZING\n end",
"def rotate? clockwise\n\n if clockwise\n newrot = ( @rotation + 1 ) % 4\n else\n newrot = ( @rotation + 3 ) % 4\n end\n\n if clear? @grid_col, @grid_row, newrot\n @rotation = newrot\n return true\n end\n\n return false\n\n end",
"def interlace_mode?\n @cr[0][7] == 1\n end",
"def portrait?; end",
"def rev?\n if @rxint or @txint or (@rxstate == REV) or (@txstate == REV)\n return true\n else\n return false\n end\n end",
"def unroll?\n return @unroll\n end",
"def preserve?\n true\n end",
"def rev?\r\n return @rev\r\n end",
"def landscape?\n xy_ratio >= 1\n end",
"def intact?\n @signature.md5 == Digest::MD5.digest(@content)\n end",
"def repeated?\n mode == \"REPEATED\"\n end",
"def landscape_format?\n return (self.image_width > self.image_height) ? true : false\n end",
"def show_orientation_block?\n instructor? && !instructor_has_completed_orientation? && @current.empty? && @past.empty?\n end",
"def willAnimateRotationToInterfaceOrientation(orientation, duration: duration)\n rmq.all.reapply_styles\n end",
"def willAnimateRotationToInterfaceOrientation(orientation, duration: duration)\n rmq.all.reapply_styles\n end",
"def willAnimateRotationToInterfaceOrientation(orientation, duration: duration)\n rmq.all.reapply_styles\n end",
"def willAnimateRotationToInterfaceOrientation(orientation, duration: duration)\n rmq.all.reapply_styles\n end",
"def willAnimateRotationToInterfaceOrientation(orientation, duration: duration)\n rmq.all.reapply_styles\n end",
"def willAnimateRotationToInterfaceOrientation(orientation, duration: duration)\n rmq.all.reapply_styles\n end",
"def rearrange_children?\n !!@rearrange_children\n end",
"def previous_signature?\n !stored_signature.empty?\n end",
"def has_reported_renters\r\n if self.get_reported_renters.size > 0\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def retrograde?\n inclination_rad > PI / 2\n end",
"def shouldAutorotateToInterfaceOrientation interfaceOrientation\n # // Return YES for supported orientations.\n # //return interfaceOrientation == UIInterfaceOrientationPortrait;\n true\n end",
"def portrait_format?\n return (self.image_width < self.image_height) ? true : false\n end",
"def puede_reproducir?\r\n return (@reproducir_puede && @pez_vivo)\r\n end",
"def dirty?\n result = false\n if @original_movie.nil?\n result = true\n else\n @movie.each do |key, value|\n if @original_movie[key].nil?\n result = true\n break\n end\n if @movie[key].to_s != @original_movie[key].to_s\n result = true\n break\n end\n end\n unless result\n diff_keys = @movie.keys.sort - @original_movie.keys.sort\n unless diff_keys.empty?\n result = true\n end\n end\n end\n result\n end",
"def signature_changed?\n signature != stored_signature\n end",
"def signature_changed?\n signature != stored_signature\n end",
"def rotate_right\n return false unless on_the_table?\n self.facing = facing.rotate_right\n true\n end",
"def reverse?\n @reverse\n end",
"def reverse?\n @reverse\n end",
"def compression_was_achieved\n return compression_ratio() < 1\n end",
"def autosavable?(metadata)\n !autosaved_relations.include?(metadata.name) && !metadata.embedded?\n end",
"def is_reprinted?\n return false\n end",
"def must_recreate\n @args[:___recreate___]\n end",
"def dirty?\n return _meta_data['dirty'] if _meta_data.has_key? 'dirty'\n\n # if the destination file does not exist, then we are dirty\n return true unless test(?e, destination)\n\n # if this file's mtime is larger than the destination file's\n # mtime, then we are dirty\n dirty = @mtime > ::File.mtime(destination)\n return dirty if dirty\n\n # check to see if the layout is dirty, and if it is then we\n # are dirty, too\n if _meta_data.has_key? 'layout'\n lyt = ::Webby::Resources.find_layout(_meta_data['layout'])\n unless lyt.nil?\n return true if lyt.dirty?\n end\n end\n\n # if we got here, then we are not dirty\n false\n end",
"def changed?\n rotation do |file|\n break true if file_changed?(file)\n end\n end",
"def flipped?\n return @flipped\n end",
"def landscape?; end",
"def create_preliminary_result?\n record.unlocked? && view_access?\n end",
"def in_previous_version?\n prev_res = resource.previous_resource\n return false if prev_res.nil?\n\n prev_file = self.class.where(resource_id: prev_res.id, upload_file_name: upload_file_name).order(id: :desc).first\n return false if prev_file.nil? || prev_file.file_state == 'deleted'\n\n true # otherwise it existed last version because file state is created, copied or nil (nil is assumed to be copied)\n end",
"def rerun_needed?\n\t\t\t@document.primary.file(\"log\", true).rerun_needed?\n\t\tend",
"def is_modified?\n !self.default_layout.nil? || !self.presenter_share_only.nil? || !self.auto_start_audio.nil? ||\n !self.auto_start_video.nil?\n end",
"def reload?\n !!@reloader\n end",
"def modification?\n !self.creation? && !self.destruction?\n end",
"def realized?\n @realized\n end",
"def overwrite?\n @overwrite || (force && !branch_merge)\n end",
"def autorotateToOrientation(orientation)\n device = UIDevice.currentDevice.userInterfaceIdiom\n if view.stylesheet and view.stylesheet.is_a?(Teacup::Stylesheet) and view.stylename\n properties = view.stylesheet.query(view.stylename, self, orientation)\n\n # check for orientation-specific properties\n case orientation\n when UIInterfaceOrientationPortrait\n # portrait is \"on\" by default, must be turned off explicitly\n if properties.supports?(:portrait) == nil and properties.supports?(:upside_up) == nil\n return true\n end\n\n return (properties.supports?(:portrait) or properties.supports?(:upside_up))\n when UIInterfaceOrientationPortraitUpsideDown\n if UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPhone\n # iphone must have an explicit upside-down style, otherwise this returns\n # false\n return properties.supports?(:upside_down)\n else\n # ipad can just have a portrait style\n return (properties.supports?(:portrait) or properties.supports?(:upside_down))\n end\n when UIInterfaceOrientationLandscapeLeft\n return (properties.supports?(:landscape) or properties.supports?(:landscape_left))\n when UIInterfaceOrientationLandscapeRight\n return (properties.supports?(:landscape) or properties.supports?(:landscape_right))\n end\n\n return false\n end\n\n # returns the system default\n if device == UIUserInterfaceIdiomPhone\n return orientation != UIInterfaceOrientationPortraitUpsideDown\n else\n return true\n end\n end",
"def aligned?\n task.log_replay.aligned?\n end",
"def aligned?\n task.log_replay.aligned?\n end",
"def interchange?\n @presenter.interchange?\n end",
"def reverse_mode?\n @cr[0xf][3] == 0\n end",
"def last_phase?\n @finishing\n end",
"def rescan?\n @rescan_required\nend",
"def materialized?\n false\n end",
"def previously_existed?\n true\n end",
"def needs_rebundle?\n # Right now compression is the only option that requires rebundling\n @options_hash != options_hash.hash\n end",
"def interlaced?\n @interlaced\n end",
"def preserve\n # No one should be preserving an object that has errors\n return false if self.errors.present?\n\n Hyacinth::Config.lock_adapter.with_lock(\"#{self.uid}-preserve\") do |_lock_object|\n ensure_doi!\n break if self.errors.present?\n\n preservation_result, errors = Hyacinth::Config.preservation_persistence.preserve(self)\n\n unless preservation_result\n self.errors.add(:preservation, \"Failed to preserve #{self.uid} due to the following errors: #{errors.join(', ')}\")\n break\n end\n\n update_preservation_timestamps(DateTime.current)\n self.save\n end\n\n self.errors.blank?\n end",
"def is_compromised\n\t\tif (!@head) then return end\n\t\ttype = @head.get_item().class\n\t\tcurrent = @head\n\t\twhile (current)\n\t\t\tif (!(current.get_item().is_a?(type))) then return true end\n\t\t\tcurrent = current.get_next()\n\t\tend\n\t\treturn false\n\tend",
"def rotate_right\n return false if @direction.nil?\n\n index = Constant::DIRECTIONS.index(@direction)\n @direction = Constant::DIRECTIONS.rotate[index]\n true\n end",
"def rotate_right\n return false if @direction.nil?\n\n index = DIRECTIONS.index(@direction)\n @direction = DIRECTIONS.rotate()[index]\n true\n end",
"def checkRetraitFail\n\n end",
"def insync?(is)\n should_itview = RubyMethods.array_of_arrays_to_it_view_v21(should)\n is_itview = RubyMethods.array_of_arrays_to_it_view_v21(is)\n missing = RubyMethods.find_it_view_v21_to_create_lun(should_itview,is_itview)\n extra = RubyMethods.find_it_view_v21_to_delete_lun(should_itview,is_itview)\n ##Combine variables and check if empty\n diff = missing + extra\n diff.length == 0 ? true : false\n end",
"def shouldAutorotateToInterfaceOrientation(toInterfaceOrientation)\n toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight\n end",
"def shouldAutorotateToInterfaceOrientation(toInterfaceOrientation)\n toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight\n end",
"def correction?\n false\n end",
"def camera_reposition_case?\n $imported[:TSBS_Camera] && @animation.position != 3\n end",
"def camera_reposition_case?\n $imported[:TSBS_Camera] && @animation.position != 3\n end",
"def revealed?\n @revealed\n end",
"def rolled?\n !upface.nil?\n end",
"def form_needed?\n # Not really needed due to outer logic but we do this anyway\n return false if @assignment.nil?\n\n # New records need a form\n return true if @assignment.new_record? && @assignment.rotation_type.nil?\n\n # auto-skips need a form\n if @assignment.rotation_type.auto_skip?\n # only one auto-skip form per member\n unless @first_row_with_form\n @first_row_with_form = [@row_index - QM_FULL_ROWS_SHOWN, 0].max \n logger.debug \"Here!!! #{[@first_row_with_form .. -1]}\"\n end\n return true\n end\n return false\n end",
"def rear_camera?\n UIImagePickerController.isCameraDeviceAvailable(UIImagePickerControllerCameraDeviceRear)\n end",
"def landscape_orientation?\n driver.orientation.to_s.upcase == LANDSCAPE\n rescue NameError, Selenium::WebDriver::Error::UnknownError\n Applitools::EyesLogger.debug 'driver has no \"orientation\" attribute. Assuming: portrait.'\n false\n end",
"def can_repair?\n self.class.instance_methods(false).include?(:repair!)\n end",
"def autograded?\n if @assessment&.autograded\n true\n elsif @assessment && @assessment.autograded == false\n false\n else\n params[:assessment] && params[:assessment][:autograded]\n end\n end",
"def insync?(is)\n (is.size == should.size && is.sort == should.sort)\n end",
"def shouldReInitialize\n return(false)\n end",
"def insync?\n unless properties[:ensure] == :absent\n properties.each do |k, v|\n if resource[k].to_s != v\n resource[:ensure] = :modified\n break false\n end\n end\n end\n end",
"def landscape?\n width > height\n end",
"def code_reloading?\n !!CODE_RELOADING[environment] # rubocop:disable Style/DoubleNegation\n end",
"def is_modified?\n booleans = [ :presenter_share_only, :auto_start_audio, :auto_start_video ]\n others = [ :default_layout, :background ]\n booleans.any? { |method| !self.send(method).nil? } ||\n others.any? { |method| self.send(method).present? }\n end",
"def can_finalize?\n true\n end",
"def already_being_processed?\n # if origional exists and destination has existed for 30s+\n # assume a previous run didn't get around to cleaning up the file\n if(File.exist?(@origional_file) && File.exist?(destination_file) && !recently_modified?(destination_file))\n $logger.info \"Found origional and transcoded file; moving origional\"\n move_origional_file\n return true\n end\n\n if File.exist? temp_file\n # if file has been modified in the last 30 seconds consider it in flight by another\n if recently_modified?(temp_file)\n $logger.info \" temp file modified recently (maybe by another process?) so skipping #{temp_file}\"\n return true\n else\n $logger.info \" temp file is old, deleting #{temp_file}\"\n File.delete temp_file\n end\n end\n false\n end",
"def multi_arged?\n !first.is_a?(Hash) && first.resizable? || size > 1\n end",
"def finished?\n\t\t\t@size == @transient_count\n\t\tend",
"def reconfiguring_replica_set?\n err = details[\"err\"] || details[\"errmsg\"] || details[\"$err\"] || \"\"\n NOT_MASTER.include?(details[\"code\"]) || err.include?(\"not master\")\n end",
"def success?\n [\n original_source,\n original_node,\n generated_source,\n generated_node\n ].all?(&:right?) && generated_node.from_right.==(original_node.from_right)\n end",
"def rebase?\n @args[0] == 'rebase'\n end",
"def degenerate?\n @structure.degenerate?\n end",
"def save_version?\n version_condition_met? && altered?\n end",
"def modifiable?\n !(self.complete? || self.ready_to_post?)\n end"
] |
[
"0.67039275",
"0.65398735",
"0.65112996",
"0.6160939",
"0.6143824",
"0.6066446",
"0.5943404",
"0.5929524",
"0.5890769",
"0.58271396",
"0.5803456",
"0.5768338",
"0.5752867",
"0.57504946",
"0.5737701",
"0.572663",
"0.57239765",
"0.57108",
"0.5702612",
"0.5664312",
"0.5653063",
"0.56487113",
"0.56487113",
"0.56487113",
"0.56487113",
"0.56487113",
"0.56487113",
"0.56473213",
"0.564336",
"0.5640844",
"0.5639624",
"0.56376565",
"0.5598914",
"0.55928105",
"0.55792546",
"0.5552797",
"0.5552797",
"0.55424696",
"0.552737",
"0.552737",
"0.55193156",
"0.5506786",
"0.54915047",
"0.54855454",
"0.5484082",
"0.54810643",
"0.54671204",
"0.54581654",
"0.5451754",
"0.54514116",
"0.544016",
"0.5439979",
"0.54373384",
"0.543284",
"0.5429717",
"0.5421969",
"0.5418556",
"0.5399124",
"0.5399124",
"0.5391747",
"0.53884465",
"0.53878736",
"0.538194",
"0.53751165",
"0.53721136",
"0.536855",
"0.535768",
"0.5355689",
"0.5355038",
"0.53531975",
"0.5351671",
"0.5348235",
"0.5330669",
"0.5329964",
"0.5329964",
"0.53259254",
"0.53078675",
"0.53078675",
"0.5307156",
"0.53039503",
"0.5301975",
"0.53010434",
"0.5297574",
"0.5291831",
"0.5291534",
"0.52837527",
"0.5279612",
"0.5279397",
"0.5276256",
"0.5274693",
"0.5274394",
"0.5272976",
"0.5268233",
"0.526654",
"0.52625394",
"0.52620065",
"0.52585846",
"0.5255476",
"0.5254168",
"0.52525085",
"0.5242596"
] |
0.0
|
-1
|
This method is used to return portable data, which describes some attribute of an Invoice == Outputs Returns a hash value with all concrete_charges
|
def portable_format
# an invoice basic information
invoice_hash = {}
invoice_hash[:id] = self.id
invoice_hash[:start_date] = self.start_date
invoice_hash[:end_date] = self.end_date
invoice_hash[:issue_date] = self.issue_date
invoice_hash[:total_charges] = self.total
invoice_hash[:distribution_loss_factor] = self.distribution_loss_factor
invoice_hash[:marginal_loss_factor] = self.marginal_loss_factor
invoice_hash[:total_loss_factor] = self.distribution_loss_factor + self.marginal_loss_factor
invoice_hash[:discount] = self.retail_plan.discount
invoice_hash[:generated_at] = self.created_at
# all concrete charges of an invoice
daily_charges = []
global_charges = []
supply_charges = []
metering_charges = []
capacity_charges = []
certificate_charges = []
all_concrete_charges = ConcreteCharge.where("invoice_id = ?", self.id)
all_concrete_charges.each do |item|
if item.charge_factory.specific.is_a?(DailyUsageCharge)
daily_charges << eval(item.charge_attributes) # string to hash
elsif item.charge_factory.specific.is_a?(GlobalUsageCharge)
global_charges << eval(item.charge_attributes) # string to hash
elsif item.charge_factory.specific.is_a?(SupplyCharge)
supply_charges << eval(item.charge_attributes) # string to hash
elsif item.charge_factory.specific.is_a?(MeteringCharge)
metering_charges << eval(item.charge_attributes) # string to hash
elsif item.charge_factory.specific.is_a?(CapacityCharge)
capacity_charges << eval(item.charge_attributes) # string to hash
else
certificate_charges << eval(item.charge_attributes) # string to hash
end
end
meters_in_dailycharges = []
daily_charges.each do |daily|
meters_in_dailycharges << daily[:meters]
end
meters_in_dailycharges.uniq! # uniq meters occur in daily charges
daily_bymeter= {}
meters_in_dailycharges.each do |meter|
daily_bymeter[meter] = []
daily_charges.each do |daily|
if daily[:meters] == meter
daily_bymeter[meter] << daily
end
end
end
concrete_charges = {daily_charges: daily_bymeter, global_charges: global_charges,
supply_charges: supply_charges, metering_charges: metering_charges,
capacity_charges: capacity_charges, certificate_charges: certificate_charges}
invoice_hash[:concrete_charges] = concrete_charges
return invoice_hash
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def hash\n [unit_of_measure, pricing_component_type, charge_type, period_start, period_end, created, changed_by, updated, id, invoice_id, unit_of_measure_id, subscription_id, product_rate_plan_id, public_product_rate_plan_name, product_rate_plan_name, product_id, public_product_name, product_name, organization_id, name, description, calculation, cost, tax, component_value, pricing_component_id, public_pricing_component_name, pricing_component_name, subscription_charge_id, child_invoice_id, type].hash\n end",
"def generateConcreteCharges\r\n\t #For each charge factories asscociated with retail plans, generate concrete charge and total them\r\n\t self.retail_plan.charge_factories.each do |charge_factory| \r\n\t generated_concrete_charges = charge_factory.specific.concreteCharge(self)\r\n\t #Put each generated_concrete_charge to GeneratedInvoice\r\n\t generated_concrete_charges.each do |generated_concrete_charge|\t \t\r\n\t\t self.concrete_charges << generated_concrete_charge\r\n\t\t self.total += generated_concrete_charge.amount\r\n\t end\r\n\t end\r\n\tend",
"def hash\n [id, company, charge_to_id, charge_to_type, type, member, payment_method, classification, amount, billable_option, date, location_id, business_unit_id, notes, agreement, invoice_amount, taxes, _info].hash\n end",
"def construct_freshbooks_invoice_data\n # Capture appropriate data from ledger and activities\n invoice_lines = []\n self.ledger_entries.debits.select( 'narrative, value, count(*) as quantity' ).group(:narrative, :value).each do |entry|\n invoice_lines << { line: { \n name: entry.narrative,\n description: '%s at %0.4f' % [entry.narrative, -entry.value.to_f],\n unit_cost: -entry.value,\n quantity: entry.quantity\n }}\n end\n \n # Create a new invoice data structure\n invoice_data = { client_id: self.organization.accounting_gateway.freshbooks_id, return_uri: 'http://www.signalcloudapp.com' }\n invoice_data[:lines] = invoice_lines unless invoice_lines.empty?\n invoice_data[:po_number] = self.purchase_order unless self.purchase_order.blank?\n invoice_data[:notes] = 'This invoice is provided for information purposes only. No payment is due.' if self.balance >= 0\n \n return invoice_data\n end",
"def specific_data\n\t\t\t\t\t\tresult = {}\n\t\t\t\t\t\tresult[\"paymentId\"] = self.payment_id if !self.payment_id.nil?\n\t\t\t\t\t\treturn result\n\t\t\t\t\tend",
"def hash\n [comments, invoice_number, purchase_order_number, disbursement_trans_type, wallet_provider, receipts, additional_response_data].hash\n end",
"def hash\n [created, value, change_mode, invoicing_type, no_charge].hash\n end",
"def hash\n [id, invoice_number, type, status, company, bill_to_company, ship_to_company, apply_to_type, apply_to_id, attention, billing_site, shipping_site, billing_terms, reference, customer_po, template_setup_id, email_template_id, add_to_batch_email_list, date, restrict_downpayment_flag, location_id, department_id, territory_id, top_comment, bottom_comment, taxable_flag, tax_code, internal_notes, downpayment_previously_taxed_flag, service_total, due_date, expense_total, product_total, previous_progress_applied, service_adjustment_amount, agreement_amount, downpayment_applied, subtotal, total, remaining_downpayment, sales_tax, adjustment_reason, adjusted_by, payments, credits, balance, special_invoice_flag].hash\n end",
"def build_payment_info\n {'ShipmentCharge' => build_shipment_charge }\n end",
"def jde_invoice_hashes_array(for_type=nil, include_regular_charges=true, include_advance_charges=true, delta_only=false, with_indicator=true)\n return [{}] if for_type.nil?\n hashes_array = []\n \n # What parameters were passed in you ask?\n logger.info(\"For type: #{for_type}\")\n logger.info(\"Including regular charges: #{include_regular_charges}\")\n logger.info(\"Including advance charges: #{include_advance_charges}\")\n logger.info(\"Are advance charges for the delta only: #{delta_only}\")\n logger.info(\"Including the end indicator: #{with_indicator}\")\n \n # Set up the document type variables that apply and the uid to use\n # (based on the 'for_type' value)\n document_type_credit = \"\"\n document_type_invoice = \"\"\n line_item_posting_key_credit = \"\"\n line_item_posting_key_invoice = \"\"\n posting_key_credit = \"\"\n posting_key_invoice = \"\"\n ref_gl_account_uid = \"\"\n # for member values\n if for_type.eql?('member')\n document_type_credit = \"MC\"\n document_type_invoice = \"MI\"\n line_item_posting_key_credit = \"40\"\n line_item_posting_key_invoice = \"50\"\n posting_key_credit = \"11\"\n posting_key_invoice = \"01\"\n ref_gl_account_uid = self.member_id.to_s if self.member_id.present?\n # for seller values\n elsif for_type.eql?('seller')\n document_type_credit = \"SC\"\n document_type_invoice = \"SI\"\n line_item_posting_key_credit = \"40\"\n line_item_posting_key_invoice = \"50\"\n posting_key_credit = \"11\"\n posting_key_invoice = \"01\"\n ref_gl_account_uid = self.seller.seller_uid.to_s unless self.seller.nil?\n # for vendor values\n elsif for_type.eql?('vendor')\n document_type_credit = \"KG\"\n document_type_invoice = \"KR\"\n line_item_posting_key_credit = \"50\"\n line_item_posting_key_invoice = \"40\"\n posting_key_credit = \"21\"\n posting_key_invoice = \"31\"\n # According to email from Nikki vendor uid to use is pickup location\n # (which means the tow provider uid is not referenced for this)\n ref_gl_account_uid = self.pickup_location.pickup_location_uid.to_s unless self.pickup_location.nil? || self.pickup_location.pickup_location_uid.nil?\n else\n logger.info(\"Returning [{}] for unknown type: #{for_type}\")\n return [{}]\n end \n\n # This is a hash with all of the fields desired,\n # with data filled in for the first record.\n # (thanks to that true being passed in)\n base_hash = base_jde_hash(true, with_indicator)\n \n # The next two values may change below if\n # total is negative, becoming SC, MC, or KG and 11 or 21\n base_hash[:documentType] = document_type_invoice # invoice code\n base_hash[:postingKey] = posting_key_invoice\n base_hash[:reference] = ref_gl_account_uid\n base_hash[:glAccount] = ref_gl_account_uid\n\n # SAP expects this base hash of data to only\n # be on the first record...\n hashes_array << base_hash\n\n # we need to keep track of the total\n total_charge = 0\n\n # these are the advance charges\n advance_charges = include_advance_charges ? self.advance_charge : nil\n\n # these are the non sale price charges\n charges = []\n charges_multiplier = 1 # 1 or -1 depending on the type this is for\n charges_for_seller = false\n if include_regular_charges\n if for_type.eql?('member')\n charges = self.member_charges \n elsif for_type.eql?('seller')\n charges = self.seller_charges\n charges_multiplier = -1\n charges_for_seller = true\n end\n end\n\n # Add the sale price\n # (the amounts are subtracted from the total_charge\n # for sellers [credit], added to the total for members [debit/invoice])\n #\n # sale price line\n if include_regular_charges\n sale_price_hash = base_jde_hash(false, with_indicator)\n sale_amount = self.high_bid_amount.present? ? self.high_bid_amount : 0\n total_charge += sale_amount * charges_multiplier\n sale_price_hash[:amount] = sale_amount.to_s\n sale_price_hash[:postingKey] = charges_for_seller ? line_item_posting_key_credit : line_item_posting_key_invoice\n sale_price_hash[:glAccount] = \"100000\"\n sale_price_hash[:itemText] = \"Sale Price\"\n hashes_array << sale_price_hash\n end\n\n # we're adding advance charges!\n if advance_charges.present? && include_advance_charges\n total_advance_vat = 0\n # labor\n labor_amount = advance_charges.labor\n previous_labor_amount = advance_charges.previous_labor_charge\n labor_vat_amount = advance_charges.labor_vat\n previous_labor_vat_amount = advance_charges.previous_labor_vat_charge\n # was 304016 (now 150991), changed per SAP, but I lack faith, so this comment is here.\n labor_hash = self.jde_advance_charge_hash(\n labor_amount, \n previous_labor_amount,\n labor_vat_amount, \n previous_labor_vat_amount,\n delta_only, \n with_indicator,\n \"500022\", \n \"Labor\", \n line_item_posting_key_credit, \n line_item_posting_key_invoice)\n if labor_hash.present?\n hashes_array << labor_hash\n # add or subtract the amount from the total\n amount_multiplier = labor_hash[:postingKey] == line_item_posting_key_invoice ? 1 : -1\n total_charge += labor_hash[:amount].to_f * amount_multiplier\n self.advance_charge.update_column(:previous_labor_charge, labor_amount)\n end\n # labor VAT\n if advance_charges.labor_vat.present? && advance_charges.labor_vat > 0\n total_advance_vat += advance_charges.labor_vat\n self.advance_charge.update_column(:previous_labor_vat_charge, labor_vat_amount)\n end\n\n # Miscellaneous\n additional_fee_amount = advance_charges.additional_fee\n previous_additional_fee_amount = advance_charges.previous_additional_fee_charge\n additional_fee_vat_amount = advance_charges.additional_fee_vat\n previous_additional_fee_vat_amount = advance_charges.previous_additional_fee_vat_charge\n # was 304020 (now 150995), changed per SAP, but I lack faith, so this comment is here.\n misc_hash = self.jde_advance_charge_hash(\n additional_fee_amount, \n previous_additional_fee_amount, \n additional_fee_vat_amount,\n previous_additional_fee_vat_amount,\n delta_only, \n with_indicator,\n \"500026\",\n \"Miscellaneous\", \n line_item_posting_key_credit, \n line_item_posting_key_invoice)\n if misc_hash.present?\n hashes_array << misc_hash\n # add or subtract the amount from the total\n amount_multiplier = misc_hash[:postingKey] == line_item_posting_key_invoice ? 1 : -1\n total_charge += misc_hash[:amount].to_f * amount_multiplier\n self.advance_charge.update_column(:previous_additional_fee_charge, additional_fee_amount)\n end\n # Miscellaneous VAT\n if advance_charges.additional_fee_vat.present? && advance_charges.additional_fee_vat > 0\n total_advance_vat += advance_charges.additional_fee_vat\n self.advance_charge.update_column(:previous_additional_fee_vat_charge, additional_fee_vat_amount)\n end\n\n # Storage\n storage_amount = advance_charges.storage_amount || 0\n if advance_charge.storage_daily? && \n advance_charge.storage_from_date.present? &&\n advance_charge.storage_thru_date.present?\n days = (advance_charge.storage_thru_date - advance_charges.storage_from_date).to_i + 1\n storage_amount *= days unless days == 0\n end\n\n previous_storage_amount = advance_charges.previous_storage_charge\n storage_fee_vat_amount = advance_charges.storage_amount_vat\n if advance_charge.storage_daily? && \n advance_charge.storage_from_date.present? &&\n advance_charge.storage_thru_date.present?\n days = (advance_charge.storage_thru_date - advance_charges.storage_from_date).to_i + 1\n storage_fee_vat_amount *= days unless days == 0\n end\n previous_storage_fee_vat_amount = advance_charges.previous_storage_vat_charge\n # was 304015 (now 150990), changed per SAP, but I lack faith, so this comment is here.\n storage_hash = self.jde_advance_charge_hash(\n storage_amount, \n previous_storage_amount, \n storage_fee_vat_amount,\n previous_storage_fee_vat_amount,\n delta_only, \n with_indicator,\n \"500021\", \n \"Storage\", \n line_item_posting_key_credit, \n line_item_posting_key_invoice)\n if storage_hash.present?\n hashes_array << storage_hash\n # add or subtract the amount from the total\n amount_multiplier = storage_hash[:postingKey] == line_item_posting_key_invoice ? 1 : -1\n total_charge += storage_hash[:amount].to_f * amount_multiplier\n self.advance_charge.update_column(:previous_storage_charge, storage_amount)\n end\n # storage VAT\n if advance_charges.storage_amount_vat.present? && advance_charges.storage_amount_vat > 0\n amount = advance_charges.storage_amount_vat\n if advance_charge.storage_daily? && \n advance_charge.storage_from_date.present? &&\n advance_charge.storage_thru_date.present?\n days = (advance_charge.storage_thru_date - advance_charges.storage_from_date).to_i + 1\n amount *= days unless days == 0\n end\n total_advance_vat += amount\n self.advance_charge.update_column(:previous_storage_vat_charge, amount)\n end\n # tear down estimate\n tear_down_estimate_amount = advance_charges.tear_down_estimate\n previous_tear_down_estimate_amount = advance_charges.previous_tear_down_estimate_charge\n tear_down_estimate_vat_amount = advance_charges.tear_down_estimate_vat\n previous_tear_down_estimate_vat_amount = advance_charges.previous_tear_down_estimate_vat_charge\n # was 304018 (now 150993), changed per SAP, but I lack faith, so this comment is here.\n tear_down_hash = self.jde_advance_charge_hash(\n tear_down_estimate_amount, \n previous_tear_down_estimate_amount,\n tear_down_estimate_vat_amount,\n previous_tear_down_estimate_vat_amount,\n delta_only, \n with_indicator,\n \"500024\", \n \"Tear Down Estimate\", \n line_item_posting_key_credit, \n line_item_posting_key_invoice)\n if tear_down_hash.present?\n hashes_array << tear_down_hash\n # add or subtract the amount from the total\n amount_multiplier = tear_down_hash[:postingKey] == line_item_posting_key_invoice ? 1 : -1\n total_charge += tear_down_hash[:amount].to_f * amount_multiplier\n self.advance_charge.update_column(:previous_tear_down_estimate_charge, tear_down_estimate_amount)\n end\n # tear down estimate VAT\n if advance_charges.tear_down_estimate_vat.present? && advance_charges.tear_down_estimate_vat > 0\n total_advance_vat += advance_charges.tear_down_estimate_vat\n self.advance_charge.update_column(:previous_tear_down_estimate_vat_charge, tear_down_estimate_vat_amount)\n end\n # towing\n towing_amount = advance_charges.towing\n previous_towing_amount = advance_charges.previous_towing_charge\n towing_vat_amount = advance_charges.towing_vat\n previous_towing_vat_amount = advance_charges.previous_towing_vat_charge\n # was 304017 (now 150992), changed per SAP, but I lack faith, so this comment is here.\n towing_hash = self.jde_advance_charge_hash(\n towing_amount, \n previous_towing_amount, \n towing_vat_amount,\n previous_towing_vat_amount,\n delta_only, \n with_indicator,\n \"500023\", \n \"Towing\", \n line_item_posting_key_credit, \n line_item_posting_key_invoice)\n if towing_hash.present?\n hashes_array << towing_hash\n # add or subtract the amount from the total\n amount_multiplier = towing_hash[:postingKey] == line_item_posting_key_invoice ? 1 : -1\n total_charge += towing_hash[:amount].to_f * amount_multiplier\n self.advance_charge.update_column(:previous_towing_charge, towing_amount)\n end\n # towing VAT\n if advance_charges.towing_vat.present? && advance_charges.towing_vat > 0\n total_advance_vat += advance_charges.towing_vat\n self.advance_charge.update_column(:previous_towing_vat_charge, towing_vat_amount)\n end\n # yard gate\n yard_gate_amount = advance_charges.yard_gate\n previous_yard_gate_amount = advance_charges.previous_yard_gate_charge\n yard_gate_vat_amount = advance_charges.yard_gate_vat\n previous_yard_gate_vat_amount = advance_charges.previous_yard_gate_vat_charge\n # was 304019 (now 150994), changed per SAP, but I lack faith, so this comment is here.\n yard_gate_hash = self.jde_advance_charge_hash(\n yard_gate_amount, \n previous_yard_gate_amount, \n yard_gate_vat_amount,\n previous_yard_gate_vat_amount,\n delta_only, \n with_indicator,\n \"500025\", \n \"Facility Gate\", \n line_item_posting_key_credit, \n line_item_posting_key_invoice)\n if yard_gate_hash.present?\n hashes_array << yard_gate_hash\n # add or subtract the amount from the total\n amount_multiplier = yard_gate_hash[:postingKey] == line_item_posting_key_invoice ? 1 : -1\n total_charge += yard_gate_hash[:amount].to_f * amount_multiplier\n self.advance_charge.update_column(:previous_yard_gate_charge, yard_gate_amount)\n end\n # yard gate VAT\n if advance_charges.yard_gate_vat.present? && advance_charges.yard_gate_vat > 0\n total_advance_vat += advance_charges.yard_gate_vat\n self.advance_charge.update_column(:previous_yard_gate_vat_charge, yard_gate_vat_amount)\n end\n # Ze Total VAT Por Advance Charges\n previous_total_advance_vat = advance_charges.previous_total_tax_charge.present? ?\n advance_charges.previous_total_tax_charge :\n 0\n # Case for initial send, final send, and CSV files\n if !delta_only\n # nested this if to make the delta if/elsif stuff clearer\n if total_advance_vat > 0\n total_charge += total_advance_vat\n vat_hash = base_jde_hash(false, with_indicator)\n vat_hash[:amount] = total_advance_vat.to_s\n vat_hash[:postingKey] = line_item_posting_key_invoice\n vat_hash[:glAccount] = vat_gl_account\n vat_hash[:itemText] = \"Advance Charges VAT\"\n hashes_array << vat_hash\n self.advance_charge.update_column(:previous_total_tax_charge, total_advance_vat)\n end\n elsif previous_total_advance_vat - total_advance_vat != 0\n diff_amount = total_advance_vat - previous_total_advance_vat\n total_charge += diff_amount\n posting_key = line_item_posting_key_invoice\n if diff_amount < 0\n posting_key = line_item_posting_key_credit\n diff_amount *= -1\n end\n vat_hash = base_jde_hash(false, with_indicator)\n vat_hash[:amount] = diff_amount.to_s\n vat_hash[:postingKey] = posting_key\n vat_hash[:glAccount] = vat_gl_account\n vat_hash[:itemText] = \"Advance Charges VAT\"\n hashes_array << vat_hash\n self.advance_charge.update_column(:previous_total_tax_charge, total_advance_vat)\n end \n end\n\n # we're adding charges!\n if charges.present? && !charges.empty? && include_regular_charges\n # alrighty, let's...\n charges.each do |charge|\n invoice_hash = base_jde_hash(false, with_indicator)\n # get some stuff\n gl_type = charge.gl_type.present? ? charge.gl_type : GlType.new\n # If GLType is empty, either due to the line above or\n # due to the system saving an incomplete charge let's\n # move to the next one\n next if gl_type.code.nil?\n # ignore gotten stuff and move to the next charge\n # if this charge is the VTS (VAT paid) charge as we\n # handle this above in \"Tax on Purchase\"\n next if gl_type.code == \"VTS\"\n # so we can set some stuff\n invoice_hash[:glAccount] = gl_type.sap_code\n invoice_hash[:itemText] = gl_type.description\n invoice_hash[:tax] = \"\" # this wants a code, but we just have an amount (added to amount below)\n # which leads to figuring out some stuff\n amount = charge.charge_amount.present? ? charge.charge_amount : 0\n total_charge += amount # will add total vat to this later\n # ... like, do we use 40 (debit [positive from copart view]) \n # or 50 (credit [negative from copart view]) posting key?\n if amount < 0\n invoice_hash[:postingKey] = line_item_posting_key_credit\n amount *= -1\n else\n invoice_hash[:postingKey] = line_item_posting_key_invoice\n end\n invoice_hash[:amount] = amount.to_s\n # and we should probably add the stuff\n hashes_array << invoice_hash\n end\n end\n\n # If the total is negative we invoice posting variables\n # (and then multiply by -1 to remove the sign)\n if total_charge < 0\n hashes_array.first[:documentType] = document_type_credit\n hashes_array.first[:postingKey] = posting_key_credit\n total_charge *= -1\n end\n # then we set the total\n hashes_array.first[:amount] = total_charge.to_s\n\n # ... and they want the \"indicator\" value to\n # be \"END\" for the last record.\n if with_indicator\n hashes_array.last[:indicator] = \"END\"\n end\n\n # glorious\n hashes_array\n end",
"def hash\n [payment_amount, payer, invoice_information, payment_format, payment_currency, payee, payment_id, payment_description, debit_credit_indicator, payment_method, payment_date].hash\n end",
"def generation_charges\n [ [{ :content => \"Current Supplier: THE FLYING BLINKY LIGHTS COMPANY\", :colspan => 4 }],\n [\"Generation Service Charge\", \"491 kWh X $.090041\", \"$\", \"44.21\"],\n [{ :content => \"Total Generation Services Charges\", :colspan => 2 }, \"$\", \"44.21\"]]\n end",
"def hash\n [id, remit_name, location, address_one, address_two, city, state, zip, country, phone, invoice_title, payable_name, topcomment, invoice_footer, quote_footer, overall_invoice_default, standard_invoice_actual, standard_invoice_fixed, progress_invoice, agreement_invoice, credit_memo_invoice, down_payment_invoice, misc_invoice, sales_order_invoice, exclude_do_not_bill_time_flag, exclude_do_not_bill_expense_flag, exclude_do_not_bill_product_flag, prefix_suffix_flag, prefix_suffix_text, charge_adj_to_firm_flag, no_watermark_flag, display_tax_flag, allow_restricted_dept_on_routing_flag, bill_ticket_separately_flag, bill_ticket_complete_flag, bill_ticket_unapproved_flag, bill_project_complete_flag, bill_project_unapproved_flag, progress_time_flag, restrict_project_downpayment_flag, bill_sales_order_complete_flag, bill_product_after_ship_flag, restrict_downpayment_flag, copy_non_service_products_flag, copy_service_products_flag, copy_agreement_products_flag, print_logo_flag, read_receipt_flag, delivery_receipt_flag, disable_routing_email_flag, email_template, localized_country, business_number, currency, custom_label, custom_text, company_code, exclude_avalara_flag, _info].hash\n end",
"def service_response_data\n\n {\n customer: @customer.get_hash,\n gateway_customer_associations: @gateway_customer_associations.map{|x| x.get_hash}\n }\n\n end",
"def get_charge\n @charge\n end",
"def all_charges(scans)\n scans.map do |scan|\n {\n title: scan.product.title,\n quantity: scan.quantity,\n amount: priceify_number(scan.total_cost(apply_discount: false))\n }\n end\n end",
"def invoice\n @ipn['invoice']\n end",
"def invoice_data\n {\n \"id\"=>\"050b550a-1f4d-4c1e-a0b7-7d9a27e44c4a\",\n \"status\"=>\"ready_to_ship\", \n \"payment_address\"=>\"bitcoin_public_address\", \n \"price\"=>\"0.00012350\", \n \"price_currency\"=>\"BTC\", \n \"base_price\"=>\"31.66\", \n \"base_price_currency\"=>\"USD\", \n \"spot_rate\"=>\"0.00123504\", \n \"usd_spot_rate\"=>\"1.0\", \n \"crypto_payout_split\"=>80, \n \"confirmations_required\"=>6, \n \"notification_level\"=>nil, \n \"redirect_url\"=>\"http://test_redirect_url.com\", \n \"order_id\"=>\"237\", \n \"item_name\"=>nil, \n \"item_sku\"=>nil, \n \"item_description\"=>nil, \n \"physical\"=>nil, \n \"customer_name\"=>\"Customer Name\", \n \"customer_address_1\"=>nil, \n \"customer_address_2\"=>nil, \n \"customer_city\"=>nil, \n \"customer_region\"=>nil, \n \"customer_country\"=>nil, \n \"customer_postal_code\"=>nil, \n \"customer_email\"=>nil, \n \"customer_phone\"=>nil, \n \"user_defined_1\"=>nil, \n \"user_defined_2\"=>nil, \n \"user_defined_3\"=>nil, \n \"user_defined_4\"=>nil, \n \"user_defined_5\"=>nil, \n \"user_defined_6\"=>nil, \n \"user_defined_7\"=>nil, \n \"user_defined_8\"=>nil, \n \"data\"=>nil, \n \"expires_at\"=>\"2014-01-24T00:01:03.602Z\", \n \"created_at\"=>\"2014-01-23T23:46:03.997Z\", \n \"updated_at\"=>\"2014-01-23T23:49:40.777Z\", \n \"server_time\"=>\"2014-01-24T00:26:39Z\", \n \"callback_url\"=>\"test_redirect_url.com/notify/237\", \n \"merchant_id\"=>\"d91c8756-5174-4388-b4e0-8c3593529a32\"\n }\n end",
"def charge_detail(charge)\n raise \"This method has to be defined on the concrete implementations\"\n end",
"def gas_expense\n { amount: 12.50 , comment: 'Gas at Chevron', when: '2013-09-09', expensetype_id: 1 }\n end",
"def calculation_methods\n out = {\n :demand => {\n :demand => {},\n :preset_demand => {},\n :demand_of_sustainable => {},\n :weighted_carrier_cost_per_mj => {},\n :weighted_carrier_co2_per_mj => {},\n :sustainability_share => {},\n :final_demand => {},\n :primary_demand => {},\n :primary_demand_of_fossil => {},\n :primary_demand_of_sustainable => {}\n },\n :technical => {\n :input_capacity => {},\n :electric_based_input_capacity => {label: '', unit: 'MWinput'},\n :heat_based_input_capacity => {label: '', unit: 'MWinput'},\n :cooling_based_input_capacity => {label: '', unit: 'MWinput'},\n :number_of_units => {}\n },\n :costs_per_plant => {\n 'total_costs_per(:plant)' => {label: 'Total costs per plant', unit: 'euro / plant'},\n 'fixed_costs_per(:plant)' => {},\n 'cost_of_capital_per(:plant)' => {},\n 'depreciation_costs_per(:plant)' => {},\n 'variable_costs_per(:plant)' => {},\n 'fuel_costs_per(:plant)' => {},\n 'co2_emissions_costs_per(:plant)' => {},\n 'fixed_operation_and_maintenance_costs_per(:plant)' => {},\n 'variable_operation_and_maintenance_costs_per(:plant)' => {},\n 'total_initial_investment_per(:plant)' => {},\n },\n :costs_per_node => {\n 'total_costs_per(:node)' => {},\n 'fixed_costs_per(:node)' => {},\n 'cost_of_capital_per(:node)' => {},\n 'depreciation_costs_per(:node)' => {},\n 'variable_costs_per(:node)' => {},\n 'fuel_costs_per(:node)' => {},\n 'co2_emissions_costs_per(:node)' => {},\n 'fixed_operation_and_maintenance_costs_per(:node)' => {},\n 'variable_operation_and_maintenance_costs_per(:node)' => {},\n 'total_initial_investment_per(:node)' => {},\n },\n :costs_per_mw_electricity => {\n 'total_costs_per(:mw_electricity)' => {},\n 'fixed_costs_per(:mw_electricity)' => {},\n 'cost_of_capital_per(:mw_electricity)' => {},\n 'depreciation_costs_per(:mw_electricity)' => {},\n 'variable_costs_per(:mw_electricity)' => {},\n 'fuel_costs_per(:mw_electricity)' => {},\n 'co2_emissions_costs_per(:mw_electricity)' => {},\n 'fixed_operation_and_maintenance_costs_per(:mw_electricity)' => {},\n 'variable_operation_and_maintenance_costs_per(:mw_electricity)' => {},\n 'total_initial_investment_per(:mw_electricity)' => {},\n },\n :costs_per_mwh_electricity => {\n 'total_costs_per(:mwh_electricity)' => {},\n 'fixed_costs_per(:mwh_electricity)' => {},\n 'cost_of_capital_per(:mwh_electricity)' => {},\n 'depreciation_costs_per(:mwh_electricity)' => {},\n 'variable_costs_per(:mwh_electricity)' => {},\n 'fuel_costs_per(:mwh_electricity)' => {},\n 'co2_emissions_costs_per(:mwh_electricity)' => {},\n 'fixed_operation_and_maintenance_costs_per(:mwh_electricity)' => {},\n 'variable_operation_and_maintenance_costs_per(:mwh_electricity)' => {},\n 'total_initial_investment_per(:mwh_electricity)' => {},\n },\n :costs_per_mw_heat => {\n 'total_costs_per(:mw_heat)' => {},\n 'fixed_costs_per(:mw_heat)' => {},\n 'cost_of_capital_per(:mw_heat)' => {},\n 'depreciation_costs_per(:mw_heat)' => {},\n 'variable_costs_per(:mw_heat)' => {},\n 'fuel_costs_per(:mw_heat)' => {},\n 'co2_emissions_costs_per(:mw_heat)' => {},\n 'fixed_operation_and_maintenance_costs_per(:mw_heat)' => {},\n 'variable_operation_and_maintenance_costs_per(:mw_heat)' => {},\n 'total_initial_investment_per(:mw_heat)' => {},\n },\n :costs_per_mwh_heat => {\n 'total_costs_per(:mwh_heat)' => {},\n 'fixed_costs_per(:mwh_heat)' => {},\n 'cost_of_capital_per(:mwh_heat)' => {},\n 'depreciation_costs_per(:mwh_heat)' => {},\n 'variable_costs_per(:mwh_heat)' => {},\n 'fuel_costs_per(:mwh_heat)' => {},\n 'co2_emissions_costs_per(:mwh_heat)' => {},\n 'fixed_operation_and_maintenance_costs_per(:mwh_heat)' => {},\n 'variable_operation_and_maintenance_costs_per(:mwh_heat)' => {},\n 'total_initial_investment_per(:mwh_heat)' => {},\n }\n }\n graph.carriers.each do |c|\n method_name = \"primary_demand_of_#{c.key}\".to_sym\n out[:demand][method_name] = {hide_if_zero: true}\n end\n out\n end",
"def eligible_hash\n return []\n # TODO: refactor as per offered markets\n @medicaid_hash[:insuranceCoverage].each do |_eligible_coverage|\n next if enrolled_coverage[:insuranceMarketType] == 'NONE'\n\n result << {\n kind: Ffe::Types::BenefitsKindMapping[enrolled_coverage[:insuranceMarketType].to_sym],\n status: 'is_eligible',\n start_on: Date.parse('2021-01-01'), # default value\n end_on: nil\n }\n end\n result\n end",
"def claim_payment_information\n claim_weight = claim_type_weight\n ['CLP', captured_or_blank_patient_account_number(@eob.patient_account_number), claim_weight, @eob.amount('total_submitted_charge_for_claim'),\n @eob.payment_amount_for_output(@facility, @facility_output_config),\n ( claim_weight == 22 ? \"\" : @eob.patient_responsibility_amount),\n \"13\", @eob.claim_number ].trim_segment.join(@element_seperator)\n end",
"def hash\n [id, merchant_id, capacity, area_id, date_time, order_id, extra_info, promo_code, credit_card_vault_settings_id, recurring_card_detail_id, deals].hash\n end",
"def hash\n [class_id, object_type, contract, contract_status, contract_status_reason, contract_updated_time, covered_product_line_end_date, device_id, device_type, end_customer, end_user_global_ultimate, is_valid, item_type, maintenance_purchase_order_number, maintenance_sales_order_number, platform_type, product, purchase_order_number, reseller_global_ultimate, sales_order_number, service_description, service_end_date, service_level, service_sku, service_start_date, state_contract, warranty_end_date, warranty_type, registered_device, source].hash\n end",
"def final_output\n data = optimum_discount\n {\n 'sets': print_discount(data[0]),\n 'extras': print_discount(data[1]),\n 'product without discount': print_products(data[2]),\n 'product for free': print_products(data[3]),\n 'regular price': regular_price(ordered_products_total_arr),\n 'dicount price': data[4]\n }\n end",
"def initialize(invoice)\n raise ArgumentError, \"Received #{invoice.class} object (expected instance of Invoice)\" unless invoice.is_a?(MnoEnterprise::Invoice)\n @invoice = invoice\n @pdf = nil\n @data = {}\n\n #===============================\n # Initialize formatting\n #===============================\n @format = {}\n @format[:header_size] = 120\n @format[:footer_size] = 100\n @format[:top_margin] = 36\n @format[:bottom_margin] = 36\n\n #===============================\n # Data hash\n #===============================\n @data = {}\n\n # Invoice details\n @data[:invoice_reference] = @invoice.slug\n\n # Customer details\n invoicable = @invoice.organization\n [:name, :email, :current_credit].each do |detail|\n @data[\"customer_#{detail}\".to_sym] = invoicable.respond_to?(detail) ? invoicable.send(detail) : nil\n end\n\n # Billing Address - Kept at the invoice level for audit purpose\n @data[:customer_billing_address] = @invoice.billing_address\n\n # Financial values\n @data[:invoice_price] = @invoice.price\n @data[:invoice_currency] = @invoice.price.currency.to_s\n @data[:invoice_currency_name] = @invoice.price.currency.name\n @data[:invoice_credit_paid] = @invoice.credit_paid\n @data[:invoice_total_payable] = @invoice.total_payable\n @data[:invoice_tax_payable] = @invoice.tax_payable\n @data[:invoice_tax_pips] = (@invoice.tax_pips_applied || 0)\n @data[:invoice_total_payable_with_tax] = @data[:invoice_total_payable] + @data[:invoice_tax_payable]\n @data[:invoice_fully_paid] = (@data[:invoice_total_payable].zero? || @data[:invoice_total_payable].negative?)\n\n # Last App billing (Account Situation)\n @data[:invoice_previous_total_due] = @invoice.previous_total_due\n @data[:invoice_previous_total_paid] = @invoice.previous_total_paid\n\n # Split billing summary in the event that one group\n # has a large number of items (greater than 25).\n # This prevents blank pages being added to the invoice\n # by the pdf generator due to items not fitting on the page.\n @invoice.billing_summary.each do |item|\n item[:label] = 'Adjustments' if item[:label] == 'Platform Usage'\n while item[:lines].count > 25\n @invoice.billing_summary << {\n label: \"#{item[:label]} cont'd.\",\n price_tag: '',\n lines: item[:lines].slice!(25, 50)\n }\n end\n end.sort! do |a, b|\n a_label = a[:label].in?(['Adjustments', \"Adjustments cont'd.\"]) ? 'zzzzzzz' + a[:label] : a[:label]\n b_label = b[:label].in?(['Adjustments', \"Adjustments cont'd.\"]) ? 'zzzzzzz' + b[:label] : b[:label]\n a_label <=> b_label\n end\n\n # Billing details\n @data[:billing_report] = @invoice.billing_summary.map do |item|\n item_label = item[:label]\n price_label = format_price item\n\n (item[:lines] || []).each do |item_line|\n item_label += \"<font size='4'>\\n\\n</font><font size='8'><color rgb='999999'><i>#{Prawn::Text::NBSP * 3}#{item_line[:label]}</i></color></font>\"\n price_label += \"<font size='4'>\\n\\n</font><font size='8'><color rgb='999999'>#{format_price(item_line)}</color></font>\"\n end\n\n [item_label, item[:name], item[:usage], price_label]\n end\n\n # Billing period\n @data[:period_started_at] = @invoice.started_at.utc.to_date\n @data[:period_ended_at] = (@invoice.ended_at.utc - 1.minute).to_date # '- 1 minute' to avoid midnight (which belongs to following day)\n @data[:period_month] = @invoice.ended_at.strftime(\"%B\")\n next_period = @data[:period_ended_at] + 1.month\n @data[:period_charge_date] = Date.new(next_period.year,next_period.month,2)\n end",
"def hash\n [accounting_code, activation_codes, arbitrary_unit_cost, auto_order_last_rebill_dts, auto_order_schedule, barcode, channel_partner_item_id, cogs, component_unit_value, cost, country_code_of_origin, customs_description, description, discount, discount_quantity, discount_shipping_weight, distribution_center_code, edi, exclude_coupon, free_shipping, hazmat, height, item_index, item_reference_oid, kit, kit_component, length, manufacturer_sku, max_days_time_in_transit, merchant_item_id, mix_and_match_group_name, mix_and_match_group_oid, no_shipping_discount, options, packed_by_user, parent_item_index, parent_merchant_item_id, perishable_class, pricing_tier_name, properties, quantity, quantity_refunded, quickbooks_class, refund_reason, return_reason, ship_separately, shipped_by_user, shipped_dts, shipping_status, special_product_type, tags, tax_free, tax_product_type, taxable_cost, total_cost_with_discount, total_refunded, transmitted_to_distribution_center_dts, unit_cost_with_discount, upsell, weight, width].hash\n end",
"def hash\n [apply_discount_to, billing_day, billing_period, billing_period_alignment, billing_timing, custom_field__c, default_quantity, description, discount_level, end_date_condition, finance_information, id, included_units, list_price_base, max_quantity, min_quantity, model, name, number_of_periods, overage_calculation_option, overage_unused_units_credit_option, prepay_periods, price_change_option, price_increase_percentage, pricing, pricing_summary, rating_group, revenue_recognition_rule_name, smoothing_model, specific_billing_period, tax_code, tax_mode, taxable, trigger_event, type, uom, up_to_periods, up_to_periods_type, usage_record_rating_option, use_discount_specific_accounting_code, use_tenant_default_for_price_change].hash\n end",
"def get_voices_hash\n @notes.reduce({}) do |hash, note|\n hash[note.voice] = note\n hash\n end\n end",
"def hash\n [ach_type, routing_number, account_number, account_type, check_number, check_type, product_code, manual_id_info, supplement_id_info, agent_id, terminal_id, registration_id, registration_date, release_type, vip_customer, session_id, terminal_state, terminal_city, ach_bill_to].hash\n end",
"def to_json(obj = invoice)\n return simple_object if @simplify\n\n {\n id: obj.id, issue_date: obj.issue_date, cancelled_at: obj.cancelled_at,\n paid: obj.paid?, payable: obj.payable?, cancellable: invoice.cancellable?,\n receipt_date: obj.receipt_date, payment_link: obj.payment_link,\n number: obj.number, subtotal: obj.subtotal, vat_amount: obj.vat_amount,\n vat_rate: obj.vat_rate, total: obj.total,\n description: obj.description, reference_no: obj.reference_no,\n created_at: obj.created_at, updated_at: obj.updated_at,\n due_date: obj.due_date, currency: obj.currency,\n seller: seller, buyer: buyer, items: items,\n recipient: obj.buyer.billing_email,\n monthly_invoice: obj.monthly_invoice\n }\n end",
"def claim_payment_information\n clp_elements = []\n clp_elements << 'CLP'\n clp_elements << patient_account_number\n clp_elements << claim_type_weight\n clp_elements << eob.amount('total_submitted_charge_for_claim')\n clp_elements << eob.payment_amount_for_output(facility, facility_output_config)\n clp_elements << (clp_elements[2] == 22 ? \"\" : eob.patient_responsibility_amount)\n clp_elements << plan_type\n clp_elements << claim_number\n clp_elements << facility_type_code\n clp_elements << claim_freq_indicator\n clp_elements << nil\n clp_elements << eob.drg_code unless eob.drg_code.blank?\n clp_elements = Output835.trim_segment(clp_elements)\n clp_elements.join(@element_seperator)\n end",
"def hash\n [id, document_date, gl_class, gl_type_id, gl_item_id, sales_code, description, cost, memo, tax_note, vendor_number, account_number, cost_account_number, inventory_account_number, vendor_account_number, item, item_description, sales_description, taxable, item_price, item_cost, unit_of_measure, quantity, total, currency, serialized_flag, serial_numbers, drop_shipped_flag, line_number, warehouse_bin, warehouse_site, sub_category, shipment_method, item_type_xref, inventory_xref, cogs_xref, uom_schedule_xref, price_level_xref, location_xref, tax_code, purchase_header_tax_group, tax_code_xref, tax_rate, tax_agency_xref].hash\n end",
"def getters_return_physical_quantities\n @getters_return_physical_quantities = true\n end",
"def hash\n [article_number, name, quantity, unit_price, discount_percent, vat_percent, unit, temporary_reference, row_number, merchant_data].hash\n end",
"def jde_buyer_invoice_hashes_array\n jde_invoice_hashes_array('member')\n end",
"def hash\n [account_esign_id, allow_cd_withdraw, allow_cd_withdraw_metadata, change_email, change_email_other, company_name, company_phone, copy_cost_per_page, copy_fee_collection_method, copy_request_email, custom, enable_esign, esign_agreement, esign_text, language_code, must_agree_to_esign, pdf_id, use_brand, use_consumer_disclosure_within_account, use_consumer_disclosure_within_account_metadata, withdraw_address_line1, withdraw_address_line2, withdraw_by_email, withdraw_by_mail, withdraw_by_phone, withdraw_city, withdraw_consequences, withdraw_email, withdraw_other, withdraw_phone, withdraw_postal_code, withdraw_state].hash\n end",
"def hash\n [customer, plan, amount, quantity, test, handle, source, create_customer, plan_version, amount_incl_vat, generate_handle, start_date, end_date, grace_duration, no_trial, no_setup_fee, subscription_discounts, coupon_codes, add_ons, additional_costs, signup_method, conditional_create].hash\n end",
"def hash\n [reference, create_date_time_utc, refund_number, status, amount_to_refund, converted_amount_to_refund, converted_currency, conversion_rate, steps, attributes].hash\n end",
"def prepare_report_detail()\n Ruport::Data::Table.new( :column_names => self.class.report_detail_symbols() ) { |t|\n t << self.to_a_s( self.class.report_detail_symbols(), CONVERTED_FLOAT2STRING_FIXED_PRECISION, 8 )\n percentage_amount = 0.0\n if self.patient && self.patient.is_a_firm? && self.patient.is_fiscal?\n account_percent = AppParameterCustomizations.get_receipt_account_percent()\n percentage_amount = self.account_percentage_amount( account_percent )\n t << ['',\n I18n.t(:vat_withholding),\n \"#{Format.float_value( account_percent, 0, CONVERTED_PERCENT2STRING_FIXED_LENGTH )} %\",\n Format.float_value( percentage_amount, 2, CONVERTED_FLOAT2STRING_FIXED_LENGTH )\n ]\n end\n costs = self.get_additional_cost_totals()\n total_amount = (self.net_price() + percentage_amount + costs[:positive] - costs[:negative])\n t << ['',\n '',\n \"<i>#{I18n.t(:to_be_payed, {:scope=>[:receipt]})}:</i>\",\n \"<b>#{Format.float_value( total_amount, 2, CONVERTED_FLOAT2STRING_FIXED_LENGTH )}</b>\"\n ]\n }\n end",
"def hash\n [accounting, amember, auto_order, ccbill, channel_partner_item_mappings, chargeback, checkout, content, creation_dts, description, description_translated_text_instance_oid, digital_delivery, ebay, email_notifications, enrollment123, fulfillment_addons, gift_certificate, google_product_search, identifiers, inactive, instant_payment_notifications, internal, kit, kit_component_only, kit_definition, last_modified_dts, merchant_id, merchant_item_id, merchant_item_oid, options, parent_category_id, parent_category_path, payment_processing, physical, pricing, properties, realtime_pricing, recommend_replenishment_days, related, reporting, restriction, revguard, reviews, salesforce, shipping, tags, tax, third_party_email_marketing, variant_items, variations, wishlist_member].hash\n end",
"def attr\n {\n rfc: 'Rfc',\n name: 'Nombre',\n tax_residency: 'ResidenciaFiscal',\n entity_register_id: 'NumRegIdTrib',\n cfdi_usage: 'UsoCFDI'\n }\n end",
"def hash\n [income_type, description, tax_rate, tax_amount, tax_amount_no_vat, withheld, total, vat_type].hash\n end",
"def build_detail_fee_based\n details = self.invoice_details.new(:created_user => self.created_user, :record_type => InvoiceDetail::FEE, :provider_name => 'a',\n :patient_name => 'a', :dos => Date.today, :disposition => InvoiceDetail::INCLUDE)\n end",
"def to_hash\n hash = {}\n AssetDeviceContractInformationAllOf.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = AssetDeviceContractInformationAllOf.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n\n hash[param] = _to_hash(value)\n end\n hash\n end",
"def metadata\n out_hash = {}.with_indifferent_access\n %i[doi upload_type publication_date title creators description access_right license\n keywords notes related_identifiers method locations communities].each do |meth|\n next if meth == 'doi' && @dataset_type != :data\n\n result = send(meth)\n out_hash[meth] = result unless result.blank?\n end\n out_hash\n end",
"def hash\n [merchant_ref, transaction_type, original_transaction_type, original_transaction_id, amount, currency_code, customer, billing_address, device, loyalty, payment, merchant, order, user_defined].hash\n end",
"def hash\n [affiliate_rate, campaign_id, category, client_review, create_date, currency_code, description, document_id, fee_amount, fee_type, financial_rate, financial_rate_term, financial_rate_term_unit, financial_rate_type, id, image, institution_name, is_active, metadata, minimum_contribution, minimum_contribution_term, minimum_contribution_term_unit, name, node_map, offer_link, offer_term, offer_term_unit, prerequisite, prerequisite_type, rating, secondary_id, subcategory, update_date].hash\n end",
"def service_payment_information\n service_payment_elements =[]\n service_payment_elements << 'SVC'\n service_payment_elements << composite_med_proc_id\n service_payment_elements << service.amount('service_procedure_charge_amount')\n service_payment_elements << service.amount('service_paid_amount')\n service_payment_elements << svc_revenue_code\n service_payment_elements << service.service_quantity.to_f.to_amount\n service_payment_elements = Output835.trim_segment(service_payment_elements)\n service_payment_elements.join(@element_seperator )\n end",
"def cached_ref_data_codes\n { taxes: comp_key('PORTALSERVICES', 'SYS', 'RSTU'), party_account_type: comp_key('PARTY_ACT_TYPES', 'SYS', 'RSTU') }\n end",
"def to_hash\n strategy.adjust_with(line_item) do\n {\n reference: line_item.sku,\n name: line_item.name,\n quantity: line_item.quantity,\n # Minor units. Includes tax, excludes discount.\n unit_price: unit_price,\n # tax rate, e.g. 500 for 5.00%\n tax_rate: line_item_tax_rate,\n # Includes tax and discount. Must match (quantity * unit_price) - total_discount_amount within ±quantity\n total_amount: total_amount,\n # Must be within ±1 of total_amount - total_amount * 10000 / (10000 + tax_rate). Negative when type is discount\n total_tax_amount: total_tax_amount,\n image_url: image_url,\n product_url: product_url\n }\n end\n end",
"def hash\n [additional_properties, currency_code, description, inventory, min_inventory_threshold, not_available, not_displayable, original_price, price, published, sale_id, sale_name, sku, start_date, stop_date].hash\n end",
"def invoice_info\n right_col 0 do\n alternating_text(\"Inv Date: \", \"#{Utils::Date.humanize(@invoice.invoice_date)}\")\n alternating_text(\"Due Date: \", \"#{Utils::Date.humanize(@invoice.due_on_date)}\")\n alternating_text(\"Invoice No: \", \"#{@invoice.invoice_number}\")\n alternating_text(\"Terms: \", \"#{@invoice.terms}\")\n alternating_text(\"Po No: \", \"#{@invoice.po_number}\")\n alternating_text(\"Pre Payment: \", \"#{@invoice.pre_payment ? \"Yes\" : \"No\"}\")\n alternating_text(\"Currency: \", \"#{@invoice.currency.upcase}\")\n end\n end",
"def hash\n [customer_no, customer_name, rma_number, order_no, received_date, close_date, ship_to_name, ship_to_company, ship_to_address, ship_to_address2, ship_to_city, ship_to_state, ship_to_zip_code, ship_to_country, email_address, phone_number, return_warehouse, return_status, disposition_code, return_reason, original_tracking_number, shipping_carrier_code, shippng_service_code, return_sales_order_lines].hash\n end",
"def generate_total_billing\n total = 0\n self.ur_invoices.each do |ur_invoice|\n total += ur_invoice.final_total\n end\n\n self.invoice_items.each do |invoice_item|\n total += invoice_item.charges\n end\n\n total\n end",
"def to_jaxb_json_hash\n _h = {}\n _h['id'] = id.to_jaxb_json_hash unless id.nil?\n if !usageCharges.nil?\n _ha = Array.new\n usageCharges.each { | _item | _ha.push _item.to_jaxb_json_hash }\n _h['usageCharges'] = _ha\n end\n _h['name'] = name.to_jaxb_json_hash unless name.nil?\n _h['vendorParameters'] = vendorParameters.to_jaxb_json_hash unless vendorParameters.nil?\n if !charges.nil?\n _ha = Array.new\n charges.each { | _item | _ha.push _item.to_jaxb_json_hash }\n _h['charges'] = _ha\n end\n return _h\n end",
"def hash\n [bill_date, bill_rate, bonus, commission, created_by_id, created_by_name, discount, end_date, fee, fee_percent, hourly_rate, id, job_open_date, margin, pay_rate, placed_contact_id, placed_contact_name, regarding_id, regarding_title, salary, start_date, time_to_fill, total_hours, value, _when].hash\n end",
"def hash\n [created, next_subscription_name, next_subscription_description, product, product_rate_plan, invoicing_type, mappings, pricing_behaviour, dry_run].hash\n end",
"def consignment_fee\n hash[\"ConsignmentFee\"]\n end",
"def activities_as_invoice_items\n activities_with_prices.map { |a| a.to_invoice_item(full_name) }\n end",
"def formatted_cache_data\n {\n id: id,\n name: name,\n symbol: symbol,\n decimal: decimal,\n contract_address: contract_address,\n constants: constants,\n status: status\n }\n end",
"def hash\n [airline_data, amount, avs_postcode_policy, bill_to, card_holder_name, cardnumber, csc, csc_policy, currency, duplicate_policy, expmonth, expyear, external_mpi, identifier, match_avsa, mcc6012, merchantid, sdk, ship_to, threedsecure, trans_info, trans_type].hash\n end",
"def service_payment_information\n service_payment_elements =[]\n service_payment_elements << 'SVC'\n service_payment_elements << composite_med_proc_id\n service_payment_elements << service.amount('service_procedure_charge_amount')\n service_payment_elements << service.amount('service_paid_amount')\n service_payment_elements << revenue_code\n service_payment_elements.join(@element_seperator )\n end",
"def hash_data(item)\n { item: item, barcode: item.sample.properties.fetch('Barcode ID') }\n end",
"def as_json\n {\n id: id,\n name: name, \n price: price, \n description: description, \n # images: images,\n is_discounted?: is_discounted?,\n tax: tax,\n total: total,\n supplier_id: supplier.as_json,\n }\n end",
"def hash\n [is_blueprint_copy, is_included, item_id, material_efficiency, quantity, record_id, runs, time_efficiency, type_id].hash\n end",
"def lookups\n (instance_type::INTERNAL_ATTRIBUTES + @mapping.salesforce_fields).uniq.join(\", \")\n end",
"def hash\n [cusip, ticker, security_name, security_type, title_of_class, stock_exchange, filing_date, value, amount, type, investment_discretion, other_manager, sole_voting_authority, shared_voting_authority, no_voting_authority].hash\n end",
"def hash\n [additional_line_item_data, allow_invoice_download, allowed_payment_method_configurations, currency, id, integrated_payment_form_enabled, language, login_name, name, payment_app_version, payment_installed, payment_proxy_path, planned_purge_date, replace_payment_method_image, shop_name, show_payment_information, show_subscription_information, space_id, space_view_id, state, subscription_app_version, subscription_installed, subscription_proxy_path, version].hash\n end",
"def store_attributes name, meters, rate, cost, uom, usage, confidence, invoice_rate, days=nil\r\n hash = {}\r\n if !name.blank?\r\n hash[:name] = name\r\n end\r\n if !meters.blank?\r\n hash[:meters] = meters\r\n end\r\n if !rate.blank?\r\n if(rate.class.eql?(String) && rate[0].eql?('$'))\r\n rate = rate[1...rate.size]\r\n end\r\n hash[:rate] = rate.to_f\r\n end\r\n if !cost.blank?\r\n hash[:cost] = cost\r\n end\r\n if !uom.blank?\r\n hash[:uom] = uom\r\n end\r\n if !usage.blank?\r\n hash[:usage] = usage\r\n end \r\n if !confidence.blank?\r\n hash[:confidence] = confidence\r\n end \r\n if !invoice_rate.blank?\r\n hash[:invoice_rate] = invoice_rate\r\n end \r\n if !days.blank?\r\n hash[:days] = days\r\n end\r\n self.charge_attributes = hash\r\n end",
"def hash\n [id, _info, actual_end, actual_hours, actual_start, agreement, bill_expenses, billing_amount, billing_attention, billing_method, billing_rate_type, billing_terms, bill_products, bill_project_after_closed_flag, bill_time, bill_to_company, bill_to_contact, bill_to_site, bill_unapproved_time_and_expense, board, budget_analysis, budget_flag, budget_hours, business_unit_id, company, contact, customer_po, description, downpayment, estimated_end, estimated_expense_revenue, estimated_hours, estimated_product_revenue, estimated_start, estimated_time_revenue, expense_approver, include_dependencies_flag, include_estimates_flag, location_id, manager, name, opportunity, project_template_id, restrict_down_payment_flag, scheduled_end, scheduled_hours, scheduled_start, ship_to_company, ship_to_contact, ship_to_site, site, status, time_approver, type].hash\n end",
"def test_invoice_for_Affiliate_customer\n Customer.expects(:gets).returns('A')\n invoice = Invoicing.new\n invoice.generate_invoice\n assert_equal 228, invoice.total_bill\n assert_equal 10, invoice.customer_discount\n assert_equal 21, invoice.total_discount.total_percentage_discount_apllied_to_bill\n assert_equal 10, invoice.total_discount.total_hundred_dollor_discount_apllied_to_bill\n assert_equal 31, invoice.total_discount.total_discount_apllied_to_bill\n assert_equal 197, invoice.amount_to_pay\n end",
"def hash\n [id, ordertext, amount, vat, quantity, origin, timestamp, discounted_amount, amount_vat, amount_ex_vat, unit_amount, unit_amount_vat, unit_amount_ex_vat, amount_defined_incl_vat, origin_handle, period_from, period_to, discount_percentage, discounted_order_line].hash\n end",
"def hash\n [system_id, policy, registration_type, name, acronym, system_owner, organization_name, version_release_no, system_type, authorization_status, authorization_date, authorization_termination_date, confidentiality, integrity, availability, ditpr_id, ditpr_don_id, mac, dod_confidentiality, contingency_plan_tested, contingency_plan_test_date, security_review_date, has_open_poam_item, has_open_poam_item90to120_past_scheduled_completion_date, has_open_poam_item120_plus_past_scheudled_completion_date].hash\n end",
"def hash\n [account_id, product, product_rate_plan, organization_id, name, description, start, _end, state, trial_end, type, parent_id, aggregate_all_subscriptions_on_account, align_period_with_aggregating_subscription, pricing_component_quantities, metadata, payment_terms, purchase_order, contract_start, failed_payment_behaviour, prepayment_amount].hash\n end",
"def hash\n [id, rfc, legal_name, commercial_name, credit_days, credit_amount, payment_method, creation_date, status, sales_contact, credit_contact, loctaion, comments, price_list, payment_term_type, email, telephones, number, account_number, default_discount, client_source, account, addresses].hash\n end",
"def test_invoice_for_value_customer\n Customer.expects(:gets).returns('V')\n invoice = Invoicing.new\n invoice.generate_invoice\n assert_equal 228, invoice.total_bill\n assert_equal 5, invoice.customer_discount\n assert_equal 10, invoice.total_discount.total_percentage_discount_apllied_to_bill\n assert_equal 10, invoice.total_discount.total_hundred_dollor_discount_apllied_to_bill\n assert_equal 20, invoice.total_discount.total_discount_apllied_to_bill\n assert_equal 208, invoice.amount_to_pay\n end",
"def get_voices()\n voices = {}\n soap_map_obj_array = @api.getVoices('').getVoicesResult[\"Voice\"]\n soap_map_obj_array.each do |map_obj|\n voices.merge!(map_obj[\"VoiceID\"].to_i => { :name => map_obj[\"VoiceName\"],\n :gender => map_obj[\"VoiceGender\"],\n :age => map_obj[\"VoiceAge\"],\n :language => map_obj[\"VoiceLanguage\"],\n :summary => map_obj[\"VoiceSummary\"] })\n end\n voices\n end",
"def product_data\n AsinOMator::Product.new(asin: @asin).data\n end",
"def hash\n [name, description, timezone, currency, case_sensitivity, attributes, limits, campaign_priority, exclusive_campaigns_strategy, default_discount_scope, enable_cascading_discounts, enable_flattened_cart_items, attributes_settings, sandbox, enable_partial_discounts, default_discount_additional_cost_per_item_scope].hash\n end",
"def line_item(item)\n {\n Name: item.product.name,\n Number: item.variant.sku,\n Quantity: item.quantity,\n Amount: {\n currencyID: item.order.currency,\n value: item.price\n },\n ItemCategory: 'Physical'\n }\n end",
"def to_hash\n hash = {}\n StoragePhysicalDiskAllOf.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = StoragePhysicalDiskAllOf.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n\n hash[param] = _to_hash(value)\n end\n hash\n end",
"def recurring_charges\n data.recurring_charges\n end",
"def details\n details_hash = {}\n details_hash['total_value'] = total_value\n details_hash['address'] = @address\n details_hash\n end",
"def youdoinvoice_fix( product )\n product_hash = { }\n # Columns map for YouDoInvoice layout\n col_names = [ :code,\n :description,\n :barcode,\n :ncm,\n :ipi,\n :gender,\n :unity,\n :value,\n :barcode,\n :unity,\n :value,\n :stock ]\n\n product = product[2..-2]\n product.split(\"|\").each.with_index do |value, index|\n product_hash[ col_names[index] ] = value if not value.empty?\n end\n product_hash\n end",
"def get_fee_params(npo_ein = '68-0480736')\n {\n DonationLineItems: {\n DonationItem: {\n NpoEin: npo_ein,\n Designation: 'annual_fund',\n Dedication: 'For my grandfather',\n donorVis: 'ProvideAll',\n ItemAmount: 100.00,\n RecurType: 'NotRecurring',\n AddOrDeduct: 'Add',\n TransactionType: 'Donation'\n }\n },\n TipAmount: 1.00,\n CardType: 'Visa'\n }\nend",
"def data_for_hyacinth_ds\n data = super\n data[DIGITAL_OBJECT_DATA_KEY] = Marshal.load(Marshal.dump(@publish_target_data))\n data\n end",
"def detail_material\n mass * material.price_per_kg / 1000\n end",
"def read_detail\r\n read_detail_header.read_claim_payments\r\n self\r\n end",
"def json_data\n { id: self.id, membership_id: self.membership_id, amount: self.amount.round(2), paid_by: self.user.full_name, description: self.description, vendor: self.vendor, group_id: self.group.id }\n end",
"def hash\n [description, routing_number, account_number, account_type, signatory, metadata, id, signature_url, bank_name, verified, date_created, date_modified, deleted, object].hash\n end",
"def paid_expense_items\n paid_details.map{|pd| pd.expense_item }\n end",
"def details\n return @description + \"; \" + @firm + \"; \" + @age + \": \" + \"#{@cost}\"\n end",
"def details\n return @description + \"; \" + @manufacturer + \"; \" + @color + \": \" + \"#{@cost}\"\n end",
"def exposed_attributes\n [ :id, :curriculum_core_id, :subject_id, :curriculum_grade_id, :curriculum_area_id,\n :standard, :description1, :description2]\n end",
"def conv_to_json\n {\n :id => self.id,\n :borough_id => self.borough_id,\n :business_quantity => self.business_quantity,\n :woman_quantity => self.woman_quantity,\n :people_quantity => self.people_quantity,\n :man_quantity => self.man_quantity,\n :woman_ceo_quantity => self.woman_ceo_quantity \n }\n end",
"def item_characteristic_curve\n i=0\n out={}\n total={}\n @ds.each do |row|\n tot=@total[i]\n @ds.vectors.each do |f|\n out[f]||= {}\n total[f]||={}\n out[f][tot]||= 0\n total[f][tot]||=0\n out[f][tot]+= row[f]\n total[f][tot]+=1\n end\n i+=1\n end\n total.each do |f,var|\n var.each do |tot,v|\n out[f][tot]=out[f][tot].quo(total[f][tot])\n end\n end\n out\n end",
"def hash\n [property_code, property_name, location, address, total_price, min_daily_rate, contacts, amenities, awards, images, rooms, more_rooms_at_this_hotel].hash\n end",
"def hash\n [created, changed_by, updated, metadata, id, version_id, crm_id, account_id, organization_id, product_id, product_rate_plan_id, parent_id, name, description, type, state, current_period_start, current_period_end, contract_start, subscription_end, current_period_end_explicit, initial_period_start, successful_periods, total_periods, trial_end, dunning, locked, managed_by, version_start, version_end, version_number, credit_enabled, aggregate_all_subscriptions_on_account, pricing_component_values, payment_method_subscription_links, fixed_terms, current_time, time_offset, payment_terms, purchase_order, failed_payment_behaviour].hash\n end"
] |
[
"0.64053595",
"0.6355245",
"0.6251433",
"0.6180573",
"0.61086524",
"0.60006726",
"0.59608144",
"0.5927735",
"0.5782559",
"0.5766123",
"0.5764404",
"0.5759244",
"0.57399523",
"0.5724937",
"0.57041246",
"0.5682993",
"0.56768644",
"0.5669663",
"0.56549877",
"0.5641062",
"0.5634077",
"0.5628454",
"0.56016314",
"0.558598",
"0.55844945",
"0.55748385",
"0.5564712",
"0.5552087",
"0.55450785",
"0.5516029",
"0.5507373",
"0.5476462",
"0.5470397",
"0.5447871",
"0.54373926",
"0.5422766",
"0.54120636",
"0.5409937",
"0.54071355",
"0.5396155",
"0.53918976",
"0.53624326",
"0.5360936",
"0.5359097",
"0.5345454",
"0.53318197",
"0.5329825",
"0.5328147",
"0.5326951",
"0.5326327",
"0.53039676",
"0.5290391",
"0.5284662",
"0.52803147",
"0.5278851",
"0.5277671",
"0.527444",
"0.52696365",
"0.5264683",
"0.52637607",
"0.526079",
"0.52503",
"0.5249282",
"0.5246402",
"0.5245143",
"0.5244099",
"0.524114",
"0.5240023",
"0.5238038",
"0.52366996",
"0.5228481",
"0.52280486",
"0.5224638",
"0.5216066",
"0.52092385",
"0.52072847",
"0.5201143",
"0.5200779",
"0.51985353",
"0.5198273",
"0.5197426",
"0.5186028",
"0.517703",
"0.51745045",
"0.5171143",
"0.5167522",
"0.5165178",
"0.51639485",
"0.51604736",
"0.5158016",
"0.5155271",
"0.5154184",
"0.5148311",
"0.5146003",
"0.51458687",
"0.5145701",
"0.5144953",
"0.51423925",
"0.51422644",
"0.51305497"
] |
0.71880966
|
0
|
GET /firms/1 GET /firms/1.json
|
def show
@firm = Firm.includes(:purchase_interests, :sale_interests).find(params[:id])
@title = t('view.firms.show_title', firm: @firm.nombre)
@purchase_interests = @firm.purchase_interests
@sale_interests = @firm.sale_interests
respond_to do |format|
format.html # show.html.erb
format.json { render json: @firm }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @firms = Firm.all\n end",
"def show\n @firm = Firm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @firm }\n end\n end",
"def index\n @firms = Firm.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @firms }\n end\n end",
"def index\n @filials = Filial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @filials }\n end\n end",
"def index\n\t @fares = Fare.all\n\n\t respond_to do |format|\n\t\tformat.html # index.html.erb\n\t\tformat.json { render json: @fares }\n\t end\n\tend",
"def index\n render json: @fiestas\n end",
"def new\n @title = t('view.firms.new_title')\n @firm = Firm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @firm }\n end\n end",
"def show\n @fire = Fire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fire }\n end\n end",
"def new\n @firm = Firm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @firm }\n end\n end",
"def show\n @flaw = Flaw.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flaw }\n end\n end",
"def show\n @filial = Filial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filial }\n end\n end",
"def show\n @familium = Familium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @familium }\n end\n end",
"def show\n @fundraiser = Fundraiser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundraiser }\n end\n end",
"def show\n @fundraiser = Fundraiser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundraiser }\n end\n end",
"def index\n @formularies = Formulary.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @formularies }\n end\n end",
"def show\n @smurf = Smurf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @smurf }\n end\n end",
"def show\n render json: Festival.build_for(params[:id]).to_json\n end",
"def show\n @rfq = Rfq.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rfq }\n end\n end",
"def show\n begin\n @fucker = Fucker.find(params[:id])\n respond_to do |format|\n format.json { render json: @fucker }\n end\n rescue => err\n $log.warn(err)\n respond_to do |format|\n format.json { render json: err, status: :internal_server_error }\n end\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def index\n @familia = Familium.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @familia }\n end\n end",
"def index\n @fretes = Frete.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fretes }\n end\n end",
"def index\n @funds = Fund.all\n\n render json: @funds\n end",
"def show\n @foil = Foil.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foil }\n end\n end",
"def index\n @flaws = Flaw.order(\"date DESC, created_at DESC\").page( params[:page] ).per(10)\n \n @flaw = Flaw.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @flaws }\n end\n end",
"def show\n @flight = Flight.find(params[:id])\n render json: @flight\n end",
"def flights\n trip = Trip.where('id = ?', params[:id]).take\n if !trip.nil\n respond_with( trip.flights )\n else\n render :json => { error: 404 }, :status => 404\n end\n end",
"def show\n @faction = Faction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faction }\n end\n end",
"def show\n @fund = Fund.friendly.find(params[:id])\n\n render json: @fund\n end",
"def show\n require 'net/http'\n require 'json'\n\n response = Net::HTTP.get_response( URI.parse( \"http://freeshit.firebaseio.com/items/%s.json\" % [ params[:id] ] ) );\n\n begin\n @fb_item = JSON.parse(response.body)\n rescue\n render :status => 404, :text => 'Item not found.'\n return\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fb_item }\n end\n end",
"def index\n @flights = Flight.all\n render json: @flights\n end",
"def index\n @farms = Farm.all\n\t\trespond_with(@users,@farms)\n end",
"def index\n @factions = Faction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @factions }\n end\n end",
"def new\n @law_firms = LawFirm.all\n end",
"def show\n render json: @fund\n end",
"def show\n @foiltype = Foiltype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foiltype }\n end\n end",
"def show\n @foam = Foam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foam }\n end\n end",
"def index\n @foros = Foro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foros }\n end\n end",
"def show\n @farm = Farm.find(params[:id])\n @herds = Herd.where(:farm_id => @farm.id)\n respond_to do |format|\n format.html # index.html.erbb\n format.json { render :json => @farm }\n end\n end",
"def show\n @flat_happening = FlatHappening.find(params[:id])\n\n render json: @flat_happening\n end",
"def set_firma\n @firma = Firma.find(params[:id])\n end",
"def show\n @forest = Forest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @forest }\n end\n end",
"def show\n @fluxomatricula = Fluxomatricula.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fluxomatricula }\n end\n end",
"def show\n @farm = Farm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @farm }\n end\n end",
"def show\n @fortune = Fortune.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fortune }\n end\n end",
"def show\n @formulary = Formulary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @formulary }\n end\n end",
"def show\n @firm = Firm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @firm }\n end\n end",
"def index\n\t\t@flights = Flight.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @flights }\n\t\tend\n\tend",
"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 show\n @flight = Flight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flight }\n end\n end",
"def show\n @flight = Flight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flight }\n end\n end",
"def new\n @flaw = Flaw.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flaw }\n end\n end",
"def index\n @konfirms = Konfirm.all\n end",
"def show\n @fec_filing = FecFiling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @fec_filing }\n end\n end",
"def show\n @fec_filing = FecFiling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @fec_filing }\n end\n end",
"def show\n @finance = Finance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finance }\n end\n end",
"def index \n fans = Fan.all \n render json: fans \n end",
"def show\n\t @fare = Fare.find(params[:id])\n\n\t respond_to do |format|\n\t\tformat.html # show.html.erb\n\t\tformat.json { render json: @fare }\n\t end\n\tend",
"def show\n @bio_signal = BioSignal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bio_signal }\n end\n end",
"def index\n @frats = Frat.all\n end",
"def index\n @filled_forms = FilledForm.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @filled_forms }\n end\n end",
"def show\n @financial = Financial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial }\n end\n end",
"def show\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spoofer }\n end\n end",
"def index\n @ftypes = Ftype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ftypes }\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 InfoFarmacia\n \tid = params[:id]\n @farmacias = Farmacium.find_by_sql(\"SELECT nombre, correo, direccion, latitud, longitud, telefono1, telefono2 FROM farmacia where id = #{id}\")\n render json: @farmacias\n end",
"def index\n @frais_hebergements = FraisHebergement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_hebergements }\n end\n end",
"def show\n @frais_repa = FraisRepa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @frais_repa }\n end\n end",
"def index\n @arrivals = Arrival.all\n\n respond_to do |format|\n format.html # fill.html.erb format.json { render json: @arrivals }\n end\n end",
"def show\n @foro = Foro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foro }\n end\n end",
"def index\n @foodhampers = Foodhamper.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foodhampers }\n end\n end",
"def show\n @fred = Fred.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fred }\n end\n end",
"def index\n @frais_repas = FraisRepa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_repas }\n end\n end",
"def show\n @flsa_result = FlsaResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flsa_result }\n end\n end",
"def index\n @financers = Financer.all\n end",
"def show\n @foodhamper = Foodhamper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foodhamper }\n end\n end",
"def show\n @favorite_flyer = FavoriteFlyer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @favorite_flyer }\n end\n end",
"def index\n @monthly_finances = MonthlyFinance.all\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @monthly_finances }\n # end\n end",
"def show\n\t\t@flight = Flight.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @flight }\n\t\tend\n\tend",
"def show\n @basis = Base.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @basis }\n end\n end",
"def show\n @frete = Frete.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @frete }\n end\n end",
"def index\n weathers = Weather.all\n render json: weathers, status: 200\n end",
"def new\n @fire = Fire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fire }\n end\n end",
"def show\n @getoff_infos = GetoffInfo.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @getoff_info }\n end\n \n end",
"def show\n @passivo_circulante_financeiro = PassivoCirculanteFinanceiro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @passivo_circulante_financeiro }\n end\n end",
"def show\n @company_financial = CompanyFinancial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company_financial }\n end\n end",
"def show\n @frais_annex = FraisAnnex.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @frais_annex }\n end\n end",
"def show\n \n @firm = Firm.find_by_subdomain!(request.subdomain)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @firm }\n format.js\n end\n end",
"def show\n @finance_inflow = FinanceInflow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finance_inflow }\n end\n end",
"def show\n @core_uf = Core::Uf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @core_uf }\n end\n end",
"def show\n\n respond_to do |format|\n format.html { # show.html.erb\n @flyer_info = FlyerInfo.find(params[:id])\n }\n format.json {\n render json: getflyer(params[:id])\n }\n end\n\n end",
"def show\n @family = get_family(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def show\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fabric }\n end\n end",
"def show\n @monthly_finance = MonthlyFinance.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monthly_finance }\n end\n end",
"def show\n # render json: @birthday_party\n end",
"def show\n @fhir_base_url = FhirBaseUrl.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to :action => :edit }\n format.json { render json: @fhir_base_url }\n end\n end",
"def index\n @spoofers = Spoofer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spoofers }\n end\n end",
"def new\n @filial = Filial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @filial }\n end\n end",
"def new\n @filial = Filial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @filial }\n end\n end",
"def show\n @films_box = FilmsBox.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @films_box }\n end\n end"
] |
[
"0.7018747",
"0.6852658",
"0.6608477",
"0.64353496",
"0.63154423",
"0.6314451",
"0.6282768",
"0.6275277",
"0.6249425",
"0.6238645",
"0.6197469",
"0.6121839",
"0.6101825",
"0.6101825",
"0.6055197",
"0.6044669",
"0.6039131",
"0.60341763",
"0.6030308",
"0.6029244",
"0.6003676",
"0.60010225",
"0.5990158",
"0.5985642",
"0.59640425",
"0.5958015",
"0.5946698",
"0.5930488",
"0.5920786",
"0.5914547",
"0.59097344",
"0.5887575",
"0.5884989",
"0.58752775",
"0.58736026",
"0.5869387",
"0.5851437",
"0.584561",
"0.5825717",
"0.5817805",
"0.58176744",
"0.5803458",
"0.57944524",
"0.5790698",
"0.57804704",
"0.57758135",
"0.57685846",
"0.5762874",
"0.57592",
"0.575642",
"0.57562876",
"0.5753508",
"0.57498765",
"0.5748529",
"0.5748529",
"0.5745153",
"0.5731514",
"0.5730069",
"0.5723765",
"0.57191634",
"0.57174766",
"0.57173896",
"0.5715677",
"0.57073176",
"0.57059944",
"0.56933296",
"0.56925106",
"0.56899893",
"0.5688171",
"0.5686756",
"0.56856894",
"0.56814307",
"0.567194",
"0.5671531",
"0.56661505",
"0.5662949",
"0.5661968",
"0.56557554",
"0.56556296",
"0.5655303",
"0.56473273",
"0.564386",
"0.5643738",
"0.56289625",
"0.56277424",
"0.5623384",
"0.56073195",
"0.56060493",
"0.560025",
"0.55995464",
"0.5594601",
"0.5593935",
"0.55903053",
"0.5584168",
"0.5582017",
"0.5581254",
"0.5581058",
"0.55781615",
"0.55781615",
"0.5575842"
] |
0.63953817
|
4
|
GET /firms/new GET /firms/new.json
|
def new
@title = t('view.firms.new_title')
@firm = Firm.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @firm }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @firm = Firm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @firm }\n end\n end",
"def create\n @title = t('view.firms.new_title')\n @firm = Firm.new(params[:firm])\n\n respond_to do |format|\n if @firm.save\n format.html { redirect_to @firm, notice: t('view.firms.correctly_created') }\n format.json { render json: @firm, status: :created, location: @firm }\n else\n format.html { render action: 'new' }\n format.json { render json: @firm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @flaw = Flaw.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flaw }\n end\n end",
"def new\n @foil = Foil.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foil }\n end\n end",
"def new\n @law_firms = LawFirm.all\n end",
"def new\n @fire = Fire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fire }\n end\n end",
"def new\n @foiltype = Foiltype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foiltype }\n end\n end",
"def new\n @foam = Foam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foam }\n end\n end",
"def new\n @farm = Farm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @farm }\n end\n end",
"def new\n @fundraiser = Fundraiser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fundraiser }\n end\n end",
"def new\n @flight = Flight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flight }\n end\n end",
"def new\n \t@firm = Firm.new\n end",
"def new\n @faction = Faction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @faction }\n end\n end",
"def new\n @farm = Farm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @farm }\n end\n end",
"def new\n @contact = Contact.new(:client => @firm, :current_date => Time.now, :next_date => 7.days.from_now.to_date)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def new\n\t @fare = Fare.new\n\n\t respond_to do |format|\n\t\tformat.html # new.html.erb\n\t\tformat.json { render json: @fare }\n\t end\n\tend",
"def new\n render :json => @fiestas.push(params[:fiesta])\n end",
"def new\n @fortune = Fortune.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fortune }\n end\n end",
"def new\n @firm = Firm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @firm }\n end\n end",
"def new\n @smurf = Smurf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @smurf }\n end\n end",
"def new\n @fav = Fav.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fav }\n end\n end",
"def new #GIRO: POST /foals(.:format) foals#create\n@foal = Foal.new #GIRO: http://localhost:3000/foals/new\nend",
"def new\n @flower = Flower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flower }\n end\n end",
"def new\n @title = t('view.trust_funds.new_title')\n @trust_fund = TrustFund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trust_fund }\n end\n end",
"def new\n @family_crest = FamilyCrest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_crest }\n end\n end",
"def new\n @filial = Filial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @filial }\n end\n end",
"def new\n @filial = Filial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @filial }\n end\n end",
"def new\n @finance = Finance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @finance }\n end\n end",
"def new\n @family = Family.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family }\n end\n end",
"def new\n @requisition = Requisition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @requisition }\n end\n end",
"def new\n @foodhamper = Foodhamper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foodhamper }\n end\n end",
"def new\n @fwlist = Fwlist.new\n \t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fwlist }\n end\n end",
"def new\n @financial = Financial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @financial }\n end\n end",
"def create\n @firm = Firm.new(params[:firm])\n\n respond_to do |format|\n if @firm.save\n format.html { redirect_to @firm, notice: 'Empresa criada com sucesso.' }\n format.json { render json: @firm, status: :created, location: @firm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @firm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @frete = Frete.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @frete }\n end\n end",
"def new\n @flight_schedule = FlightSchedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flight_schedule }\n end\n end",
"def new\n @believer = Believer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @believer }\n end\n end",
"def new\n @basis = Base.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @basis }\n end\n end",
"def new\n @party = Party.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @party }\n end\n end",
"def new\n @arrival = Arrival.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arrival }\n end\n end",
"def new\n @arrival = Arrival.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arrival }\n end\n end",
"def new\n @fhir_base_url = FhirBaseUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fhir_base_url }\n end\n end",
"def new\n @fridge = Fridge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fridge }\n end\n end",
"def create\n @firm = Firm.new(firm_params)\n\n respond_to do |format|\n if @firm.save\n format.html { redirect_to @firm, notice: 'Firm was successfully created.' }\n format.json { render :show, status: :created, location: @firm }\n else\n format.html { render :new }\n format.json { render json: @firm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @ftype = Ftype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ftype }\n end\n end",
"def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end",
"def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end",
"def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end",
"def new\n @favorite_flyer = FavoriteFlyer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @favorite_flyer }\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 @pickup = Pickup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pickup }\n end\n end",
"def new\n @getoff_info = GetoffInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @getoff_info }\n end\n end",
"def new\n @fiction = Fiction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fiction }\n end\n end",
"def new\n @fishing_method = FishingMethod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fishing_method }\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 @favourite_listing = FavouriteListing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @favourite_listing }\n end\n end",
"def new\n @fish_type = FishType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fish_type }\n end\n end",
"def new\n @company_financial = CompanyFinancial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company_financial }\n end\n end",
"def new\n @staff = Staff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @staff }\n end\n end",
"def new\n @father = Father.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @father }\n end\n end",
"def new\n @frais_repa = FraisRepa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @frais_repa }\n end\n end",
"def new\n @facility = Facility.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @facility }\n end\n end",
"def new\n @feat = @person.feats.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feat }\n end\n end",
"def new\n @interested = Interested.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interested }\n end\n end",
"def new\n @signature = Signature.new :waiver_id => params[:waiver_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @signature }\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 new\n @taf = Taf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taf }\n end\n end",
"def new\n @finder = Finder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @finder }\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 @dev_folio = DevFolio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dev_folio }\n end\n end",
"def new\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status }\n end\n end",
"def new\n @referee = Referee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @referee }\n end\n end",
"def new\n fetch_data\n @payment = Payment.new(:payment_date => Date.today)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment }\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 @fam = Fam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fam }\n end\n end",
"def new\n @fund = Fund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_fund }\n end\n end",
"def new\n @filter = Filter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @filter }\n end\n end",
"def new\n @filter = Filter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @filter }\n end\n end",
"def new\n @filter = Filter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @filter }\n end\n end",
"def new\n @filter = Filter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @filter }\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",
"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 @family_history = FamilyHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_history }\n end\n end",
"def new\n #@firm = Firm.new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @firm }\n end\n end",
"def new\n @fb_item = FbItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fb_item }\n end\n end",
"def new\n @patent = Patent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patent }\n end\n end",
"def new\n @invite_list = InviteList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite_list }\n end\n end",
"def new\n @fax_typ = FaxTyp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fax_typ }\n end\n end",
"def new\n @fornecedore = Fornecedore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fornecedore }\n end\n end",
"def new\n #@klass_fee = KlassFee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @klass_fee }\n end\n end",
"def new\n @claimant = Claimant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @claimant }\n end\n end",
"def new\n @fueltype = Fueltype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fueltype }\n end\n end"
] |
[
"0.7751174",
"0.73691654",
"0.72218347",
"0.70463496",
"0.70351094",
"0.7019751",
"0.6977956",
"0.6952969",
"0.6941487",
"0.693557",
"0.69337404",
"0.69330966",
"0.69117504",
"0.68867517",
"0.68782175",
"0.6877839",
"0.6862913",
"0.6859532",
"0.68418276",
"0.6840955",
"0.6815453",
"0.6814455",
"0.6799584",
"0.6766315",
"0.6750993",
"0.6748079",
"0.6748079",
"0.6725408",
"0.6723605",
"0.6710224",
"0.67082894",
"0.66977423",
"0.669585",
"0.66942215",
"0.6674116",
"0.6658166",
"0.6631413",
"0.6627467",
"0.6618597",
"0.6617407",
"0.6617407",
"0.6609849",
"0.66076374",
"0.6606368",
"0.6594261",
"0.65705055",
"0.65705055",
"0.65705055",
"0.6563969",
"0.6561497",
"0.6558171",
"0.65533733",
"0.65497226",
"0.6545252",
"0.6532899",
"0.6531674",
"0.6530733",
"0.65198964",
"0.65153354",
"0.6496902",
"0.64946216",
"0.64926404",
"0.64866465",
"0.64833146",
"0.6476761",
"0.64735353",
"0.6469887",
"0.64626473",
"0.6456927",
"0.6455272",
"0.64526117",
"0.64479667",
"0.6447772",
"0.6447553",
"0.6445089",
"0.64429885",
"0.644242",
"0.644242",
"0.644242",
"0.644242",
"0.6438676",
"0.6438676",
"0.6438676",
"0.6438676",
"0.6438676",
"0.6438676",
"0.6438676",
"0.6438676",
"0.6438676",
"0.6438676",
"0.6433413",
"0.64323896",
"0.64279",
"0.6426224",
"0.64215535",
"0.64211303",
"0.64202195",
"0.6417097",
"0.6416938",
"0.64161605"
] |
0.7993061
|
0
|
POST /firms POST /firms.json
|
def create
@title = t('view.firms.new_title')
@firm = Firm.new(params[:firm])
respond_to do |format|
if @firm.save
format.html { redirect_to @firm, notice: t('view.firms.correctly_created') }
format.json { render json: @firm, status: :created, location: @firm }
else
format.html { render action: 'new' }
format.json { render json: @firm.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @firm = Firm.new(firm_params)\n\n respond_to do |format|\n if @firm.save\n format.html { redirect_to @firm, notice: 'Firm was successfully created.' }\n format.json { render :show, status: :created, location: @firm }\n else\n format.html { render :new }\n format.json { render json: @firm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @firm = Firm.new(params[:firm])\n\n respond_to do |format|\n if @firm.save\n format.html { redirect_to @firm, notice: 'Empresa criada com sucesso.' }\n format.json { render json: @firm, status: :created, location: @firm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @firm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @firms = Firm.all\n end",
"def create\n @firmagideri = Firmagideri.new(firmagideri_params)\n\n respond_to do |format|\n if @firmagideri.save\n format.html { redirect_to firmagideris_path, notice: 'Kayıt başarıyla oluşturuldu.' }\n format.json { render :show, status: :created, location: @firmagideri }\n else\n format.html { render :new }\n format.json { render json: @firmagideri.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @title = t('view.firms.new_title')\n @firm = Firm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @firm }\n end\n end",
"def firma_params\n params.require(:firma).permit(:name, :beschreibung, :reederei)\n end",
"def new\n @firm = Firm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @firm }\n end\n end",
"def new\n @law_firms = LawFirm.all\n end",
"def create\n\n friendee = User.where(email: params[:search][:email]).first\n if friendee && Friending.where(friendee_id: current_user.id, friender_id: friendee.id).empty? && Friending.where(friendee_id: friendee.id , friender_id: current_user.id).empty?\n @friending = Friending.new()\n @friending.friender_id = current_user.id\n @friending.friendee_id = friendee.id\n\n if @friending.save\n render \"api/friendings/show\"\n else\n render json: @friending.errors.full_messages, status: 401\n end\n\n else\n render json: [\"Email address is not registered with EqualSlices.\"],\n status: 401\n end\n end",
"def create\n @friday = Friday.new(friday_params)\n\n respond_to do |format|\n if @friday.save\n format.html { redirect_to @friday, notice: \"Friday was successfully created.\" }\n format.json { render :show, status: :created, location: @friday }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friday.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @firms = Firm.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @firms }\n end\n end",
"def create\n @fiestum = Fiestum.new(fiestum_params)\n\n respond_to do |format|\n if @fiestum.save\n format.html { redirect_to @fiestum, notice: 'Fiestum was successfully created.' }\n format.json { render :show, status: :created, location: @fiestum }\n else\n format.html { render :new }\n format.json { render json: @fiestum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n # Rails.logger.warn \"====================\"\n # Rails.logger.warn foaf_params[:interests_attributes]\n # Rails.logger.warn \"====================\"\n\n \n @foaf = Foaf.new(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n end\n end\n\n respond_to do |format|\n if @foaf.save \n format.html { redirect_to @foaf, notice: 'FOAF was successfully created.' }\n format.json { render action: 'show', status: :created, location: @foaf }\n else\n format.html { render action: 'new' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fire = Fire.new(params[:fire])\n\n respond_to do |format|\n if @fire.save\n format.html { redirect_to @fire, notice: 'Fire was successfully created.' }\n format.json { render json: @fire, status: :created, location: @fire }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fire.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fpsignal = Fpsignal.new(fpsignal_params)\n\n respond_to do |format|\n if @fpsignal.save\n format.html { redirect_to fpsignals_path, notice: 'Запись успешно добавлена.' }\n format.json { render :show, status: :created, location: fpsignals_path }\n else\n format.html { render :new }\n format.json { render json: @fpsignal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @frat = Frat.new(frat_params)\n\n respond_to do |format|\n if @frat.save\n format.html { redirect_to @frat, notice: 'Frat was successfully created.' }\n format.json { render action: 'show', status: :created, location: @frat }\n else\n format.html { render action: 'new' }\n format.json { render json: @frat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flair = Flair.new(flair_params)\n\n respond_to do |format|\n if @flair.save\n format.html { redirect_to @flair, notice: 'Flair was successfully created.' }\n format.json { render :show, status: :created, location: @flair }\n else\n format.html { render :new }\n format.json { render json: @flair.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n # Rails.logger.warn \"====================\"\n # Rails.logger.warn foaf_params[:interests_attributes]\n # Rails.logger.warn \"====================\"\n\n \n @foaf = Foaf.new(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n end\n end\n\n respond_to do |format|\n if @foaf.save \n format.html { redirect_to @foaf, notice: 'Foaf was successfully created.' }\n format.json { render action: 'show', status: :created, location: @foaf }\n else\n format.html { render action: 'new' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fund = Fund.new(fund_params)\n\n if @fund.save\n render json: @fund, status: :created, location: @fund\n else\n render json: @fund.errors, status: :unprocessable_entity\n end\n end",
"def create\n @invited_fiend = InvitedFiend.new(invited_fiend_params)\n\n respond_to do |format|\n if @invited_fiend.save\n format.html { redirect_to @invited_fiend, notice: 'Invited fiend was successfully created.' }\n format.json { render :show, status: :created, location: @invited_fiend }\n else\n format.html { render :new }\n format.json { render json: @invited_fiend.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @smurf = Smurf.new(params[:smurf])\n\n respond_to do |format|\n if @smurf.save\n format.html { redirect_to @smurf, notice: 'Smurf was successfully created.' }\n format.json { render json: @smurf, status: :created, location: @smurf }\n else\n format.html { render action: \"new\" }\n format.json { render json: @smurf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_firma\n @firma = Firma.find(params[:id])\n end",
"def create\n @fundraiser = Fundraiser.new(params[:fundraiser])\n\n respond_to do |format|\n if @fundraiser.save\n format.html { redirect_to @fundraiser, notice: 'Fundraiser was successfully created.' }\n format.json { render json: @fundraiser, status: :created, location: @fundraiser }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fundraiser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fire = Fire.new(fire_params)\n @emergency = Emergency.find(@fire.emergency_id)\n respond_to do |format|\n if @fire.save\n format.html { redirect_to @fire, notice: 'La informacion del formulario de incendios fue registrada con exito.' }\n format.json { render :show, status: :created, location: @fire }\n else\n format.html { render :new }\n format.json { render json: @fire.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @farm = Farm.new(farm_params)\n\n respond_to do |format|\n if @farm.save\n format.html { redirect_to @farm, notice: '農家登録が完了しました。' }\n format.json { render :show, status: :created, location: @farm }\n else\n format.html { render :new }\n format.json { render json: @farm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def submit_form_0966\n ClaimsApi::Logger.log('itf', detail: '0966 - Request Started')\n validate_json_schema\n validate_veteran_identifiers(require_birls: true)\n check_for_invalid_burial_submission! if form_type == 'burial'\n ClaimsApi::Logger.log('itf', detail: '0966 - Controller Actions Completed')\n\n bgs_response = local_bgs_service.insert_intent_to_file(intent_to_file_options)\n if bgs_response.empty?\n ClaimsApi::IntentToFile.create!(status: ClaimsApi::IntentToFile::ERRORED, cid: token.payload['cid'])\n raise ::Common::Exceptions::ResourceNotFound.new(detail: 'Veteran ID not found')\n else\n ClaimsApi::IntentToFile.create!(status: ClaimsApi::IntentToFile::SUBMITTED, cid: token.payload['cid'])\n ClaimsApi::Logger.log('itf', detail: 'Submitted to BGS')\n render json: bgs_response,\n serializer: ClaimsApi::IntentToFileSerializer\n end\n end",
"def create\n @farm = Farm.new(params[:farm])\n @farm.save\n respond_with(@farm)\n end",
"def create\n @firma = Firma.new(firma_params)\n @redirect_params = params[:redirect_params] ? params[:redirect_params] : (flash[:redirect_params] ? flash[:redirect_params] : @firma)\n\n respond_to do |format|\n if @firma.save\n flash[:success] = \"Firma angelegt\"\n format.html { redirect_to @redirect_params }\n format.json { render :show, status: :created, location: @firma }\n else\n format.html { render :new }\n format.json { render json: @firma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n render :json => @fiestas.push(params[:fiesta])\n end",
"def create\n\n user = params[:user]\n \n #abort(\"user #{user}\")\n\n from_id = user[:fb_id]\n\n existing_fb_user = User.find_by_fb_id(from_id)\n\n if existing_fb_user\n \n user_invitations = user[:invitations]\n \n @invitations_array = []\n\n user_invitations.each do |inv|\n\n inv[:fb_id] = from_id\n inv[:is_accept] = false\n inv[:isPoints] = false\n\n\n @invitation = Invitation.new(inv)\n\n @invitations_array.push(inv) \n\n render :json => { :errors => @invitation.errors.full_messages } unless @invitation.save\n\n end\n\n Invitation.new.getInvitations(@invitations_array)\n\n else\n render :json => { :message => \"No user found\" }\n end\n \n end",
"def create\n @furdo = Furdo.new(furdo_params)\n\n respond_to do |format|\n if @furdo.save\n format.html { redirect_to @furdo, notice: 'Furdo was successfully created.' }\n format.json { render :show, status: :created, location: @furdo }\n else\n format.html { render :new }\n format.json { render json: @furdo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @frind = Frind.new(frind_params)\n @frind = current_user.frinds.build(frind_params)\n respond_to do |format|\n if @frind.save\n format.html { redirect_to @frind, notice: 'Frind was successfully created.' }\n format.json { render :show, status: :created, location: @frind }\n else\n format.html { render :new }\n format.json { render json: @frind.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fundraiser = Fundraiser.new(fundraiser_params)\n @fundraiser.owner_id = current_user.id\n @fundraiser.start_date = Date.current\n @fundraiser.raised = 0\n respond_to do |format|\n if @fundraiser.save\n format.html { redirect_to @fundraiser, notice: 'Fundraiser was successfully created.' }\n format.json { render :show, status: :created, location: @fundraiser }\n else\n format.html { render :new }\n format.json { render json: @fundraiser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n render json: @fiestas\n end",
"def create\n origin = params[:fare][:origin]\n destination = params[:fare][:destination]\n\n \tuber = calculate_uber(origin, destination)\n lyft = calculate_lyft(origin, destination)\n\n if uber and lyft\n render json: [\n {\n company: 'uber', \n id: 1, \n price: uber, \n image: '/assets/uber.png'\n },\n {\n company: 'lyft',\n id: 2,\n price: lyft,\n image: '/assets/lyft.png'\n }], status: 200\n else\n render status: 500\n end\n\n end",
"def create\n @feira = Feira.new(feira_params)\n\n respond_to do |format|\n if @feira.save\n format.html { redirect_to @feira, notice: 'Feira was successfully created.' }\n format.json { render :show, status: :created, location: @feira }\n else\n format.html { render :new }\n format.json { render json: @feira.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @framing_saw = FramingSaw.new(framing_saw_params)\n\n respond_to do |format|\n if @framing_saw.save\n format.html { redirect_to @framing_saw, notice: 'Framing saw was successfully created.' }\n format.json { render action: 'show', status: :created, location: @framing_saw }\n else\n format.html { render action: 'new' }\n format.json { render json: @framing_saw.errors, status: :unprocessable_entity }\n end\n\n end\n end",
"def create\n @flaw = Flaw.new(flaw_params)\n\n respond_to do |format|\n if @flaw.save\n format.html { redirect_to @flaw, notice: 'Flaw was successfully created.' }\n format.json { render :show, status: :created, location: @flaw }\n else\n format.html { render :new }\n format.json { render json: @flaw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @firm = Firm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @firm }\n end\n end",
"def create\n @filial = Filial.new(params[:filial])\n\n respond_to do |format|\n if @filial.save\n format.html { redirect_to filials_path, notice: 'Filial was successfully created.' }\n format.json { render json: @filial, status: :created, location: @filial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @filial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @flaw = Flaw.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flaw }\n end\n end",
"def create\n @fund = Fund.new(fund_params)\n\n if @fund.save\n render json: @fund, status: :created,\n location: api_v1_fund_path(@fund)\n else\n render_validation_errors @fund.errors\n end\n end",
"def create\n @auction_foregift = AuctionForegift.new(auction_foregift_params)\n\n respond_to do |format|\n if @auction_foregift.save\n format.html { redirect_to @auction_foregift, notice: 'Auction foregift was successfully created.' }\n format.json { render :show, status: :created, location: @auction_foregift }\n else\n format.html { render :new }\n format.json { render json: @auction_foregift.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @survey = Survey.find(params[:survey_id])\n emoji = params[:emoji]\n mood = params[:mood]\n @feeling = Feeling.new(mood: mood, emoji: emoji)\n @survey.feelings << @feeling\n\n if @feeling.save\n render :ok, json: @feeling\n else\n @errors = @feelings.error.full_messages\n render json: {message: @errors}, status: :unprocessable_entity\n end\n\n if !@survey\n render json: {message: [\"Survey is Required!\"] }, status: :unprocessable_entity\n end\n end",
"def index\n @flaws = Flaw.order(\"date DESC, created_at DESC\").page( params[:page] ).per(10)\n \n @flaw = Flaw.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @flaws }\n end\n end",
"def index\n @faves_arr = []\n @favourites = current_user.favourites.map do |fave|\n @faves_arr << Location.find_by_id(fave.location_id)\n end\n\n render json: @faves_arr.map(&:transform_json), status: 201\n end",
"def create\n @freind = Freind.new(freind_params)\n\n respond_to do |format|\n if @freind.save\n format.html { redirect_to @freind, notice: \"Freind was successfully created.\" }\n format.json { render :show, status: :created, location: @freind }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @freind.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @farm = Farm.new(farm_params)\n\n if @farm.save\n render :show, status: :created, location: api_farm_url(@farm)\n else\n render json: @farm.errors, status: :unprocessable_entity\n end\n end",
"def creacion\n fiesta = Fiesta.new (params[:id])\n if Fiesta.save\n puts \"su fiesta a sido registrada\"\n else \n puts \"su fiesta no a sido registrada\"\n end\n render = json: fiesta \n end",
"def new\n @fire = Fire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fire }\n end\n end",
"def create\n @filial = Filial.new(params[:filial])\n\n respond_to do |format|\n if @filial.save\n format.html { redirect_to @filial, notice: 'Filial was successfully created.' }\n format.json { render json: @filial, status: :created, location: @filial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @filial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @black_friday = BlackFriday.new(black_friday_params)\n\n respond_to do |format|\n if @black_friday.save\n format.html { redirect_to @black_friday, notice: 'Black friday was successfully created.' }\n format.json { render :show, status: :created, location: @black_friday }\n else\n format.html { render :new }\n format.json { render json: @black_friday.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fuel_issued = FuelIssued.new(fuel_issued_params)\n\n respond_to do |format|\n if @fuel_issued.save\n format.html { redirect_to @fuel_issued, notice: (t 'fuel_issueds.title')+(t 'actions.created') }\n format.json { render action: 'show', status: :created, location: @fuel_issued }\n else\n format.html { render action: 'new' }\n format.json { render json: @fuel_issued.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @filials = Filial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @filials }\n end\n end",
"def create\n @iceandfire = Iceandfire.new(iceandfire_params)\n\n respond_to do |format|\n if @iceandfire.save\n format.html { redirect_to @iceandfire, notice: 'Reading List was successfully created.' }\n format.json { render :show, status: :created, location: @iceandfire }\n else\n format.html { render :new }\n format.json { render json: @iceandfire.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @firm = Firm.new(params[:firm])\n\t@firm.subdomain = @firm.subdomain.downcase\n respond_to do |format|\n if @firm.save\n flash[:notice] = 'Firm was successfully created! Now create the first user.'\n format.html { redirect_to(register_user_path(@firm)) }\n \n else\n \tflash[:error] = 'Firm could not be created'\n format.html { render \"public/register\", :layout => \"registration\"}\n format.xml { render :xml => @firm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @rfq = Rfq.new(rfq_params)\n @rfq.user_id = current_user.id\n @rfq.status = false\n \n\n respond_to do |format|\n if @rfq.save\n format.html { redirect_to @rfq, notice: 'Request was successfully created.' }\n format.json { render action: 'show', status: :created, location: @rfq }\n else\n format.html { render action: 'new' }\n format.json { render json: @rfq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n\t @fares = Fare.all\n\n\t respond_to do |format|\n\t\tformat.html # index.html.erb\n\t\tformat.json { render json: @fares }\n\t end\n\tend",
"def create\n @rfid = RFID.new(rfid_params)\n @rfid.pessoa = @pessoa\n respond_to do |format|\n if @rfid.save\n format.html { redirect_to @pessoa, success: 'RFID cadastrado com sucesso!' }\n format.json { render :show, status: :created, location: @rfid }\n else\n format.html {\n flash.now[:error] = @rfid.errors\n render :new\n }\n format.json { render json: @rfid.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fax = Fax.new(fax_params)\n\n respond_to do |format|\n if @fax.save\n format.html { redirect_to @fax, notice: 'Fax was successfully created.' }\n format.json { render :show, status: :created, location: @fax }\n else\n format.html { render :new }\n format.json { render json: @fax.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n @franchise = @franchise_set.franchises.new(params[:franchise])\n\n respond_to do |format|\n if @franchise.save \n format.html { redirect_to \"/franchise_sets/#{@franchise_set.id}/edit\", :franchise_set_id => franchise_set.id, notice: 'Franchise was successfully created.' }\n format.json { render json: @franchise}\n else\n format.html { render action: \"new\" }\n format.json { render json: @franchise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def friday_params\n params.require(:friday).permit(:from, :to, :Subject, :link, :Prof)\n end",
"def create\n @farm = Farm.new(params[:farm])\n\n respond_to do |format|\n if @farm.save\n format.html { redirect_to @farm, notice: 'Farm was successfully created.' }\n format.json { render json: @farm, status: :created, location: @farm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @farm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @farm = Farm.new(params[:farm])\n\n respond_to do |format|\n if @farm.save\n format.html { redirect_to @farm, notice: 'Farm was successfully created.' }\n format.json { render json: @farm, status: :created, location: @farm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @farm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_favorite\r\n favorite = RequestFavorite.find(params[:request_id]).request\r\n request = Request.new(user_id: favorite.user_id, service_id: favorite.service_id, description: favorite.description, service_type: favorite.service_type, payment_method: favorite.payment_method, vehicle_type: favorite.vehicle_type, latitud: favorite.latitud, longitud: favorite.longitud, status: '')\r\n if request.save\r\n render json: request\r\n else\r\n render json: {errors: request.errors.full_messages}, status: 422\r\n end\r\n end",
"def create\n @fip = Fip.new(fip_params)\n\n respond_to do |format|\n if @fip.save\n format.html { redirect_to @fip, notice: 'Fip was successfully created.' }\n format.json { render :show, status: :created, location: @fip }\n else\n format.html { render :new }\n format.json { render json: @fip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def financer_params\n params.require(:financer).permit(:name)\n end",
"def index\n @funds = Fund.all\n\n render json: @funds\n end",
"def create\n @fahrt = Fahrt.new(fahrt_params)\n\n respond_to do |format|\n if @fahrt.save\n format.html { redirect_to @fahrt, notice: 'Fahrt was successfully created.' }\n format.json { render :show, status: :created, location: @fahrt }\n else\n format.html { render :new }\n format.json { render json: @fahrt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @finale_rating = FinaleRating.new(finale_rating_params)\n\n respond_to do |format|\n if @finale_rating.save\n format.html { redirect_to @finale_rating, notice: 'Finale rating was successfully created.' }\n format.json { render :show, status: :created, location: @finale_rating }\n else\n format.html { render :new }\n format.json { render json: @finale_rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fire_station = FireStation.new(fire_station_params)\n\n respond_to do |format|\n if @fire_station.save\n format.html { redirect_to @fire_station, notice: 'Fire station was successfully created.' }\n format.json { render :show, status: :created, location: @fire_station }\n else\n format.html { render :new }\n format.json { render json: @fire_station.errors, status: :unprocessable_entity }\n end\n end\n end",
"def process_post\n service.sign_up_fisherman(\n JSON.parse(request.body.to_s).symbolize_keys\n ).on(\n fishing_application_succeeded: ->(result) {\n response.headers['Content-Type'] = \"application/json\"\n response.body = result.to_json\n true\n },\n fishing_application_conflicts: ->(result) {\n render_json_error_response(\n error: \"command_failed_validation\", message: result.fetch(:message)\n )\n 409\n },\n fishing_application_invalid: ->(result) {\n render_json_error_response(\n error: \"command_failed_validation\", message: result.fetch(:message)\n )\n 422\n }\n )\n end",
"def create\n @falta = Falta.new(falta_params)\n\n respond_to do |format|\n if @falta.save\n format.html { redirect_to @falta, notice: \"Falta was successfully created.\" }\n format.json { render :show, status: :created, location: @falta }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @falta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @financeiro = Financeiro.new(financeiro_params)\n\n respond_to do |format|\n if @financeiro.save\n format.html { redirect_to @financeiro, notice: 'Financeiro was successfully created.' }\n format.json { render :show, status: :created, location: @financeiro }\n else\n format.html { render :new }\n format.json { render json: @financeiro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @firma.update(firma_params)\n flash[:success] = \"Firma aktualisiert\"\n format.html { redirect_to @firma }\n format.json { render :show, status: :ok, location: @firma }\n else\n format.html { render :edit }\n format.json { render json: @firma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @raffle = Raffle.new(raffle_params)\n @raffle.collected_money = 0\n respond_to do |format|\n if @raffle.save\n for follower in @raffle.user.followers\n notification = Notification.new()\n notification.content = \"#{@raffle.user.name} just released the raffle #{@raffle.name}\"\n notification.user_id = follower.id\n notification.raffle_id = @raffle.id\n notification.save\n end\n format.html { redirect_to @raffle, notice: 'Raffle was successfully created.' }\n format.json { render :show, status: :created, location: @raffle }\n else\n format.html { render :new }\n format.json { render json: @raffle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flight = Flight.new(params[:flight])\n\n if @flight.save\n render json: @flight, status: :created, location: @flight\n else\n render json: @flight.errors, status: :unprocessable_entity\n end\n end",
"def new\n @fundraiser = Fundraiser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fundraiser }\n end\n end",
"def create\n @foil = Foil.new(params[:foil])\n\n respond_to do |format|\n if @foil.save\n format.html { redirect_to @foil, notice: 'Foil was successfully created.' }\n format.json { render json: @foil, status: :created, location: @foil }\n else\n format.html { render action: \"new\" }\n format.json { render json: @foil.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @smurf = Smurf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @smurf }\n end\n end",
"def create\n @rfq = Rfq.new(params[:rfq])\n @rfq.creator_id = current_user.id\n\n respond_to do |format|\n if @rfq.save\n format.html { redirect_to @rfq, notice: 'Rfq was successfully created.' }\n format.json { render json: @rfq, status: :created, location: @rfq }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rfq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_firmagideri\n @firmagideri = Firmagideri.find(params[:id])\n end",
"def create\n @konfirm = Konfirm.new(konfirm_params)\n @konfirm.user_id = current_user.id\n\n\n respond_to do |format|\n if @konfirm.save\n UserMailer.konfirm_mail(@konfirm, @user).deliver_now\n\n format.html { redirect_to root_path, notice: 'Terimakasih Telah Melakukan Pembayaran.' }\n format.json { render :show, status: :created, location: @konfirm }\n else\n format.html { render :new }\n format.json { render json: @konfirm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_firm\n @firm = Firm.find(params[:id])\n end",
"def create\n @firearm = Firearm.new(params[:firearm])\n\n respond_to do |format|\n if @firearm.save\n format.html { redirect_to(@firearm, :notice => 'Firearm was successfully created.') }\n format.xml { render :xml => @firearm, :status => :created, :location => @firearm }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @firearm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @fish = Fish.new(fish_params)\n\t\t@user = User.find_by email: params[:user][:email]\n\t\t@fish.user_id = @user.id\n\t\tif @fish.save\n\t\t\t@fish.fish_photo = \"fish#{@fish.id}.jpeg\"\n\t\t\t@fish.save\n\t\t\timage_convert(@fish.id)\n \t@weather = @fish.weathers.create(weather_params)\n \trespond_to do |format|\n \tif @weather.save\n \tformat.html { redirect_to @fish, notice: 'Fish was successfully created.' }\n \tformat.json { render action: 'show', status: :created, location: @fish }\n \telse\n \tformat.html { render action: 'new' }\n \tformat.json { render json: @fish.errors, status: :unprocessable_entity }\n \tend\n \tend\n\t\tend\n end",
"def set_firm\n @firm = Firm.find(params[:id])\n end",
"def create\n @fec_filing = FecFiling.new(params[:fec_filing])\n\n respond_to do |format|\n if @fec_filing.save\n format.html { redirect_to @fec_filing, :notice => 'Fec filing was successfully created.' }\n format.json { render :json => @fec_filing, :status => :created, :location => @fec_filing }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @fec_filing.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @fec_filing = FecFiling.new(params[:fec_filing])\n\n respond_to do |format|\n if @fec_filing.save\n format.html { redirect_to @fec_filing, :notice => 'Fec filing was successfully created.' }\n format.json { render :json => @fec_filing, :status => :created, :location => @fec_filing }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @fec_filing.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @konfirms = Konfirm.all\n end",
"def create\n saved = false\n begin\n ActiveRecord::Base.transaction do\n @financer = Financer.new(financer_params)\n @financer.save!\n saved = true\n end\n rescue ActiveRecord::RecordInvalid\n end\n\n respond_to do |format|\n if saved\n format.html { redirect_to @financer, notice: 'Financer was successfully created.' }\n format.json { render :show, status: :created, location: @financer }\n else\n format.html { render :new }\n format.json { render json: @financer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @irpf = Irpf.new(irpf_params)\n\n respond_to do |format|\n if @irpf.save\n format.html { redirect_to @irpf, notice: 'Irpf was successfully created.' }\n format.json { render action: 'show', status: :created, location: @irpf }\n else\n format.html { render action: 'new' }\n format.json { render json: @irpf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @familium = Familium.new(familium_params)\n\n respond_to do |format|\n if @familium.save\n format.html { redirect_to @familium, notice: 'Familium was successfully created.' }\n format.json { render :show, status: :created, location: @familium }\n else\n format.html { render :new }\n format.json { render json: @familium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new #GIRO: POST /foals(.:format) foals#create\n@foal = Foal.new #GIRO: http://localhost:3000/foals/new\nend",
"def new\n \t@firm = Firm.new\n end",
"def invite(firm_name, firstname, lastname, email, phone)\n invite_params = vendor_params(firm_name, firstname, lastname, email, phone)\n @client.post(\"/#{@model}\", {}, invite_params)\n end",
"def create\n @folevent = Folevent.new(folevent_params)\n\n respond_to do |format|\n if @folevent.save\n format.html { redirect_to :back, notice: 'Vous suivez desormais cette événement' }\n format.json { render :show, status: :created, location: @folevent }\n else\n format.html { render :back }\n format.json { render json: @folevent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @favour = Favour.new(favour_params)\n\n respond_to do |format|\n if @favour.save\n format.html { redirect_to @favour, notice: 'Favour was successfully created.' }\n format.json { render :show, status: :created, location: @favour }\n else\n format.html { render :new }\n format.json { render json: @favour.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @foam = Foam.new(params[:foam])\n\n respond_to do |format|\n if @foam.save\n format.html { redirect_to @foam, notice: 'Foam was successfully created.' }\n format.json { render json: @foam, status: :created, location: @foam }\n else\n format.html { render action: \"new\" }\n format.json { render json: @foam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @filled_forms = FilledForm.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @filled_forms }\n end\n end"
] |
[
"0.62247837",
"0.6170513",
"0.6169376",
"0.5966475",
"0.57999766",
"0.5772246",
"0.57486314",
"0.5708599",
"0.5675701",
"0.5633",
"0.5628051",
"0.5567741",
"0.5546342",
"0.5545006",
"0.5536649",
"0.5527791",
"0.5500777",
"0.5473998",
"0.5466345",
"0.5433702",
"0.5415413",
"0.54109555",
"0.5361879",
"0.5354503",
"0.5336965",
"0.5329551",
"0.5327856",
"0.5322302",
"0.5302653",
"0.5285932",
"0.527733",
"0.5269998",
"0.52677095",
"0.52558875",
"0.5252118",
"0.5232765",
"0.5225165",
"0.52220845",
"0.52196777",
"0.51837933",
"0.5181331",
"0.5176342",
"0.5173258",
"0.51632345",
"0.51627773",
"0.5158978",
"0.51535136",
"0.5151941",
"0.5151923",
"0.5145694",
"0.51455146",
"0.51415986",
"0.5137225",
"0.51242256",
"0.51174426",
"0.51167065",
"0.5114117",
"0.5108421",
"0.50990814",
"0.5087872",
"0.50563407",
"0.50520545",
"0.50475013",
"0.50475013",
"0.50465816",
"0.50461286",
"0.50413126",
"0.5034027",
"0.50323755",
"0.50289744",
"0.5021295",
"0.5018044",
"0.50025094",
"0.50023824",
"0.50005156",
"0.4996695",
"0.49966776",
"0.49957994",
"0.49831128",
"0.49799928",
"0.4976581",
"0.4974902",
"0.4973828",
"0.4973136",
"0.4970316",
"0.496893",
"0.4968027",
"0.49644563",
"0.49644563",
"0.4958332",
"0.4957018",
"0.49466416",
"0.49454457",
"0.49451184",
"0.4940267",
"0.49396577",
"0.49356925",
"0.4930201",
"0.4926469",
"0.49256456"
] |
0.65028435
|
0
|
PUT /firms/1 PUT /firms/1.json
|
def update
@title = t('view.firms.edit_title')
@firm = Firm.find(params[:id])
respond_to do |format|
if @firm.update_attributes(params[:firm])
format.html { redirect_to @firm, notice: t('view.firms.correctly_updated') }
format.json { head :ok }
else
format.html { render action: 'edit' }
format.json { render json: @firm.errors, status: :unprocessable_entity }
end
end
rescue ActiveRecord::StaleObjectError
redirect_to edit_firm_url(@firm), alert: t('view.firms.stale_object_error')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @firm.update(firm_params)\n format.html { redirect_to @firm, notice: 'Firm was successfully updated.' }\n format.json { render :show, status: :ok, location: @firm }\n else\n format.html { render :edit }\n format.json { render json: @firm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @firm = Firm.find(params[:id])\n\n respond_to do |format|\n if @firm.update_attributes(params[:firm])\n format.html { redirect_to @firm, notice: 'Empresa alterada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @firm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'FOAF was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end",
"def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'Foaf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_firma\n @firma = Firma.find(params[:id])\n end",
"def set_firm\n @firm = Firm.find(params[:id])\n end",
"def update\n @firm = Firm.find(params[:id])\n\n respond_to do |format|\n if @firm.update_attributes(params[:firm])\n flash[:notice] = 'Firm was successfully updated.'\n format.html { redirect_to(@firm) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @firm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @firma.update(firma_params)\n flash[:success] = \"Firma aktualisiert\"\n format.html { redirect_to @firma }\n format.json { render :show, status: :ok, location: @firma }\n else\n format.html { render :edit }\n format.json { render json: @firma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_firm\n @firm = Firm.find(params[:id])\n end",
"def update\n @fire = Fire.find(params[:id])\n\n respond_to do |format|\n if @fire.update_attributes(params[:fire])\n format.html { redirect_to @fire, notice: 'Fire was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fire.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @farm = Farm.find(params[:id])\n\n respond_to do |format|\n if @farm.update_attributes(params[:farm])\n format.html { redirect_to @farm, notice: 'Farm was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @farm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @farm = Farm.find(params[:id])\n\n respond_to do |format|\n if @farm.update_attributes(params[:farm])\n format.html { redirect_to @farm, notice: 'Farm was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @farm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @farm = Farm.find(params[:id])\n\n respond_to do |format|\n if @farm.update_attributes(params[:farm])\n format.html { redirect_to @farm, notice: 'Farm was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @farm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fiestum.update(fiestum_params)\n format.html { redirect_to @fiestum, notice: 'Fiestum was successfully updated.' }\n format.json { render :show, status: :ok, location: @fiestum }\n else\n format.html { render :edit }\n format.json { render json: @fiestum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @foam = Foam.find(params[:id])\n\n respond_to do |format|\n if @foam.update_attributes(params[:foam])\n format.html { redirect_to @foam, notice: 'Foam was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @farm.update(farm_params)\n render :show, status: :ok, location: api_farm_url(@farm)\n else\n render json: @farm.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @fire.update(fire_params)\n format.html { redirect_to @fire, notice: 'Fire was successfully updated.' }\n format.json { render :show, status: :ok, location: @fire }\n else\n format.html { render :edit }\n format.json { render json: @fire.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @title = t('view.firms.new_title')\n @firm = Firm.new(params[:firm])\n\n respond_to do |format|\n if @firm.save\n format.html { redirect_to @firm, notice: t('view.firms.correctly_created') }\n format.json { render json: @firm, status: :created, location: @firm }\n else\n format.html { render action: 'new' }\n format.json { render json: @firm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @firm = Firm.find(params[:id])\n\n respond_to do |format|\n if @firm.update_attributes(params[:firm])\n flash[:notice] = flash_helper('Firm was successfully updated.')\n format.html { redirect_to account_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @firm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @firmagideri.update(firmagideri_params)\n format.html { redirect_to @firmagideri, notice: 'Kayıt başarıyla güncellendi.' }\n format.json { render :show, status: :ok, location: @firmagideri }\n else\n format.html { render :edit }\n format.json { render json: @firmagideri.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @flair.update(flair_params)\n format.html { redirect_to @flair, notice: 'Flair was successfully updated.' }\n format.json { render :show, status: :ok, location: @flair }\n else\n format.html { render :edit }\n format.json { render json: @flair.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 @firearm = Firearm.find(params[:id])\n\n respond_to do |format|\n if @firearm.update_attributes(params[:firearm])\n format.html { redirect_to(@firearm, :notice => 'Firearm was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @firearm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @farm.update(farm_params)\n format.html { redirect_to @farm, notice: '編集が完了しました。' }\n format.json { render :show, status: :ok, location: @farm }\n else\n format.html { render :edit }\n format.json { render json: @farm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fucker = Fucker.find(params[:id])\n\n respond_to do |format|\n if @fucker.update_attributes(params[:fucker])\n format.json { head :no_content }\n else\n format.json { render json: @fucker.errors, status: :internal_server_error }\n end\n end\n end",
"def update\n @rfq = Rfq.find(params[:id])\n\n respond_to do |format|\n if @rfq.update_attributes(params[:rfq])\n format.html { redirect_to @rfq, notice: 'Rfq was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rfq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fam = Fam.find(params[:id])\n\n respond_to do |format|\n if @fam.update_attributes(params[:fam])\n flash[:notice] = 'Fam was successfully updated.'\n format.html { redirect_to(@fam) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fam.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @farm = Farm.find(params[:id])\n @farm.user = @logged_user;\n respond_to do |format|\n if @farm.update_attributes(params[:farm])\n format.html { redirect_to @farm, :notice => 'Farm was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @farm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @farm = Farm.find(params[:id])\n\n respond_to do |format|\n if @farm.update_attributes(params[:farm])\n flash[:notice] = 'Farm was successfully updated.'\n format.html { redirect_to(@farm) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @farm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_firmagideri\n @firmagideri = Firmagideri.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @friday.update(friday_params)\n format.html { redirect_to @friday, notice: \"Friday was successfully updated.\" }\n format.json { render :show, status: :ok, location: @friday }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @friday.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_fry_farm\n @fry_farm = FryFarm.find(params[:id])\n end",
"def update\n @flight = Flight.find(params[:id])\n\n if @flight.update(params[:flight])\n head :no_content\n else\n render json: @flight.errors, status: :unprocessable_entity\n end\n end",
"def update\n @farm = Farm.find(params[:id])\n\n respond_to do |format|\n if @farm.update_attributes(params[:farm])\n format.html { redirect_to(\"/farmview\", :notice => 'Farm was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @farm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update \n @franchise = @franchise_set.franchises.find(params[:id])\n\n respond_to do |format|\n franchise_set = FranchiseSet.find(params[:franchise_set_id])\n if @franchise.update_attributes(params[:franchise])\n format.html { redirect_to \"/franchise_sets/#{franchise_set.id}/edit\" , notice: 'Franchise was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @franchise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @firms = Firm.all\n end",
"def update\n @smurf = Smurf.find(params[:id])\n\n respond_to do |format|\n if @smurf.update_attributes(params[:smurf])\n format.html { redirect_to @smurf, notice: 'Smurf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @smurf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fred = Fred.find(params[:id])\n\n respond_to do |format|\n if @fred.update_attributes(params[:fred])\n format.html { redirect_to @fred, notice: 'Fred was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fred.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @feira.update(feira_params)\n format.html { redirect_to @feira, notice: 'Feira was successfully updated.' }\n format.json { render :show, status: :ok, location: @feira }\n else\n format.html { render :edit }\n format.json { render json: @feira.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @familium = Familium.find(params[:id])\n\n respond_to do |format|\n if @familium.update_attributes(params[:familium])\n format.html { redirect_to @familium, notice: 'Familia fue actualizada existosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @familium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @festival = Festival.find(params[:id])\n\n respond_to do |format|\n if @festival.update_attributes(params[:festival])\n format.html { redirect_to @festival, notice: 'Festival was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @festival.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @framing_saw.update(framing_saw_params)\n format.html { redirect_to @framing_saw, notice: 'Framing saw was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @framing_saw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pro_farm_update\n respond_to do |format|\n activo = params[:pro_far][:activo_produc]\n farmacia_id = session[:farmacia_id]\n id = params[:id]\n ProFar.where(producto_id: id, farmacium_id:farmacia_id).update_all(activo_produc: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def show\n @firm = Firm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @firm }\n end\n end",
"def update\n respond_to do |format|\n if @fabricsofaset.update(fabricsofaset_params)\n format.html { redirect_to @fabricsofaset, notice: 'Fabricsofaset was successfully updated.' }\n format.json { render :show, status: :ok, location: @fabricsofaset }\n else\n format.html { render :edit }\n format.json { render json: @fabricsofaset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fuel_issued.update(fuel_issued_params)\n format.html { redirect_to @fuel_issued, notice: (t 'fuel_issueds.title')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fuel_issued.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @firm = Firm.new(firm_params)\n\n respond_to do |format|\n if @firm.save\n format.html { redirect_to @firm, notice: 'Firm was successfully created.' }\n format.json { render :show, status: :created, location: @firm }\n else\n format.html { render :new }\n format.json { render json: @firm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @frat.update(frat_params)\n format.html { redirect_to @frat, notice: 'Frat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @frat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @filial = Filial.find(params[:id])\n\n respond_to do |format|\n if @filial.update_attributes(params[:filial])\n format.html { redirect_to @filial, notice: 'Filial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @filial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @filial = Filial.find(params[:id])\n\n respond_to do |format|\n if @filial.update_attributes(params[:filial])\n format.html { redirect_to @filial, notice: 'Filial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @filial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @firm = Firm.new(params[:firm])\n\n respond_to do |format|\n if @firm.save\n format.html { redirect_to @firm, notice: 'Empresa criada com sucesso.' }\n format.json { render json: @firm, status: :created, location: @firm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @firm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sofa = Sofa.find(params[:id])\n\n respond_to do |format|\n if @sofa.update_attributes(params[:sofa])\n flash[:notice] = 'Sofa was successfully updated.'\n format.html { redirect_to(@sofa) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sofa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @forest = Forest.find(params[:id])\n\n respond_to do |format|\n if @forest.update_attributes(params[:forest])\n format.html { redirect_to @forest, notice: 'Forest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @forest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @foil = Foil.find(params[:id])\n\n respond_to do |format|\n if @foil.update_attributes(params[:foil])\n format.html { redirect_to @foil, notice: 'Foil was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foil.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :manage, @flock\n\n respond_to do |format|\n if @flock.update(flock_params)\n format.html { redirect_to @flock, notice: \"Flock was successfully updated.\" }\n format.json { render :show, status: :ok, location: @flock }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @flock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @furdo.update(furdo_params)\n format.html { redirect_to @furdo, notice: 'Furdo was successfully updated.' }\n format.json { render :show, status: :ok, location: @furdo }\n else\n format.html { render :edit }\n format.json { render json: @furdo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @frind.update(frind_params)\n format.html { redirect_to @frind, notice: 'Frind was successfully updated.' }\n format.json { render :show, status: :ok, location: @frind }\n else\n format.html { render :edit }\n format.json { render json: @frind.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @claim.update(claim_params)\n format.html { redirect_to @claim, notice: 'Claim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @claim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @furniture.update(furniture_params)\n format.html { redirect_to @furniture, notice: \"Furniture was successfully updated.\" }\n format.json { render :show, status: :ok, location: @furniture }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @furniture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @flaw.update(flaw_params)\n format.html { redirect_to @flaw, notice: 'Flaw was successfully updated.' }\n format.json { render :show, status: :ok, location: @flaw }\n else\n format.html { render :edit }\n format.json { render json: @flaw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @furniture.update(furniture_params)\n format.html { redirect_to @furniture, notice: 'Furniture Has Been Successfully Updated.' }\n format.json { render :show, status: :ok, location: @furniture }\n else\n format.html { render :edit }\n format.json { render json: @furniture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fahrt.update(fahrt_params)\n format.html { redirect_to @fahrt, notice: 'Fahrt was successfully updated.' }\n format.json { render :show, status: :ok, location: @fahrt }\n else\n format.html { render :edit }\n format.json { render json: @fahrt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fisier.update(fisier_params)\n format.html { redirect_to root_path, notice: 'Fisier was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fisier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n activo = params[:lab_far][:activo]\n farmacia_id = session[:farmacia_id]\n id = params[:id]\n LabFar.where(laboratorio_id: id, farmacium_id:farmacia_id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def new\n @title = t('view.firms.new_title')\n @firm = Firm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @firm }\n end\n end",
"def update\n @flower = Flower.find(params[:id])\n\n respond_to do |format|\n if @flower.update_attributes(params[:flower])\n format.html { redirect_to @flower, notice: 'Flower was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flower.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fpsignal.update(fpsignal_params)\n format.html { redirect_to fpsignals_path, notice: 'Запись успешно обновлена.' }\n format.json { render :show, status: :ok, location: fpsignals_path }\n else\n format.html { render :edit }\n format.json { render json: @fpsignal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @firm = Firm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @firm }\n end\n end",
"def update\n respond_to do |format|\n if @folevent.update(folevent_params)\n format.html { redirect_to @folevent, notice: 'Folevent was successfully updated.' }\n format.json { render :show, status: :ok, location: @folevent }\n else\n format.html { render :edit }\n format.json { render json: @folevent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rfq.update(rfq_params)\n format.html { redirect_to @rfq, notice: 'Request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rfq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fridge = Fridge.find(params[:id])\n\n respond_to do |format|\n if @fridge.update_attributes(params[:fridge])\n format.html { redirect_to @fridge, notice: 'Fridge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fridge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @familium.update(familium_params)\n format.html { redirect_to @familium, notice: 'Familium was successfully updated.' }\n format.json { render :show, status: :ok, location: @familium }\n else\n format.html { render :edit }\n format.json { render json: @familium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_insurance_firm\n @insurance_firm = InsuranceFirm.find(params[:id])\n end",
"def update\n @fundraiser = Fundraiser.find(params[:id])\n\n respond_to do |format|\n if @fundraiser.update_attributes(params[:fundraiser])\n format.html { redirect_to @fundraiser, notice: 'Fundraiser was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fundraiser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n @fluxomatricula = Fluxomatricula.find(params[:id])\n\n respond_to do |format|\n if @fluxomatricula.update_attributes(params[:fluxomatricula])\n format.html { redirect_to @fluxomatricula, notice: 'Fluxomatricula was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fluxomatricula.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sewage_farm.update(sewage_farm_params)\n format.html { redirect_to @sewage_farm, notice: 'Sewage farm was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sewage_farm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @falta.update(falta_params)\n format.html { redirect_to @falta, notice: \"Falta was successfully updated.\" }\n format.json { render :show, status: :ok, location: @falta }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @falta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @financer.update(financer_params)\n format.html { redirect_to @financer, notice: 'Financer was successfully updated.' }\n format.json { render :show, status: :ok, location: @financer }\n else\n format.html { render :edit }\n format.json { render json: @financer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @iceandfire.update(iceandfire_params)\n format.html { redirect_to @iceandfire, notice: 'Readling List was successfully updated.' }\n format.json { render :show, status: :ok, location: @iceandfire }\n else\n format.html { render :edit }\n format.json { render json: @iceandfire.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @auction_foregift.update(auction_foregift_params)\n format.html { redirect_to @auction_foregift, notice: 'Auction foregift was successfully updated.' }\n format.json { render :show, status: :ok, location: @auction_foregift }\n else\n format.html { render :edit }\n format.json { render json: @auction_foregift.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fbo.update(fbo_params)\n format.html { redirect_to @fbo, notice: 'Fbo was successfully updated.' }\n format.json { render :show, status: :ok, location: @fbo }\n else\n format.html { render :edit }\n format.json { render json: @fbo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fip.update(fip_params)\n format.html { redirect_to @fip, notice: 'Fip was successfully updated.' }\n format.json { render :show, status: :ok, location: @fip }\n else\n format.html { render :edit }\n format.json { render json: @fip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @thirtyfife.update(thirtyfife_params)\n format.html { redirect_to @thirtyfife, notice: 'Thirtyfive was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @thirtyfife.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\n @flight = Flight.find(params[:id])\n\n respond_to do |format|\n if @flight.update_attributes(params[:flight])\n format.html { redirect_to @flight, notice: 'Flight was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @forest.update(forest_params)\n format.html { redirect_to @forest, notice: 'Forest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @forest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flight = Flight.find(params[:id])\n\n respond_to do |format|\n if @flight.update_attributes(params[:flight])\n format.html { redirect_to @flight, notice: 'Flight was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fax.update(fax_params)\n format.html { redirect_to @fax, notice: 'Fax was successfully updated.' }\n format.json { render :show, status: :ok, location: @fax }\n else\n format.html { render :edit }\n format.json { render json: @fax.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n cri = @crime_thief.crime_id\n cre = Crime.where(id:cri).first\n respond_to do |format|\n if @crime_thief.update(crime_thief_params)\n format.html { redirect_to cre, notice: 'Cambio de estado exitoso!' }\n format.json { render :show, status: :ok, location: @crime_thief }\n else\n format.html { render :edit }\n format.json { render json: @crime_thief.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @foro = Foro.find(params[:id])\n\n respond_to do |format|\n if @foro.update_attributes(params[:foro])\n format.html { redirect_to @foro, notice: 'Foro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @festival.update(festival_params)\n format.html { redirect_to @festival, notice: 'Festival was successfully updated.' }\n format.json { render :show, status: :ok, location: @festival }\n else\n format.html { render :edit }\n format.json { render json: @festival.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @firm = Firm.find(params[:id])\n @firm.destroy\n\n respond_to do |format|\n format.html { redirect_to firms_url }\n format.json { head :ok }\n end\n end",
"def update\n @foiltype = Foiltype.find(params[:id])\n\n respond_to do |format|\n if @foiltype.update_attributes(params[:foiltype])\n format.html { redirect_to @foiltype, notice: 'Foiltype was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foiltype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rfid.update(rfid_params)\n format.html { redirect_to @pessoa, success: 'RFID atualizado com sucesso!' }\n format.json { render :show, status: :ok, location: @rfid }\n else\n format.html {\n flash.now[:error] = @rfid.errors\n render :edit\n }\n format.json { render json: @rfid.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @farmer = Farmer.find(params[:id])\n\n respond_to do |format|\n if @farmer.update_attributes(params[:farmer])\n format.html { redirect_to @farmer, notice: 'Farmer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @farmer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @firework_detail.update(firework_detail_params)\n format.html { redirect_to @firework_detail, notice: 'Firework detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @firework_detail }\n else\n format.html { render :edit }\n format.json { render json: @firework_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @resist.update(resist_params)\n format.html { redirect_to @resist, notice: 'Resist was successfully updated.' }\n format.json { render :show, status: :ok, location: @resist }\n else\n format.html { render :edit }\n format.json { render json: @resist.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.63847166",
"0.63450944",
"0.6249478",
"0.6192724",
"0.6176736",
"0.6117501",
"0.6064383",
"0.6054021",
"0.6053476",
"0.6045763",
"0.6023448",
"0.60054237",
"0.60054237",
"0.60054237",
"0.5990374",
"0.5963498",
"0.59465086",
"0.59461033",
"0.5930213",
"0.5893923",
"0.58848417",
"0.5850739",
"0.584728",
"0.58457243",
"0.5839644",
"0.58390516",
"0.5834594",
"0.57485795",
"0.57353044",
"0.57301825",
"0.5722063",
"0.5721376",
"0.5721174",
"0.5711745",
"0.57097906",
"0.57062405",
"0.570452",
"0.5702944",
"0.5702171",
"0.5692784",
"0.56850237",
"0.56741047",
"0.5661309",
"0.5655463",
"0.5651744",
"0.56407404",
"0.56398755",
"0.5627316",
"0.56215084",
"0.55907524",
"0.5566209",
"0.5566209",
"0.5561447",
"0.5555966",
"0.5555344",
"0.55548114",
"0.55489606",
"0.5541316",
"0.5531976",
"0.553092",
"0.5528502",
"0.55278647",
"0.55145794",
"0.55116785",
"0.55113035",
"0.55026865",
"0.5497553",
"0.5482094",
"0.548083",
"0.5480222",
"0.5478622",
"0.54677814",
"0.5465297",
"0.54638535",
"0.54622626",
"0.54552484",
"0.5455207",
"0.54500324",
"0.5447555",
"0.5443938",
"0.54424274",
"0.5441026",
"0.5439809",
"0.5430735",
"0.54294884",
"0.54256713",
"0.5420658",
"0.5418354",
"0.5416577",
"0.541585",
"0.5413279",
"0.54070616",
"0.54066885",
"0.5400185",
"0.53907245",
"0.5387052",
"0.53817767",
"0.5380653",
"0.5380248",
"0.53790116"
] |
0.6102161
|
6
|
DELETE /firms/1 DELETE /firms/1.json
|
def destroy
@firm = Firm.find(params[:id])
@firm.destroy
respond_to do |format|
format.html { redirect_to firms_url }
format.json { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @firm = Firm.find(params[:id])\n @firm.destroy\n\n respond_to do |format|\n format.html { redirect_to firms_url }\n format.json { head :no_content }\n end\n end",
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def destroy\n @fire = Fire.find(params[:id])\n @fire.destroy\n\n respond_to do |format|\n format.html { redirect_to fires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @firm = Firm.find(params[:id])\n @firm.destroy\n\n respond_to do |format|\n format.html { redirect_to(firms_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @firm = Firm.find(params[:id])\n @firm.destroy\n\n respond_to do |format|\n format.html { redirect_to(firms_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @firearm = Firearm.find(params[:id])\n @firearm.destroy\n\n respond_to do |format|\n format.html { redirect_to(firearms_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @firma.destroy\n respond_to do |format|\n flash[:success] = \"Firma gelöscht.\"\n format.html { redirect_to firmen_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @firm.destroy\n respond_to do |format|\n format.html { redirect_to firms_url, notice: 'Firm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fire.destroy\n respond_to do |format|\n format.html { redirect_to fires_url, notice: 'Fire was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @four.destroy\n respond_to do |format|\n format.html { redirect_to fours_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 @farmacium.destroy\n respond_to do |format|\n msg = { :status => \"ok\", :message => \"Eliminado!\" }\n format.json { render :json => msg }\n end\n end",
"def destroy\n @smurf = Smurf.find(params[:id])\n @smurf.destroy\n\n respond_to do |format|\n format.html { redirect_to smurves_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def borrar \n\n fiesta.destroy\n render json: fiesta \n end",
"def destroy\n @familium = Familium.find(params[:id])\n @familium.destroy\n\n respond_to do |format|\n format.html { redirect_to familia_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @firmagideri.destroy\n respond_to do |format|\n format.html { redirect_to firmagideris_url, notice: 'Kayıt silindi.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @furdo.destroy\n respond_to do |format|\n format.html { redirect_to furdos_url, notice: 'Furdo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foam = Foam.find(params[:id])\n @foam.destroy\n\n respond_to do |format|\n format.html { redirect_to foams_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @fiestum.destroy\n respond_to do |format|\n format.html { redirect_to fiesta_url, notice: 'Fiestum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @emergency = Emergency.find(@fire.emergency_id)\n @fire.destroy\n respond_to do |format|\n format.html { redirect_to formularios_path(@emergency), notice: 'Fire was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @framing_saw.destroy\n respond_to do |format|\n format.html { redirect_to framing_saws_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @festival = Festival.find(params[:id])\n @festival.destroy\n\n respond_to do |format|\n format.html { redirect_to festivals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @iceandfire.destroy\n respond_to do |format|\n format.html { redirect_to iceandfires_url, notice: 'Readling List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @frat.destroy\n respond_to do |format|\n format.html { redirect_to frats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customf.destroy\n respond_to do |format|\n format.html { redirect_to customfs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foaf.destroy\n\n respond_to do |format|\n format.html { redirect_to foafs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foaf.destroy\n\n respond_to do |format|\n format.html { redirect_to foafs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rfq = Rfq.find(params[:id])\n @rfq.destroy\n\n respond_to do |format|\n format.html { redirect_to rfqs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @farm = Farm.find(params[:id])\n @farm.destroy\n\n respond_to do |format|\n format.html { redirect_to farms_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @forest = Forest.find(params[:id])\n @forest.destroy\n\n respond_to do |format|\n format.html { redirect_to forests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @firework_detail.destroy\n respond_to do |format|\n format.html { redirect_to firework_details_url, notice: 'Firework detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fisier.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @farm = Farm.find(params[:id])\n @farm.destroy\n\n respond_to do |format|\n format.html { redirect_to farms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @farm = Farm.find(params[:id])\n @farm.destroy\n\n respond_to do |format|\n format.html { redirect_to farms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @farm = Farm.find(params[:id])\n @farm.destroy\n\n respond_to do |format|\n format.html { redirect_to farms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @frind.destroy\n respond_to do |format|\n format.html { redirect_to frinds_url, notice: 'Frind was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fabric = Fabric.find(params[:id])\n @fabric.destroy\n\n respond_to do |format|\n format.html { redirect_to fabrics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n franchise.destroy\n\n respond_to do |format|\n format.html { redirect_to franchises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friday.destroy\n respond_to do |format|\n format.html { redirect_to fridays_url, notice: \"Friday was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @formulary = Formulary.find(params[:id])\n @formulary.destroy\n\n respond_to do |format|\n format.html { redirect_to formularies_url }\n format.json { head :no_content }\n end\n end",
"def destroy \n @franchise = @franchise_set.franchises.find(params[:id])\n @franchise.destroy\n\n # respond_to do |format| \n # format.html { redirect_to \"/franchise_sets/#{franchise_set.id}/edit\" }\n # format.json { head :ok }\n # end\n \n respond_to do |format|\n format.json {head :ok}\n end\n \n end",
"def destroy\n @basis = Base.find(params[:id])\n @basis.destroy\n\n respond_to do |format|\n format.html { redirect_to bases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flight = Flight.find(params[:id])\n @flight.destroy\n\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :ok }\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 @farm.destroy\n respond_to do |format|\n format.html { redirect_to farms_url, notice: 'データを消去しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flight = Flight.find(params[:id])\n @flight.destroy\n\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @filial = Filial.find(params[:id])\n @filial.destroy\n\n respond_to do |format|\n format.html { redirect_to filials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @irpf.destroy\n respond_to do |format|\n format.html { redirect_to irpfs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @forest.destroy\n respond_to do |format|\n format.html { redirect_to forests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flair.destroy\n respond_to do |format|\n format.html { redirect_to flairs_url, notice: 'Flair was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @farm = Farm.find(params[:id])\n @farm.destroy\n\n respond_to do |format|\n format.html { redirect_to(farms_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n authorize! :manage, @flock\n\n @flock.destroy\n respond_to do |format|\n format.html { redirect_to flocks_url, notice: \"Flock was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spoofer = Spoofer.find(params[:id])\n @spoofer.destroy\n\n respond_to do |format|\n format.html { redirect_to spoofers_url }\n format.json { head :ok }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n render_json_auto @survey.delete_filter(params[:id].to_i) and return\n end",
"def destroy\n @thirtyfife.destroy\n respond_to do |format|\n format.html { redirect_to thirtyfives_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flower = Flower.find(params[:id])\n @flower.destroy\n\n respond_to do |format|\n format.html { redirect_to flowers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @flight.destroy\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flight.destroy\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flight.destroy\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fuel_issued.destroy\n respond_to do |format|\n format.html { redirect_to fuel_issueds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sewage_farm.destroy\n respond_to do |format|\n format.html { redirect_to sewage_farms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fundraiser = Fundraiser.find(params[:id])\n @fundraiser.destroy\n\n respond_to do |format|\n format.html { redirect_to fundraisers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @konfirm.destroy\n respond_to do |format|\n format.html { redirect_to konfirms_url, notice: 'Konfirm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @claim.destroy\n respond_to do |format|\n format.html { redirect_to claims_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fpsignal.destroy\n respond_to do |format|\n format.html { redirect_to fpsignals_url, notice: 'Запись успешно удалена.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @familium.destroy\n respond_to do |format|\n format.html { redirect_to familia_url, notice: 'Familium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fbo.destroy\n respond_to do |format|\n format.html { redirect_to fbos_url, notice: 'Fbo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bio_signal = BioSignal.find(params[:id])\n @bio_signal.destroy\n\n respond_to do |format|\n format.html { redirect_to bio_signals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fire_station.destroy\n respond_to do |format|\n format.html { redirect_to fire_stations_url, notice: 'Fire station was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @furniture.destroy\n respond_to do |format|\n format.html { redirect_to furnitures_url, notice: 'Furniture Has Been Successfully Deleted.' }\n format.json { head :no_content }\n end\n end",
"def delete() #DELETE film1.delete (removes 1 film)\n sql = \"DELETE FROM films WHERE id = $1;\"\n values = [@id]\n SqlRunner.run(sql, values)\n end",
"def destroy\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to statuseses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foil = Foil.find(params[:id])\n @foil.destroy\n\n respond_to do |format|\n format.html { redirect_to foils_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @aff.destroy\n respond_to do |format|\n format.html { redirect_to affs_url, notice: 'Aff 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 @requisition = Requisition.find(params[:id])\n @requisition.destroy\n\n respond_to do |format|\n format.html { redirect_to requisitions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @core_uf = Core::Uf.find(params[:id])\n @core_uf.destroy\n\n respond_to do |format|\n format.html { redirect_to core_ufs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rfid.destroy\n respond_to do |format|\n format.html { redirect_to @rfid.pessoa, success: 'RFID excluída com sucesso!.' }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request 'DELETE', path\n end",
"def destroy\n @fostered.destroy\n respond_to do |format|\n format.html { redirect_to fostereds_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 @farmer.destroy\n respond_to do |format|\n format.html { redirect_to farmers_url }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def destroy\n @claim_datum.destroy\n respond_to do |format|\n format.html { redirect_to claim_data_url, notice: 'Claim datum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(payload = {})\n request! do\n options = {payload: to_payload(payload)}\n api(options)[url.path].delete(API_HEADERS)\n end\n end",
"def destroy\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @filial = Filial.find(params[:id])\n @filial.destroy\n\n respond_to do |format|\n format.html { redirect_to filiais_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fish.destroy\n respond_to do |format|\n format.html { redirect_to fish_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flight = Flight.find(params[:id])\n @flight.destroy\n\n head :no_content\n end",
"def destroy\n @fokey.destroy\n respond_to do |format|\n format.html { redirect_to fokeys_url, notice: 'Fokey was successfully destroyed.' }\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"
] |
[
"0.6951848",
"0.68777543",
"0.68197554",
"0.68169296",
"0.68006384",
"0.68006384",
"0.67076325",
"0.6698469",
"0.6665981",
"0.6618573",
"0.6585148",
"0.64497644",
"0.64468896",
"0.6389992",
"0.6383792",
"0.6374941",
"0.6362597",
"0.6361317",
"0.6357924",
"0.635509",
"0.6350739",
"0.6349602",
"0.63444537",
"0.6330102",
"0.63226885",
"0.6318729",
"0.6317803",
"0.6315758",
"0.6300254",
"0.62995774",
"0.62982506",
"0.62982506",
"0.62968946",
"0.62955916",
"0.6290636",
"0.628821",
"0.62844074",
"0.6280241",
"0.6280241",
"0.6280241",
"0.628003",
"0.6277655",
"0.6263767",
"0.62439615",
"0.62435126",
"0.62333965",
"0.6225533",
"0.6225527",
"0.62200236",
"0.6213326",
"0.62097067",
"0.62016916",
"0.62008333",
"0.61958754",
"0.61833584",
"0.618298",
"0.61788064",
"0.61680305",
"0.6165501",
"0.6165466",
"0.6159946",
"0.6159006",
"0.61587876",
"0.6154842",
"0.61518365",
"0.61518365",
"0.61518365",
"0.6146395",
"0.6137645",
"0.6132866",
"0.61249053",
"0.61218816",
"0.6119896",
"0.6118022",
"0.61165714",
"0.61154974",
"0.6112881",
"0.61079544",
"0.61028165",
"0.6101564",
"0.6099651",
"0.6091305",
"0.6089375",
"0.60888326",
"0.6088015",
"0.6086623",
"0.6085754",
"0.6083482",
"0.60821676",
"0.6076047",
"0.6070177",
"0.60687643",
"0.6066262",
"0.60646766",
"0.6064322",
"0.6064316",
"0.6061585",
"0.60613406",
"0.60598606",
"0.60598606"
] |
0.69620305
|
0
|
creo que esto se puede ir
|
def add_product
@firm = Firm.find(params[:id])
render partial: 'add_product', content_type: 'text/html'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def crear\n if user_signed_in?\n unless current_user.employee.nil?\n @permiso_crear = false\n @security_role_type = Security::RoleType.find_by(name: \"Crear\").name\n current_user.employee.security_profile.security_role.security_role_menus.each do |security_role_menu| \n if security_role_menu.security_menu.controller == params[:controller] \n security_role_menu.security_role_type_menus.each do |role_type| \n if @security_role_type == role_type.security_role_type.name\n @permiso_crear = true\n break\n end\n end\n elsif params[:controller] == \"security/role_type_menus\"\n params[:controller] = \"security/roles\"\n if security_role_menu.security_menu.controller == params[:controller] \n security_role_menu.security_role_type_menus.each do |role_type|\n if @security_role_type == role_type.security_role_type.name\n @permiso_crear = true\n break\n end\n end\n end\n end\n end\n if current_user.username == \"aadmin\"\n @permiso_crear = true\n end\n if params[:action] == \"new\" && @permiso_crear == false\n redirect_to root_path\n end\n return @permiso_crear\n end\n end\n end",
"def control_sin_items_comprobantes\n if [detalles].any? {|detalle| detalle.any? }\n self.errors[:base] = \"error que queres hacer?\"\n return false\n end \n end",
"def cargarAula\n @aula = Aula.new(aula_params)\n cumple = true\n\n Aula.all.each do |aul|\n if(@aula.NombreAula == aul.NombreAula)\n flash[:notice] = 'Ya exite un aula con ese nombre'\n cumple = false\n end\n end\n if(cumple)\n if @aula.save\n flash[:notice] = 'El aula se creó exitosamente!'\n redirect_to listadoAulas_path\n else\n redirect_to listadoAulas_path\n end\n else\n redirect_to listadoAulas_path\n end\n end",
"def podeCadastrarNovaTurma\n\n if (current_usuario.usuarioLimitado? && current_usuario.turmas.exists?)\n #se usuario é limitado e ja possui local\n #true -true\n return false\n end\n\n return true\n\n end",
"def recibir_auto(usuario)\n if self.estado_id == 2\n traza_creada = Traza.create(:copia_id => self.id, :movimiento_id => 2, :usuario => usuario, :buzon_id => usuario.puesto.buzon_id)\n return false unless traza_creada\n self.estado_id = 3\n return true if self.save \n #si llega aqui, algo malo paso.\n return false\n end\n end",
"def suivre; end",
"def iniciar\n ARREGLO_ESTRUCTURAS.each do |una|\n#comprueba si se trata de una cadena\n if una.estructura.first.is_a? String\n\n if @token_list.first.token_tok.to_s == una.estructura.first\n analizador(una.estructura)\n end\n else\n if @token_list.first.token_tok.to_s == una.estructura.first[0]\n analizador(una.estructura)\n end\n end\n end\n #error_messager(3)\n end",
"def create\n @numero = params[:numero]\n @cvv = params[:cvv]\n @fecha_vencimiento = params[:fecha_vencimiento]\n @viaje_id=params[:viaje_id]\n\n @compra_exitosa = false\n\n if !(@numero.nil? || @cvv.nil? || @fecha_vencimiento.nil?)\n\n if @numero.length == 12\n\n if @cvv.length== 3\n\n if DateTime.parse(@fecha_vencimiento) > Date.today\n\n\n arr=params[:adicionales]\n viaje=Viaje.find_by_id(params[:viaje_id])\n\n #POR AHORA HAGO QUE SE RESERVE AUTOMATICAMENTE\n pasaje= Pasaje.new\n if(arr != nil)\n arr.each do |a|\n pasaje.adicionales=pasaje.adicionales.append(Adicional.find_by_id(a))\n end\n end\n pasaje.viaje_id=params[:viaje_id]\n pasaje.user_id=current_user.id\n if (viaje.asientos_restantes !=nil and viaje.asientos_restantes>0)\n viaje.asientos_restantes=viaje.asientos_restantes-1\n viaje.save\n elsif viaje.asientos_restantes<=0\n flash[:danger] = \"Viaje con asientos ocupados\"\n end\n\n pasaje.save\n @compra_exitosa=true\n\n\n else\n flash[:alert]=\"Debe ingresar una fecha posterior a hoy\"\n end\n else\n flash[:alert]=\"Debe ingresar un código de tarjeta válido de tres dígitos\"\n end\n else\n flash[:alert]=\"Debe ingresar una tarjeta válida de doce dígitos\"\n end\n else\n flash[:notice]=\"Debe ingresar una tarjeta válida\"\n end\n\n end",
"def crear_existente\n if request.post?\n if expediente_relacionado = Expediente.find_by_id(params[:expediente_relacionado_id])\n expediente = Expediente.find(params[:expediente_id])\n if not expediente.expedientes_relacionados.include?(expediente_relacionado)\n Expediente.transaction do\n expediente.expedientes << expediente_relacionado \n expediente.save\n expediente_relacionado.expedientes << expediente\n expediente_relacionado.save\n end\n end\n end\n render :update do |page|\n page << \"active_scaffold_update();\"\n end\n end\n end",
"def create\n\n @var=params[:despachar]\n if !(params[:enviar].nil?)\n\n @ordenes=params[:enviar]\n @ordenes.each do |orden|\n if orden[1] != \"no\"\n @orden = Orden.find(orden[1])\n @orden.empleado_id = @var[\"recolector\"]\n @orden.estado = \"Asignada para Recoleccion\"\n NUESTRO_LOG.info \"Se despacho la orden correctamente\"\n @orden.save\n end\n end\n end\n @ordenprincipal = Orden.find(@var[\"orden\"])\n @ordenprincipal.estado = \"Asignada para Recoleccion\"\n @ordenprincipal.empleado_id = @var[\"recolector\"]\n @ordenprincipal.save\n redirect_to(despachador_path, :notice => t('rutarecolecciones'))\n\n end",
"def crear_comite_nacional session\n \n transaction do\n \n begin\n \n #ciudad = Ciudad.find(:first, :conditions=>['ciudad.id=?',Oficina.find(session[:oficina]).ciudad_id.to_s],:include=>:estado)\n oficina_id=session[:oficina].to_s\n ########################################\n #1 Verificar si el comite esta cerrado.\n Comite.connection.execute(\"LOCK comite in ACCESS EXCLUSIVE MODE;\")\n ComiteDecisionHistorico.connection.execute(\"LOCK comite_decision_historico in ACCESS EXCLUSIVE MODE;\")\n comite=Comite.find(:first,:include=>['comite_decision_historico'],:conditions=>\" comite_decision_historico.tipo_comite='n' \",:order=>\"comite.id desc\")\n if !comite.nil?\n if comite.vigente==true\n return I18n.t('Sistema.Body.Vistas.InstanciaComiteNacional.Errores.llenar_datos_instancia')\n else\n ##################################################################\n #2 Todos los tramites del ultimo comite deben tener una decision.\n total=ComiteDecisionHistorico.count(:conditions=>\"tipo_comite='n' and comite_id=#{comite.id} \")\n total_decision=ComiteDecisionHistorico.count(:conditions=>\"tipo_comite='n' and decision is not null and comite_id=#{comite.id} \")\n if total.to_i!=total_decision.to_i\n return I18n.t('Sistema.Body.Vistas.InstanciaComiteNacional.Errores.datos_creados_deben_tener_decision')\n end\n end\n end\n \n condicion=\" estatus_id=10034 and comite_estadal_id is not null and ( comite_id IS NULL or decision_comite_nacional='D' ) \"\n \n solicitudes=Solicitud.find(:all,:conditions=>condicion)\n \n if !solicitudes.nil? && !solicitudes.empty?\n ParametroGeneral.connection.execute(\"LOCK parametro_general in ACCESS EXCLUSIVE MODE;\")\n parametro_general=ParametroGeneral.find(:first)\n semilla = parametro_general.numeracion_instancia_nacional.to_i + 1\n anio = ParametroGeneral.find(:first).anio_constitucion_comite_vigente\n numero = semilla.to_s+\"-\"+anio.to_s\n parametro_general.numeracion_instancia_nacional = semilla\n parametro_general.save!\n comite = Comite.new\n comite.attributes = {:numero=>numero,:instancia_tipo_id=> 5,:vigente=>true}\n comite.save!\n \n params = {\n :p_numero_comite=>numero,\n :p_comite_id=>comite.id,\n :p_tipo=>'N',\n :p_oficina_id=>0\n }\n \n ejecutar = execute_sp('apertura_comite', params.values_at(\n :p_numero_comite,\n :p_comite_id,\n :p_tipo,\n :p_oficina_id))\n \n logger.info \"Ejecutar =======> #{ejecutar.to_s}\"\n \n #solicitudes.each { |x| \n #x.numero_comite_nacional = numero\n #x.comite_id = comite.id\n #x.decision_comite_nacional = nil\n #x.comentario_comite_nacional = nil\n #x.save!\n #ComiteDecisionHistorico.create(\n #:solicitud_id=> x.id,\n #:comite_id => comite.id,\n #:tipo_comite => 'n',\n #:oficina_id => x.oficina_id\n #)\n #}\n return 1\n else\n return I18n.t('Sistema.Body.Vistas.InstanciaComiteNacional.Errores.no_existen_tramites_para_nuevo_comite')\n end\n rescue=>detail\n return I18n.t('Sistema.Body.Vistas.InstanciaComiteNacional.Errores.error_en_creacion') + detail.message.to_s\n \n end #------> Fin del Begin\n \n end #------> Fin transacion do\n \n end",
"def create\r\n if current_user.nil?\r\n redirect_to(log_in_path) and return\r\n end\r\n \r\n codigo = params[:codigo_alumno].to_i\r\n personavinculada = params[:asistencia][:persona_vinculada_id].to_i\r\n if codigo == 0\r\n flash[:notice] = 'Ingrese el codigo del alumno'\r\n render :new\r\n else\r\n if !AnioAlumno.find_by_anio_escolar_id_and_alumno_id(anio_escolar.id, codigo)\r\n flash[:notice] = \"El codigo #{codigo} no existe\"\r\n redirect_to(:new_asistencia) and return\r\n end\r\n \r\n @asistencias = Asistencia.por_alumno_fecha(anio_escolar.id, codigo, Date.current)\r\n \r\n ingreso = 0\r\n fecha_hora = Time.now\r\n salida = 0\r\n @asistencias.each do |asistencia|\r\n if asistencia.tipo_movimiento == 1\r\n ingreso = 1\r\n fecha_hora = asistencia.fecha_hora\r\n end\r\n if asistencia.tipo_movimiento == 2\r\n salida = 1\r\n end\r\n end\r\n movimiento = 0\r\n if ingreso == 0 && salida == 0\r\n movimiento = 1\r\n end\r\n if ingreso == 1 && salida == 0\r\n if (Time.now- fecha_hora) > 60\r\n movimiento = 2\r\n end\r\n end\r\n \r\n if movimiento == 2\r\n if Alumno.find(codigo).salida_con_persona == 1\r\n cargarpersonasvinculadas = 0\r\n if personavinculada == 0\r\n if @personasvinculadas.nil?\r\n cargarpersonasvinculadas = 1\r\n else\r\n cargarpersonasvinculadas = 1\r\n end\r\n else\r\n if AlumnoPersonaVinculada.find_by_alumno_id_and_persona_vinculada_id(codigo, personavinculada).nil?\r\n cargarpersonasvinculadas = 1\r\n end\r\n end\r\n if cargarpersonasvinculadas == 1\r\n @personasvinculadas = PersonaVinculada.vinculadas_a(codigo)\r\n flash[:notice] = 'Seleccione la persona que recoge al alumno'\r\n @nuevo = 0\r\n render :new\r\n return\r\n end\r\n end\r\n end\r\n \r\n if movimiento == 0\r\n if salida == 0\r\n flash[:notice] = 'Ha intentado registrar dos veces el ingreso'\r\n else\r\n flash[:notice] = 'Ha intentado registrar dos veces la salida'\r\n end\r\n render :new\r\n @nuevo = 1\r\n else\r\n if personavinculada == 0\r\n personavinculada = nil\r\n end\r\n @asistencia = Asistencia.new(\r\n :anio_alumno_id => AnioAlumno.find_by_anio_escolar_id_and_alumno_id(anio_escolar.id, codigo).id,\r\n :fecha_hora => Time.now,\r\n :usuario => current_user.usuario,\r\n :persona_vinculada_id => personavinculada,\r\n :tipo_movimiento => movimiento\r\n )\r\n if !@asistencia.save\r\n flash[:notice] = 'Ocurrio un error al registrar la asistencia'\r\n format.html { render action: \"new\" }\r\n else\r\n if @guardados.nil?\r\n @guardados = [@asistencia.id]\r\n else\r\n @guardados.push(@asistencia)\r\n end\r\n \r\n if movimiento == 1\r\n @notificar = AlumnoPersonaVinculada.notificar_ingreso(codigo)\r\n else\r\n @notificar = AlumnoPersonaVinculada.notificar_salida(codigo)\r\n end\r\n if !@notificar.empty?\r\n @notificar.each do |alumnopersona|\r\n @persona = PersonaVinculada.find(alumnopersona.persona_vinculada_id)\r\n @alumno = Alumno.find(codigo)\r\n AsistenciaMailer.delay.notificar_asistencia(movimiento, @alumno, @asistencia, @persona) ## Asincrono\r\n end\r\n end\r\n end\r\n redirect_to :controller => 'asistencias', :action => 'new' , :codigo_alumno => codigo\r\n end\r\n end\r\n end",
"def agregar_estudiante_a_seccion\n \n if __es_del_grupo_docente && params[:id] && __es_numero_entero?(params[:id]) && SeccionSitioWeb.where(:id => params[:id]).size > 0\n @seccion = \"estudiantes\"\n @seccion_sitio_web = SeccionSitioWeb.where(:id => params[:id]).first\n @cedulas = Usuario.order(\"cedula\").where(:id => Estudiante.all).collect{ |x| x.cedula.to_s}.uniq\n return\n end\n\n redirect_to :asignatura_nombre => @sitio_web.nombre_url, :semestre => @sitio_web.periodo, :controller => \"estudiantes\", :action => \"index\"\n return\n end",
"def rescatar\n self.estado_id = 1 #salida si lo creo, entrada/foliado si lo redirijo\n self.estado_id = 3 if self.trazas.count(:conditions => 'movimiento_id in (2,7,8)') > 0\n if self.origen.externo\n RAILS_DEFAULT_LOGGER.info \"devolviendo de origen externo #{self.origen.to_label} a #{self.documento.buzon}\"\n self.buzon_id = self.documento.buzon_id\n else\n self.buzon_id = self.origen_id\n end\n self.add_traza(current_user.id, 14, current_user.puesto.buzon_id)\n self.save!\n end",
"def controllaInizio( pippo)\n if INIZIO == 1 && FINE > INIZIO\n return true\n else\n ultimoBook = Book.last\n end \n #ultimoBook = Book.last #<<=== cambiare (commentandola) questa istruzione per il primo ciclo di bidoni\n if INIZIO == ultimoBook.id+1 # 1 <<=== cambiare questa istruzione (mettere: INIZIO == 1) per il primo ciclo di bidoni\n return true\n else\n pippo.scriviRiga(\"Ultimo record in tabella books ha valore: #{ultimoBook.id}\") if INIZIO > 1\n return false\n end\nend",
"def RepeticionUsuarioCreate(lista_usuarios, nombre_usuario, apellidos_usuarios)\n val = true\n lista_usuarios.each do |usuario|\n if usuario.nombre_usuario == nombre_usuario.upcase\n if usuario.apellidos_usuario == apellidos_usuarios.upcase\n val = false\n break\n end\n end\n end\n return val\n end",
"def checkIdEscuelaForDirector\n if !self[:id_permission].nil? && self.user_permission.name == \"Director\"\n if !self[:escuela_id].nil?\n if !Escuela.exists?(id: self[:escuela_id])\n self.errors[:carrera_id] = \"La escuela seleccionada no se encuentra en el sistema.\"\n end\n else\n # El director creado no tiene una carrera asignada.\n self.errors[:escuela_id] = \"Debe seleccionar una escuela para el usuario director.\"\n end\n end\n end",
"def activar()\n\n i=0\n\n print \"Inicio planta\\n\"\n\n cantidadCervezas = 0\n while(i < @ciclos)\n\n i+=1;\n print \"---------->Ciclo numero\",i,\"<---------------\\n\"\n\n #Inicio de procesamiento\n @silosCebada.producir(@almacen)\n @silosCebada.imprimir()\n @molino.producir(@almacen)\n @molino.imprimir()\n @pailaMezcla.producir(@almacen)\n @pailaMezcla.imprimir()\n @cuba.producir(@almacen)\n @cuba.imprimir()\n @pailaCoccion.producir(@almacen)\n @pailaCoccion.imprimir()\n @tanquePreclarif.producir(@almacen)\n @tanquePreclarif.imprimir()\n @enfriador.producir(@almacen)\n @enfriador.imprimir()\n @tcc.producir(@almacen)\n @tcc.imprimir()\n @filtroCerveza.producir(@almacen)\n @filtroCerveza.imprimir()\n @tanqueFiltroCerveza.producir(@almacen)\n @tanqueFiltroCerveza.imprimir()\n @llenadora.producir(@almacen) \n @llenadora.imprimir() \n\n #Verifica si hubo cambios en la cantidad de cervezas\n #en el ciclo\n cervezasCiclo = @almacen.obtener_insumo(\"cerveza\")\n if (cantidadCervezas != cervezasCiclo)\n print \"Cervezas Salientes: \", (cervezasCiclo - cantidadCervezas), \"\\n\\n\"\n cantidadCervezas = cervezasCiclo\n end \n\n end\n\n #Despues de haber terminado de fabricar, imprimimos lo que haya quedado\n #en el almacen\n @almacen.imprimir()\n\n end",
"def create\n @coment = Comentar.new(comentar_params)\n \n user_id = @coment.user_id\n disciplinacurso_id= @coment.disciplinacurso_id\n professor_id= @coment.professor_id\n semestre_id= @coment.semestre_id\n \n verifica_comentario = Comentar.where(\"user_id=:user_id and disciplinacurso_id=:disciplinacurso_id and professor_id=:professor_id and semestre_id=:semestre_id\",{user_id:user_id, disciplinacurso_id:disciplinacurso_id,professor_id:professor_id,semestre_id:semestre_id}).exists?\n \n if !verifica_comentario then\n @comentario = @coment.comentario.split(' ')\n @comentario = @comentario.map{|comentario| remover_acentos(comentario).gsub /[^\\w\\s]/, ''}#remove acentuação\n \n @compara = Restricao.all\n @restricao = []\n @restricao = @compara.map{|compara| remover_acentos(compara.palavra).downcase}\n \n stemmer = Lingua::Stemmer.new(:language => \"pt\")\n \n @resultado = []\n @resultado = @comentario.select{ |comentario| @restricao.include?(stemmer.stem(comentario.downcase))}.map{ |comentario| comentario}\n \n @permite = true\n if @resultado.present? then \n @permite = false\n end\n \n respond_to do |format|\n if (@permite) then\n if @coment.save\n format.html { redirect_to '/demonstra_comentarios', notice: 'Comentário Incluído!'}\n format.html { render :new }\n format.json { render json: @coment.errors, status: :unprocessable_entity }\n end\n else \n format.html { redirect_to '/comentars/new', notice: 'O comentário não está nos padrões permitidos! Favor refazer.' }\n end \n end \n else message = 'Você já realizou um comentário para esta disciplina neste semestre!'\n redirect_to '/comentars/new', notice: message\n \n end\n end",
"def create\n @requisito = Requisito.new(requisito_params)\n\t\tif current_usuario.asignacion_roles.where(esActual: true, id: Rol.where(nombre: \"Voluntario\"), proyecto: @requisito.actividad.proyecto) && current_usuario.asignacion_roles.where(esActual: true, proyecto: @requisito.actividad.proyecto).count == 1\n\t\t\traise CanCan::AccessDenied if !Requisito.accessible_by(current_ability, :create).include?(Requisito.all.where(actividad: @requisito.actividad).first)\n\t\telse\n\t\t\tauthorize! :create, Requisito\n\t\tend\n respond_to do |format|\n\t if @requisito.unico && @requisito.save\n\t format.html { redirect_to :action => 'new', :actividad_id => @requisito.actividad\n\t\t flash[:success] = 'Requisito fue creado satisfactoriamente.' }\n format.json { render :show, status: :created, location: @requisito }\n else\n\t flash[:danger] = 'Por favor ingrese alguna habilidad correcta'\n format.html { redirect_to :action => 'new', :actividad_id => params[:requisito][:actividad_id] }\n format.json { render json: @requisito.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n cour = Cour.find(params[:elefe][:ville_entrainement])\n u = current_user\n #info_ville = params[:elefe][:info_ville].join.to_i\n #params[:elefe][:info_ville] = info_ville\n # CAS DES FICHES EXISTANTES\n if @All_Eleves.exists?(:nom => params[:elefe][:nom], :prenom => params[:elefe][:prenom])\n @fiche_exist = @All_Eleves.find_by(:nom => params[:elefe][:nom], :prenom => params[:elefe][:prenom])\n params[:elefe][:info_ville] = params[:elefe][:info_ville].join(',') if params[:elefe][:info_ville] != nil\n params[:elefe][:prix] = @tarif[params[:elefe][:parentee].to_i] if params[:elefe][:parentee] != nil\n # Fusion de l'élève avec une fiche existante créée à partir des présences (officialisation)\n if !@fiche_exist.date_naissance\n puts \"On update eleve existant\"\n @elefe = @fiche_exist\n cours = @elefe.cours\n if !cours.detect { |b| b.id == cour.id }\n @elefe.cours << cour\n end\n u.eleves << @elefe\n u.commandes << Commande.create(description: 'Affiliation '+params[:elefe][:nom]+' '+params[:elefe][:prenom], montant: params[:elefe][:prix])\n @elefe.commandes << u.commandes.last\n respond_to do |format|\n if @elefe.update(elefe_params)\n format.html { redirect_to @elefe, notice: 'La fiche élève a bien été modifiée.' }\n format.json { render :show, status: :ok, location: @elefe }\n else\n format.html { render :edit }\n format.json { render json: @elefe.errors, status: :unprocessable_entity }\n end\n end\n else\n # Ne peut pas écraser une fiche existante\n redirect_back(fallback_location: :back, alert: 'Il existe déjà un élève inscrit avec le même nom et prénom. Peut-être pourriez-vous entrer un deuxième prénom pour vous différencier ?')\n end\n # CAS CLASSIQUE DE L'INSCRIPTION\n else\n params[:elefe][:info_ville] = params[:elefe][:info_ville].join(',') if params[:elefe][:info_ville] != nil\n params[:elefe][:prix] = @tarif[params[:elefe][:parentee].to_i] if params[:elefe][:parentee] != nil\n @elefe = Elefe.new(elefe_params)\n @elefe.cours << cour\n u.eleves << @elefe\n u.commandes << Commande.create(description: 'Affiliation '+params[:elefe][:nom]+' '+params[:elefe][:prenom], montant: params[:elefe][:prix])\n @elefe.commandes << u.commandes.last\n respond_to do |format|\n if @elefe.save\n format.html { redirect_to @elefe, notice: 'La fiche élève a bien été créée.' }\n format.json { render :show, status: :created, location: @elefe }\n else\n format.html { render :new }\n format.json { render json: @elefe.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @caso.current_usuario = current_usuario\n @caso.memo = ''\n @caso.titulo = ''\n\n notificacion = 'Caso creado.'\n if @conscasocount > MAX_CASOS_REFRESCA_AUTOMATICO\n notificacion += \" Por la cantidad de casos (#{@conscasocount})\"+\n \" debe Refrescar para actualizar \" +\n \" el cambio en el listado de casos\"\n end\n respond_to do |format|\n if @caso.save\n if registrar_en_bitacora\n Msip::Bitacora.a(request.remote_ip, current_usuario.id,\n request.url, params, 'Sivel2Gen::Caso',\n @caso.id, 'crear', '')\n end\n\n format.html {\n redirect_to @caso,\n notice: notificacion\n }\n format.json {\n render action: 'show', status: :created, location: @caso,\n layout: 'application'\n }\n else\n format.html {\n render action: 'new', layout: 'application'\n }\n format.json {\n render json: @caso.errors, status: :unprocessable_entity\n }\n end\n end\n begin\n @conscasocount = Conscaso.count\n if @conscasocount <= MAX_CASOS_REFRESCA_AUTOMATICO\n puts Conscaso.refresca_conscaso\n end\n rescue\n puts Conscaso.refresca_conscaso\n end\n end",
"def almacenar(nombre)\n\t\narray = Tarea.all\n@@existente = false\narray.each{|x| @@existente = true if /#{nombre}/.match(x[\"title\"])}\n\t\nunless @@existente \nTarea.create(\"#{nombre} #{@@usuario}\")\n\nend\n@@existente\nend",
"def registrar_entrada(rango)\n reg = self.class.last(:conditions => {:usuario_id => self.usuario_id})\n reg = self.class.new if reg.nil?\n unless rango.include?(reg.created_at)\n self.tipo = \"E\"\n else\n errors.add_to_base(\"Usted ya ha registrado su Entrada\")\n return false\n end\n end",
"def chegou_no_destino?(cegonha)\n\n if cegonha.cidade_destino == cegonha.cidade_id && cegonha.estado_destino == cegonha.estado_id\n cegonha.cars.each do |car|\n # protege contra codigo legado antes do historico\n if car.historicos.empty?\n car.historicos.create(:cegonha_id => car.cegonha.id)\n end\n #saiu da cegonha\n car.historicos.last.update_attributes(:data_saida => Time.now, :localizacao_saida => car.cegonha.localizacao)\n # verifica se o carro descarregado chegou no destino ou se vai embarcar em outra cegonha/parceiro (logistica)\n if car.cidade_destino == cegonha.cidade_destino and car.estado_destino == cegonha.estado_destino\n car.ativo = 2\n else\n car.ativo = 6\n end\n car.cegonha = nil\n car.save\n\n end\n ceg_id = cegonha.id\n cegonha = Cegonha.find(ceg_id)\n cegonha.rotas += 1\n cegonha.cidade_origem = nil\n cegonha.cidade_destino = nil\n cegonha.estado_origem = nil\n cegonha.estado_destino = nil\n cegonha.save\n return true\n else\n return false\n end\n end",
"def create\n @ogrenci = Ogrenci.new(ogrenci_params)\n @ogrenci.date=Date.today\n\n if Ogrenci.exists?(tc_no: @ogrenci.tc_no)\n flash[:notice] = \"Bu öğrenci zaten KAYITLI !!\"\n redirect_to new_ogrenci_path\n else\n if !current_user.yonetici?\n flash[:notice] = \"Bu öğrencinin kaydını gerçekleştirebilmeniz için yönetici izni gereklidir !!\"\n redirect_to new_ogrenci_path\n else\n if @ogrenci.save\n flash[:notice]=\"Öğrenci kaydı başarıyla oluşturuldu.!!\" \n redirect_to @ogrenci \n end\n end\n end\n end",
"def create\n\t\tauthorize! :create, AsignacionRol\n @asignacion_rol = AsignacionRol.new(asignacion_rol_params)\n @asignacion_rol.esActual = true\n @asignacion_rol.active = true\n @proyecto = @asignacion_rol.proyecto\n @roles = []\n @rols = Rol.where(tipo_rol: TipoRol.where(nombre:'Proyecto'))\n coor_sist = Rol.where(\"nombre = ?\", 'Coordinador Sistema').first\n asig_func = AsignacionFuncion.where(\"usuario_id = ? AND rol_id = ?\", current_usuario, coor_sist).first\n @rols.each do |rol|\n if rol.nombre != 'Coordinador' || asig_func != nil then\n @roles << rol\n end\n end\n if unica(@asignacion_rol.usuario_id,@asignacion_rol.proyecto_id, @asignacion_rol.rol_id) == true\n\t respond_to do |format|\n\t if @asignacion_rol.save\n sesion= Sesion.find_by(usuario_id: current_usuario.id, fechaFin: nil)\n Transaccion.create!(\n \t\t descripcion: \"Creación asociación rol #{@asignacion_rol.rol.nombre} al usuario #{@asignacion_rol.usuario.nombreUsuario} del proyecto #{@asignacion_rol.proyecto.nombre} : actual = #{ t @asignacion_rol.esActual.to_s}\",\n \t\t sesion_id: sesion.id ,\n \t\t proyecto_id: @asignacion_rol.proyecto.id)\n\t\tformat.html {redirect_to :controller => 'asignacion_roles', :action => 'index',:proyecto_id => @asignacion_rol.proyecto.id } \n\t\tformat.json { render :show, status: :created, location: @asignacion_rol }\n\t else\n params[:usuario_id] = @asignacion_rol.usuario_id\n \t\tformat.html { render :new }\n \t\tformat.json { render json: @asignacion_rol.errors, status: :unprocessable_entity }\n\t end\n\t end\n else\n\t respond_to do |format|\n\t\t format.html { redirect_to :controller => 'asignacion_roles', :action => 'index', :proyecto_id => @asignacion_rol.proyecto.id\n\t\t flash[:danger] = 'El usuario ya se encuentra asignado' } \n\t end\n end\n end",
"def correr\n puts MENU\n print \"Que Deseas Hacer? \\n>> \"\n opcion = gets.chomp.to_i\n if opcion == 0\n puts \"GOD BYE....\"\n return opcion\n elsif opcion > 6\n puts \"Opcion no registrada.\"\n return 0 \n end\n salida = 0\n puts \"Indicar ruta del archivo\"\n ruta = gets.chomp\n #puts ruta\n managment = Manejador.new(ruta)\n if opcion == 1\n grals = Generales.new(managment)\n grals.frecuencias(true)\n salida = 1\n elsif opcion == 2\n puts \"Pendiente......\"\n salida = 2\n elsif opcion == 3\n cesar = Cesar.new(managment, true)\n puts \"Dame el desplazamiento. \"\n desplazamiento = gets.chomp.to_i\n cesar.cifrar_Cesar(desplazamiento)\n system(\"rm texto_limpio.txt\")\n salida = 3\n elsif opcion == 4\n cesar = Cesar.new(managment, false)\n puts \"Dame el desplazamiento. \"\n desplazamiento = gets.chomp.to_i\n cesar.des_encriptar_cesar(desplazamiento)\n salida = 4\n elsif opcion == 5\n vigen = Vigenere.new(managment, true)\n puts \"Dame la llave del cifrado.\"\n _key = gets.chomp.upcase\n vigen.cifra_vigenere(_key)\n system(\"rm texto_limpio.txt\")\n salida = 5\n elsif opcion == 6\n vigen = Vigenere.new(managment, false)\n puts \"Dame la llave del cifrado.\"\n _key = gets.chomp.upcase\n vigen.des_cifra_vigenere(_key)\n salida = 6\n end\n return salida\n end",
"def ligar #Metodo/função da classe Carro\n puts 'O carro está pronto para iniciar o trajeto.'\n end",
"def set_estoquemp\n if !Estoquemp.where(cliente_id: current_user.cliente_id).exists?\n redirect_to root_path\n flash[:danger] = \"Voce não possui itens cadastrados no estoque ainda!\"\n else\n @estoquemp = Estoquemp.where(cliente_id: current_user.cliente_id).first\n end\n end",
"def create_dup\n self.generate_key\n new = Mensaje.new(self.attributes.merge(:owner_id =>self.recibe_id))\n self.owner_id ||= self.envia_id\n self.save\n new.owner_id = self.recibe_id\n new.save if (new.valid? && !Mensaje.exists?(:clave => self.clave, :owner_id => new.owner_id))\n end",
"def set_registro\n if(Registro.where(id: params[:id] ).length>0)\n @registro = Registro.find(params[:id])\n\n else\n respond_to do |format|\n format.html { redirect_to personas_url, alert: '<i class=\"fa fa-exclamation-triangle fa-lg\"></i> El registro no se encuentra en la base de datos.' }\n end\n end\n end",
"def cicloInactiva\n \n #-- Se calcula la cantidad de insumo basico requerido por la maquina C \n insumoRequerido = @porcentajeIB * @cantidadMax\n \n #-- Unicamente si se tiene la cantidad requerida de insumo basico\n #-- en el contenedor, se procede a analizar el resto de la mezcla\n if @insumoBasico.cantidad >= insumoRequerido \n \n #-- Caso en el que la maquina posee un contenedor de enlace\n #-- con una maquina anterior.\n if @productoAnterior != nil\n \n\n \n #-- Se calcula la cantidad de producto anterior requerido\n #-- por la maquina Compleja\n productoAnteriorRequerido = @porcentajePA * @cantidadMax\n cantidadAObtener = productoAnteriorRequerido -\n @productoAnteriorRestante \n \n \n #-- Caso en el que el producto encontrado en el contenedor\n #-- es suficiente para comenzar el procesamiento de \n #-- la maquina\n if @productoAnterior.cantidad >= cantidadAObtener\n \n #-- Se resta la cantidad necesaria para comenzar a \n #-- procesar de la cantidad encontrada en el contenedor\n @productoAnterior.cantidad -= cantidadAObtener\n \n #-- Se disminuye la cantidad de insumo basico del \n #-- contenedor\n @insumoBasico.cantidad -= insumoRequerido\n @productoAnteriorRestante = 0.0\n \n #-- La maquina pasa al estado LLena\n @estado = \"Llena\"\n \n #-- Caso en el que el producto encontrado en el contenedor\n #-- no es el suficiente para comenzar el procesamiento de\n #-- de la maquina\n else\n #-- Se recolecta en su totalidad la fraccion restante \n #-- de producto anterior del contenedor\n @productoAnteriorRestante += @productoAnterior.cantidad\n @productoAnterior.cantidad = 0\n \n end\n \n #-- Caso en el que la maquina corresponde a la primera dentro\n #-- del proceso de produccion. Unicamente se verifica el insumo\n #-- basico, pues no se depende de ningun producto anterior.\n else\n @insumoBasico.cantidad -= insumoRequerido\n \n #-- La maquina pasa al estado LLena\n @estado = \"Llena\"\n end\n end\n end",
"def create\n if current_usuario.GOLD\n aux_create\n elsif not current_usuario.GOLD \n if current_usuario.fotos.where(FECHA: Date.current).count <= 0 \n aux_create\n else \n redirect_to current_usuario\n flash[:notice] = \"No puedes subir más de una foto al día. Hazte gold!\"\n end\n end\n end",
"def create\n nueva_compra\n respond_to do |format|\n Compra.transaction do\n if @compra.guardar(compra_params, params[:guardar_si_o_si].present?)\n format.html { redirect_to @compra, notice: t('mensajes.save_success', recurso: 'la compra') }\n format.json { render :show, status: :created, location: @compra }\n else\n get_pago\n format.html { render :form }\n format.json { render json: @compra.errors, status: :unprocessable_entity }\n end\n end\n end\n\n end",
"def guarda_nombres_comunes_todos\n dame_nombres_comunes_todos\n\n if x_nombre_comun_principal.present?\n a = adicional ? adicional : Adicional.new(especie_id: id)\n a.nombres_comunes = x_nombres_comunes.encode('UTF-8', {invalid: :replace, undef: :replace, replace: ''})\n a.nombre_comun_principal = x_nombre_comun_principal.force_encoding(\"UTF-8\")\n\n if a.changed?\n a.save\n reload\n end\n end\n end",
"def mi_carrera\n\n\tend",
"def guardar_todo\n tags = Tag.find(:all, :conditions=>['enlazados=0 OR enlazados!=ocurrencias']) #Hallamos todas la palabras clave\n actualizaciones=0 \n for tag in tags\n actualizaciones+=guardando tag\n enlazar tag.id\n end\n \n contando\n \n mensaje='Número de links guardados correctamente: <strong>'+actualizaciones.to_s+'</strong><br/>' \n flash[:notice] = mensaje\n \n respond_to do |format|\n format.html { redirect_to(admin_tags_path) }\n format.xml { head :ok }\n end\n end",
"def isRegistado?\n if session[:perm] == 0\n return true;\n else\n return false;\n end\n end",
"def crear_en_bloque\r\n if current_user.nil?\r\n redirect_to(log_in_path) and return\r\n end\r\n\r\n ActiveRecord::Base.transaction do\r\n params[:alumno_id].each do |alumno|\r\n @asistencia_alumno_persona_vinculada = Asistencia.new(\r\n :anio_alumno_id => AnioAlumno.find_by_anio_escolar_id_and_alumno_id(anio_escolar.id, alumno).id,\r\n :fecha_hora => Time.now,\r\n :persona_vinculada_id => params[:persona_vinculada_id],\r\n :usuario => current_user.usuario,\r\n :tipo_movimiento => 2\r\n )\r\n\r\n if !@asistencia_alumno_persona_vinculada.save\r\n flash[:notice] = 'Ocurrio un error al registrar la salida'\r\n format.html { render action: \"consultar\" }\r\n else\r\n if @guardados.nil?\r\n @guardados = [@asistencia_alumno_persona_vinculada.id]\r\n else\r\n @guardados.push(@asistencia_alumno_persona_vinculada)\r\n end\r\n \r\n @notificar = AlumnoPersonaVinculada.notificar_salida(alumno)\r\n if !@notificar.empty?\r\n @notificar.each do |alumnopersona|\r\n if alumnopersona.persona_vinculada_id != params[:persona_vinculada_id]\r\n @persona = PersonaVinculada.find(alumnopersona.persona_vinculada_id)\r\n @alumno = Alumno.find(alumno)\r\n AsistenciaMailer.delay.notificar_asistencia(2, @alumno, @asistencia_alumno_persona_vinculada, @persona) ## Asincrono\r\n end\r\n end\r\n end\r\n end\r\n end\r\n end\r\n\r\n tipo = PersonaVinculada.find(params[:persona_vinculada_id]).tipo_documento\r\n numero = PersonaVinculada.find(params[:persona_vinculada_id]).numero_documento\r\n redirect_to :controller => 'alumnos_personas_vinculadas', :action => 'consultar',\r\n :tipo_documento => tipo, :numero_documento => numero\r\n end",
"def seguir(otro_usuario)\n\t\t# siguiendo << otro_usuario\n\t\trelaciones_activas.create(seguido_id: otro_usuario.id)\n\tend",
"def prueba\n if self.moduloCreate.nil? == false\n Modulo.create(nombre: self.moduloCreate)\n end\n end",
"def create\n authorize! :create_almacen,Sigesp::Solicitud \n unidad = session['unidad'] \n return render json: { unidad: \"Esta Unidad Administrativa no tiene Numero de Control \" }, status: :unprocessable_entity if Sigesp::CtrlRequisicion.control_compra(unidad).nil?\n\n @solicitudes = Sigesp::Solicitud.crear_solicitudes_almacen(sigesp_solicitud_alamcen_params)\n @grupoSolicitud = SolicitudGrupo.new\n @solicitudes.each do |solicitud|\n @grupoSolicitud.solicitudes << solicitud \n end\n if @grupoSolicitud.valid? \n @grupoSolicitud.guardar(unidad,current_usuario)\n return render json: { url: sigesp_solicitudsalmacen_path(@grupoSolicitud.solicitudes[0])} \n else\n return render json:@grupoSolicitud.errors ,status: :unprocessable_entity\n end \n end",
"def debe_ser_encarcelado\n if is_encarcelado\n return false\n else\n if !tiene_salvoconducto\n return true\n else\n perder_salvoconducto\n Diario.instance.ocurre_evento(\"El jugador se libra de la cárcel\")\n return false\n end\n end\n end",
"def create\n Cabcompra.transaction do\n @cabcompra = Cabcompra.new(params[:cabcompra])\n @comprobante = Tipocomprobante.find(@cabcompra.tipocomprobante_id)\n if ((@comprobante.tcom_discriminaiva.to_s == 'No') || ((params[:rencompras][:rcom_netorenglon].nil?) || (params[:rencompras][:rcom_netorenglon][0].to_i > 0)))\n idplanilla = Cabcompra.maximum(:id, :conditions => [\"sucursal_id = ?\", session[:sucursal]]) \n @cabcompra.id = [idplanilla.to_i + 1, session[:sucursal]]\n # busco y grabo proveedor_id \n str_tokens = \"\"\n str_tokens = params[:proveedor][:prov_cuit].split(\"|\") if params[:proveedor]\n \n @proveedor = Proveedor.find(:first, :conditions => [\"sucursal_id = ? and prov_codigo = ? \", session[:sucursal], str_tokens[2].lstrip] ) if str_tokens[2] \n @cabcompra.proveedor_id = @proveedor.id[0] if str_tokens[2] \n $proveedor = @proveedor.id[0] if str_tokens[2] #para la validacion de proveedores 1 y 2\n @proveedor.prov_cuit = params[:proveedor][:prov_cuit].to_s if str_tokens[2] # por si vuelve con error\n @cabcompra.ccom_ultmod = DateTime.now\n @cabcompra.ccom_usuario = session[:user].usur_nombre\n @cabcompra.ccom_hastacompro = (params[:cabcompra][:ccom_hastacompro].nil? || params[:cabcompra][:ccom_hastacompro].to_i == 0) ? params[:cabcompra][:ccom_desdecompro] : params[:cabcompra][:ccom_hastacompro]\n str_tokens = @cabcompra.id.to_s.split(\",\") \n $plaegid = params[:cabcompra][:cabplaegreso_id]\n $sucursal = session[:sucursal]\n #graba compra o gasto segun el comprobante tenga o no iva\n if (params[:cabcompra][:ccom_iva].nil? || params[:cabcompra][:ccom_iva].to_d == 0 )\n @cabcompra.ccom_gastocompra = 'GASTO'\n else\n @cabcompra.ccom_gastocompra = 'COMPRA'\n end\n @cabcompra.ccom_gastocompra = 'COMPRA' if @comprobante.tcom_cabecera.to_s == 'S' #para los comprobantes de retenciones\n respond_to do |format|\n if @cabcompra.save\n if ((@comprobante.tcom_discriminaiva.to_s == 'Si') && (params[:rencompras][:rcom_netorenglon][0].to_d > 0) && @comprobante.tcom_cabecera.to_s == 'N') \n grabarenglonescompra()\n end\n \n flash[:notice] = 'El comprobante ha sido creado.'\n if @cabcompra.cabplaegreso_id > 0\n format.html { redirect_to(:controller => 'cabcompras', :action => 'index', :nrope => @cabcompra.ccom_nroplaegreso, :idpe => @cabcompra.cabplaegreso_id) }\n else\n format.html { redirect_to(:controller => 'cabcompras', :action => 'comprobantes', :id => 0) }\n end\n format.xml { render :xml => @cabcompra, :status => :created, :location => @cabcompra }\n else\n params[:idpe] = params[:cabcompra][:cabplaegreso_id]\n params[:nrope] = params[:cabcompra][:ccom_nroplaegreso]\n \n @alicuotaivas = Alicuotaiva.find(:all) \n @rencompra = Rencompra.new\n @jurisdiccions = Jurisdiccion.find(:all, :order =>\"juri_nombre\")\n @cabplaegreso = Cabplaegreso.find([params[:idpe], session[:sucursal]])\n @conceptoegresos = Conceptoegreso.find(:all, :order =>\"cegr_detalle\")\n @tipocomprobantes = Tipocomprobante.find(:all, :order =>\"tcom_nombre\")\n @iva = Tipocomprobante.find(@cabcompra.tipocomprobante_id) \n \n format.html { render :action => \"new\" }\n format.xml { render :xml => @cabcompra.errors, :status => :unprocessable_entity }\n end\n end\n else\n render :text => \"<h7> El comprobante no se guardo porque no cargo ningun detalle (renglón) </h7>\", :layout => 'application' \n end\n end\n end",
"def verificar_autenticado_admin\n unless session[:usuario_admin] #else if,tiene quer ser falso\n bitacora \"Intento de accceso sin autenticacion a la zona del admin\"\n flash[:error]=\"Debe autenticarse como Administrador\"\n redirect_to :action => \"index\" , :controller => \"externo\"\n return false\n end\n end",
"def revisa_deuda\n if com_compra.adeudos[:cuentas_con_deuda] == 0\n com_compra.pagado!\n else\n com_compra.pendiente!\n end\n end",
"def analizarPago(idPago, idFactura)\n sist = Sistema.new\n pago = JSON.parse(sist.obtenerTransaccion(idPago))\n Rails.logger.debug(\"debug:: Se obtuvo el pago\")\n ## Vemos que el pago exista\n if pago[0] == nil\n return false \n end\n if pago[0][\"param\"] == \"id\"\n return false\n end\n Rails.logger.debug(\"debug:: Pago existe\")\n ## Vemos que la factura exista\n factura = JSON.parse(sist.obtenerFactura(idFactura))\n if factura[0] == nil\n return false \n end\n if factura[0][\"param\"] == \"id\"\n return false\n end \n Rails.logger.debug(\"debug:: Factura existe\")\n\n ## Obtenemos la orden de compra de la factura (asumimos que existe)\n idoc = factura[0][\"oc\"]\n oc = JSON.parse(sist.obtenerOrdenDeCompra(idoc))\n Rails.logger.debug(\"debug:: Orden de Compra obtenida\")\n\n ## Comprobamos que el monto sea el correcto\n if factura[0][\"total\"].to_i != pago[0][\"monto\"].to_i\n return false\n end\n Rails.logger.debug(\"debug:: Monto Correcto\")\n\n ## Comprobamos que seamos el destinatario del pago\n if pago[0][\"destino\"] != sist.idBanco\n return false\n end\n Rails.logger.debug(\"debug:: Destinatario Correcto\")\n\n ## Vemos que ese pago no estuviera ya ingresado\n oc = Oc.find_by(pago: idPago)\n if oc != nil\n return false\n end\n sist.facturaPagada(idFactura)\n Rails.logger.debug(\"debug:: El pago es nuevo, se marcó en el sistema como \")\n\n \n ## Actualizamos la oc\n ocBD = Oc.find_by(oc: idoc)\n \n ## La OC es de otro?\n if ocBD == nil\n return false\n end\n \n ocBD.update(estados: \"Pagada\")\n ocBD.update(pago: idPago)\n Rails.logger.debug(\"debug:: Datos actualizados\")\n \n invent = Inventario.new \n invent.definirVariables\n Thread.new do\n Rails.logger.debug(\"debug:: intentamos despachar\")\n ## Gatillamos el envio desde aqui si es posible?\n res = invent.verSiEnviar(idFactura)\n nOtroGrupo = Grupo.find_by(factura: idFactura)[\"nGrupo\"]\n #url = \"http://localhost:3000/api/despacho/recibir/\" + fact[\"_id\"]\n url = \"http://integra\" + nOtroGrupo.to_s + \".ing.puc.cl/api/despacho/recibir/\" + idFactura\n ans = sist.httpGetRequest(url ,nil)\n Rails.logger.debug(\"debug:: le avisamos al otro grupo\")\n\n\n end\n return true \n end",
"def create\n @conteudo = Conteudo.new(params[:conteudo])\n if ( current_user.has_role?('professor_infantil') or current_user.has_role?('professor_fundamental') ) \n @conteudo.disciplina_id= session[:cont_disciplina_id]\n if ( current_user.has_role?('professor_infantil') and current_user.unidade_id != 60)\n @conteudo.disciplina_id=115\n end\n end\n if ( current_user.has_role?('professor_infantil') or current_user.has_role?('professor_fundamental')or current_user.has_role?('pedagogo')) and current_user.unidade_id==60\n @conteudo.classe_id= nil\n else\n @conteudo.classe_id= session[:cont_classe_id]\n end\n @conteudo.atribuicao_id= session[:cont_atribuicao_id]\n @conteudo.ano_letivo = Time.now.year\n @conteudo.unidade_id = current_user.unidade_id\n @conteudo.user_id = current_user.id\n respond_to do |format|\n if @conteudo.save\n session[:new_id]=@conteudo.id\n flash[:notice] = 'Salvo com sucesso.'\n if session[:new_direcao]==1\n session[:new_direcao]=0\n format.html { redirect_to(show_direcao_path) }\n else if session[:new_mqa]=1\n session[:new_mqa]=0\n format.html { redirect_to(show_mqa_path) }\n format.xml { render :xml => @conteudo, :status => :created, :location => @conteudo }\n else\n format.html { redirect_to(@conteudo) }\n format.xml { render :xml => @conteudo, :status => :created, :location => @conteudo }\n\n end\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @conteudo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new # modificacion para transacciones\n @solicitudrecurso = Solicitudrecurso.new \n\n #cargo los usuarios y los diferentes recursos\n @usuarios=Usuario.find(:all,:order=>\"apellidos\").reject{|u| u.identificador==\"anonimo\"} \n \n \n #identifico los tipos distintos de recurso\n @tipos = Recurso.find(:all).map{ |i| i.descripcion }.uniq\n \n # cargo los dias y horas posibles para los select\n @dias=Dia.find(:all,:conditions=>['en_uso = ?',\"t\"])\n @horas=Horario.find(:all,:conditions=>['en_uso = ?',\"t\"])\n\n #obtengo y formateo la fecha actual \n @dia=@solicitudrecurso.fechareserva=formato_europeo(Date.today)\n\n # esto es para crear un carro no persistente \n session[:tramos_horarios]=Solicitudhoraria.new\n # y una identificacion de tramos horarios para poder borrarlos individualmente. Se ira decrementando\n session[:codigo_tramo]=0\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitudrecurso }\n end\n end",
"def ensure_remitente_exists\n begin\n Entidad.find(self.remitente_id)\n rescue ActiveRecord::RecordNotFound\n errors.add(:remitente,'Debe seleccionar un Remitente')\n end\n\n end",
"def create\n @ingrediente = Ingrediente.new(params[:ingrediente])\n if @ingrediente.save\n unidadesmedida = Unidadmedida.find(:all)\n for unidad in unidadesmedida\n valor=0\n medida=Unidadmedidaingrediente.find(:first,:conditions => \"ingrediente = \"+@ingrediente.id.to_s+\" AND unidadmedida = \"+unidad.id.to_s)\n if params[\"unidad_\"+unidad.id.to_s]==\"yes\"\n if medida==nil\n medida=Unidadmedidaingrediente.new\n medida.ingrediente=@ingrediente.id\n medida.unidadmedida=unidad.id\n medida.save\n end\n else\n if medida!=nil \n medida.destroy\n end\n end\n end\n end\n redirect_to :action => \"index\"\n end",
"def crear\n @quienes_somos = QuienesSomo.new\nend",
"def new # modificacion para transacciones\n @solicitudrecurso = Solicitudrecurso.new \n\n #cargo los usuarios y los diferentes recursos\n @usuarios=Usuario.order(\"apellidos\").to_a.reject{|u| u.identificador==\"anonimo\"} \n \n \n #identifico los tipos distintos de recurso\n @tipos = Recurso.all.map{ |i| i.descripcion }.uniq\n \n # cargo los dias y horas posibles para los select\n @dias=Dia.where('en_uso = ?',\"t\").to_a\n @horas=Horario.where('en_uso = ?',\"t\").to_a\n\n #obtengo y formateo la fecha actual \n @dia=@solicitudrecurso.fechareserva=formato_europeo(Date.today)\n\n # esto es para crear un carro no persistente \n session[:tramos_horarios]=Solicitudhoraria.new\n # y una identificacion de tramos horarios para poder borrarlos individualmente. Se ira decrementando\n session[:codigo_tramo]=0\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitudrecurso }\n end\n end",
"def create\n #abort @resVerifByHour.inspect\n @reserva = Reserva.new(reserva_params)\n @resVerifByHour = Reserva.where(\"escenario_id = ? and fecha = ?\", @reserva.escenario, @reserva.fecha)\n #abort @reserva.horainicio(1i).inspect\n if !@resVerifByHour.empty?\n @reserva.destroy\n redirect_to escenarios_path\n flash[:notice] = 'Este escenario ya se encuentra reservado por otro usuario.'\n else\n respond_to do |format|\n @reserva.estado = \"1\"\n @reserva.save\n if @reserva.save\n format.html { redirect_to escenarios_path, notice: 'Reserva was successfully created.' }\n format.json { render :show, status: :created, location: @reserva }\n else\n format.html { render :new }\n format.json { render json: @reserva.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def comprar_titulo_propiedad\n comprado = false\n \n coste_compra = @casilla_actual.coste\n \n if coste_compra < @saldo\n \n @casilla_actual.titulo.propietario = self\n \n comprado = true\n @propiedades << @casilla_actual.titulo\n \n modificar_saldo (-coste_compra)\n \n end\n \n return comprado\n end",
"def RepeticionMarcaCreate(lista_marcas, nombre_marca)\n val = true\n lista_marcas.each do |marca|\n if marca.descrip_marca == nombre_marca.upcase\n val = false\n break\n end\n end\n return val\n end",
"def validar_despacho\n begin \n idfactura = params.require(:idfactura)\n result = Hash.new \n result[:idfactura] = idfactura \n result[:validado] = true\n logger.debug(\"...Validar despacho\")\n\n\n response_inv = InvoicesController.new.obtener_factura(idfactura)\n if response_inv[:status]\n factura = response_inv[:result]\n if factura\n order_obj = Order.where('_id = ?',factura[0]['oc'].to_s).first\n order_obj.estado = 'despachada'\n order_obj.save\n end\n end\n\n # Una vez se ha pagado el proveedor confirma el\n # despacho de los insumos\n Spawnling.new do\n mover_productos()\n end\n #respond_with result, json: result\n respond_to do |format|\n format.json { render json: result }\n format.html { render json: result }\n end\n rescue => ex\n Applog.debug(ex.message,'validar_despacho')\n respond_to do |format|\n format.json { render json: {:status => false} }\n format.html { render json: {:status => false} }\n end\n end\nend",
"def verificar_permiso\n if user_signed_in?\n unless current_user.employee.nil?\n @existe_permiso = false\n current_user.employee.security_profile.security_role.security_role_menus.each do |security_role_menu|\n if security_role_menu.security_menu.controller == params[:controller] \n @existe_permiso = true\n break\n elsif params[:controller] == \"service/services\" and session[:atender] == true\n @existe_permiso = true\n end\n if params[:controller] == \"security/role_type_menus\" || params[:controller] == \"security/role_menus\"\n @existe_permiso = true\n end\n end\n if current_user.username == \"aadmin\"\n @existe_permiso = true\n end\n if @existe_permiso == false\n redirect_to root_path\n end\n end\n end\n end",
"def create\n @trabajo = Trabajo.find(params[:trabajo_id])\n presupuestos_de_proveedor = @trabajo.presupuestos.where(:proveedor_id => current_proveedor.perfilable_id).size\n if presupuestos_de_proveedor > 0\n flash[:warning] = \"Ya has presentado un presupuesto para esta solicitud.\"\n redirect_to @trabajo\n return\n end\n \n @presupuesto = @trabajo.presupuestos.build(params[:presupuesto])\n @presupuesto.proveedor_id = current_proveedor.perfilable_id\n \n @path = [@trabajo, @presupuesto]\n @es_el_proveedor = false\n if proveedor_signed_in?\n @es_el_proveedor = @presupuesto.proveedor_id.eql?(current_proveedor.perfilable_id)\n end\n respond_to do |format|\n if @presupuesto.save\n TtpMailer.notificar_presupuesto_recibido(@trabajo,@presupuesto)\n flash[:success] = \"Presupuesto enviado satisfactoriamente.\"\n format.html { redirect_to @presupuesto }\n format.json { render json: @presupuesto, status: :created, location: @presupuesto }\n else\n flash[:error] = \"Ocurrió un error. Revisa el formulario.\"\n format.html { render action: \"new\" }\n format.json { render json: @presupuesto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def validar_factura\n begin\n logger.debug(\"...Inicio validar factura\")\n idfactura = params.require(:idfactura)\n result = Hash.new \n result[:validado] = false\n result[:idfactura] = idfactura \n response_inv = InvoicesController.new.obtener_factura(idfactura)\n\n if response_inv[:status]\n result_inv = response_inv[:result]\n cliente = InfoGrupo.where('id_grupo = ?',result_inv[0]['cliente']).first\n # Una vez recibida la factura se procede a realizar el pago\n response_bank =BankController.new.transferir(result_inv[0]['total'],\n Rails.application.config.bank_account,cliente['id_banco'])\n order_obj = Order.where('_id = ?', result_inv[0]['oc'].to_s).first\n if response_bank[:status]\n result_bank = response_bank[:result]\n # Se envia la transaccion para que el cliente verifique el pago\n result[:validado] = true\n Spawnling.new do\n\t begin\n ########## Actualizamos factura localmente ###########\n factura = Factura.where('_id = ?', idfactura).first\n if !factura.blank?\n factura.idtrx = result_bank['_id']\n factura.save\n else\n\t logger.debug(result_bank);\n logger.debug(result_inv); \n factura_obj = Factura.create!({\n :_id => result_inv[0]['_id'].to_s, \n :bruto => result_inv[0]['bruto'].to_f,\n :iva => result_inv[0]['iva'].to_f, \n :total => result_inv[0]['total'].to_f,\n :idtrx => result_bank['_id'].to_s,\n\t :order_id => order_obj['id'].to_i }) \n end\n order_obj.estado = 'pagada'\n order_obj.save\n enviar_transaccion(result_bank,idfactura)\n \t rescue => ex\n \t Applog.debug(ex.message,'validar_factura_2')\n \t end\n\t end\n else\n order_obj.estado = 'anulada por error pago'\n order_obj.save\n result[:validado] = false\n OrdersController.new.anular_oc(result_inv[0]['oc'].to_s,'Error')\n end \n end\n logger.debug(\"...Fin validar factura\")\n #respond_with result, json: result\n respond_to do |format|\n format.json { render json: result }\n format.html { render json: result }\n end\n rescue => ex\n Applog.debug(ex.message,'validar_factura')\n respond_to do |format|\n format.json { render json: {:status => false} }\n format.html { render json: {:status => false} }\n end\n end\t\nend",
"def generar_horarios\n # verificar si los horarios ya estan generados\n date_at = Time.zone.now.strftime(\"%Y-%m-%d\")\n horarios = HorarioCancha.where(\"created_at >= ?\", date_at)\n if horarios.count() > 1\n redirect_to admin_path, alert: 'Los horarios ya han sido generados!'\n return\n end\n CreateHorariosJob.perform_later\n redirect_to admin_path, notice: 'Se generaron los horarios de todas las canchas'\n end",
"def create\n @project = Project.new(project_params)\n @nameEverExist = Project.find_by name: @project.name\n if @nameEverExist == nil || (@nameEverExist.user == current_user && @nameEverExist.is_re_fundable)\n @project.user = current_user\n @project.status = 0\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, :flash => {success: 'Projet créé avec succès'} }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to @project, :flash => {error: 'Impossible de crée le projet, ce nom est déjà utilisé'} }\n format.json { render :show, status: :created, location: @project }\n end\n end\n end",
"def secuenciasugerida \n #recupera los hijos del padre de la cuenta a crear \n\t\thijos = Catalogo.where(\"padre_id = ? AND activo = ?\", idcuenta, true)\n\n #configuracion del nivel a crear\n\t\tidnivel = Catalogo.find_by(id: idcuenta).nivel_id\n\t\tnivelh = Nivel.find_by(id: idnivel).numnivel + 1\n\n nivel = Nivel.find_by(numnivel: nivelh)\n nrodigitos = nivel.nrodigitos\n nrodigitostotal = nivel.nrodigitostotal\n digito = 0\n aux = 0\n\n hijos.each do |e|\n \taux = e.codigo.last(nrodigitos).to_i\n \t\tif digito < aux\n\t\t\t\tdigito = aux\n \t\tend\n \tend\n \tdigito = digito + 1\n \tc =\"\"\n \tnrodigitos.times { c = c + \"0\" }\n \tc = c.to_s + digito.to_s \t\n \t\t\n #codigo sugerido\n \treturn c.last(nrodigitos).to_s\n\tend",
"def debo_ir_a_carcel\n if (super)\n return !pagar_fianza\n else\n return true \n # Lo hemos hecho así, porque pensamos que si tiene carta y llama a \n # pagar fianza y tiene el saldo suficiente, se restaría dinero\n # del saldo aún teniendo la carta libertad\n end\n end",
"def create\n\n\n @it_inscripcion_registro = current_user.it_inscripcion_registros.build(it_inscripcion_registro_params)\n\n #Se cuenta cuantas personas se han preinscrito a un grupo. Se cuenta con todos los registros no\n #importando que éstos no hayan sido validados. El dato se obtiene a través de todos los registros\n #de preinscripción, el id para el grupo actual se obtiene con @it_inscripcion_registro.grupo_id\n cupos = ItInscripcionRegistro.where(grupo_id: @it_inscripcion_registro.grupo_id).count\n\n #Se localiza si el usuatio tiene un id previo con ese mismo grupo. Si existe se le envia un mensaje\n # y no se permite guardar el registro por segunda ocasión.\n usuario = User.find(current_user.id)\n registro = ItInscripcionRegistro.find_by(user_id: usuario, grupo_id: @it_inscripcion_registro.grupo_id)\n\n #Si el cupo del grupo excede los 25 alunos se le muestra un mensaje al usuario donde se le indica\n #que deberá elegir un grupo distinto, el registro de inscripción no se guardará en la base dde datos_bancos\n #hay que agregar este metodo a las rb de el modelo correspondiente.\n if cupos > 40\n redirect_to new_it_inscripcion_registro_path, notice: \"El grupo ha alcanzado su ocupación máxima. Por favor elija otro grupo\"\n elsif registro.present? && registro.grupo_id == @it_inscripcion_registro.grupo_id\n redirect_to panel_alumnos_path, notice: \"Usted ya tiene registrada una solicitud con este grupo.\"\n else\n\n respond_to do |format|\n if @it_inscripcion_registro.save\n format.html { redirect_to @it_inscripcion_registro, notice: 'El registro de inscripción se creó correctamente.' }\n format.json { render :show, status: :created, location: @it_inscripcion_registro }\n else\n format.html { render :new }\n format.json { render json: @it_inscripcion_registro.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def reenviar_usuario\n @bandera = false\n if user_signed_in?\n unless current_user.employee.nil?\n @permiso_reenviar_usuario = false\n @security_role_type = Security::RoleType.find_by(name: \"Reenviar Usuario\").name\n current_user.employee.security_profile.security_role.security_role_menus.each do |security_role_menu| \n if security_role_menu.security_menu.controller == params[:controller] \n security_role_menu.security_role_type_menus.each do |role_type|\n if @security_role_type == role_type.security_role_type.name\n @permiso_reenviar_usuario = true\n break\n elsif role_type.security_role_type.name == \"Consultar\"\n @bandera = true\n end\n end\n end\n end\n if current_user.username == \"aadmin\"\n @permiso_reenviar_usuario = true\n end\n if @bandera == true\n elsif params[:action] == \"forget_username_list\" && @permiso_reenviar_usuario == false\n redirect_to root_path\n end\n return @permiso_reenviar_usuario\n end\n end\n end",
"def create\n @pedidos = Pedido.find(:all,:conditions=> {:status => [0], :user_id => current_user.id})\n if @pedidos[0].imagen_pedidos.count < 3\n @imagen_pedido = ImagenPedido.new(params[:imagen_pedido])\n @imagen_pedido.pedido_id = @pedidos[0].id\n respond_to do |format|\n if @imagen_pedido.save\n format.html { redirect_to imagen_pedidos_path, notice: 'La imagen fue subida satisfactoriamente.' }\n format.json { render json: @imagen_pedido, status: :created, location: @imagen_pedido }\n else\n format.html { render action: \"new\" }\n format.json { render json: @imagen_pedido.errors, status: :unprocessable_entity }\n end\n end\n else\n #moviendo el estado a 1: Listo para verificacion\n @pedidos[0].status = 1\n @pedidos[0].save\n redirect_to pedidos_path, notice: 'El pedido ha sido enviado\nsatisfactoriamente.'\n end\n end",
"def create\n @usuario = Usuario.new(params[:usuario])\n if not @usuario.bloqueado or @usuario.admin == 2\n #Usuario esta habilitado\n @usuario.bloqueado = 0\n end\n usuario.transcriptor = true unless usuario.transcriptor or usuario.responsable\n\n respond_to do |format|\n if not @usuario.transcriptor and not @usuario.responsable\n flash.keep\n format.html { render action: \"new\", alert: 'El administrador debe ser transcriptor y/o responsable' }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end \n\n if @usuario.save\n CorreosUsuario.enviar_contrasena(@usuario, flash[:contrasena], 1).deliver\n format.html { redirect_to @usuario, notice: 'Usuario creado exitosamente.'}\n format.json { render json: @usuario, status: :created, location: @usuario }\n else\n flash.keep\n format.html { render action: \"new\", alert: 'Usuario no pudo ser creado.' }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if autenticacion == \"admin\"\n @log_pelea_guilty = LogPeleaGuilty.new(params[:log_pelea_guilty])\n\n respond_to do |format|\n if LigaGuilty.where(:id_cuenta=>@log_pelea_guilty.id_ganador).count!=0 && LigaGuilty.where(:id_cuenta=>@log_pelea_guilty.id_perdedor).count!=0\n #get info de los usuarios\n id1=LigaGuilty.where(:id_cuenta=>@log_pelea_guilty.id_ganador)\n id2=LigaGuilty.where(:id_cuenta=>@log_pelea_guilty.id_perdedor)\n\n #calculo de cambio de puntuacion en el ranking\n @log_pelea_guilty.puntos_ganador=calcularPuntosGanador(id1[0].puntos,id2[0].puntos)\n @log_pelea_guilty.puntos_perdedor=-calcularPuntosPerdedor(id1[0].puntos,id2[0].puntos)\n\n #aqui termina y los resultados quedan en $a1 y $.. q?? no no! queda en @logpelea.puntosid1 y en @logpelea.puntosid2\n id1[0].puntos+=@log_pelea_guilty.puntos_ganador\n id1[0].save\n\n id2[0].puntos+=@log_pelea_guilty.puntos_perdedor\n id2[0].save\n #Fin calculos y saves externos\n\n if @log_pelea_guilty.save\n format.html { redirect_to(@log_pelea_guilty, :notice => 'Log pelea guilty was successfully created.') }\n format.xml { render :xml => @log_pelea_guilty, :status => :created, :location => @log_pelea_guilty }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @log_pelea_guilty.errors, :status => :unprocessable_entity }\n end\n else\n format.html { redirect_to(@log_pelea_guilty, :notice => 'Error: al menos uno de los jugadores no esta inscrito.') }\n end\n end\n end\n end",
"def new_permiso_diario\n @permiso_diario = PermisoDiario.new\n @id = PermisoDiario.next_id\n @solicita = User.get_solicitante(current_user.id)\n @jefe_area = User.get_jefe_area(current_user.id)\n @vehiculos = Vehiculo.get_area_vehiculos(current_user.id)\n end",
"def create\n @usuario = Usuario.new(params[:usuario])\n @usuario.rol_list = params[:rols_buffer].split(\",\").map { |s| s.to_i }\n dummy = @usuario.rol_list.pop #El ultimo elemento siempre es cero por un defecto...\n\n error_flag = 0\n begin\n @usuario.save!\n rescue\n error_flag = 1\n @usuario.errors.add_to_base \"Error guardando el registro!!!\"\n @rols_disp = Rol.find(:all, :conditions => \"id NOT IN (#{@usuario.rol_list.join(\",\")})\")\n @rols_selec = Rol.find(@usuario.rol_list)\n end\n\n respond_to do |format|\n if error_flag == 0\n flash[:notice] = nil\n format.html { redirect_to(usuarios_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @usuario.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @sesiune = Sesiune.new(sesiune_params)\n\n respond_to do |format|\n if @sesiune.save\n\n # duplic temele si domeniile din ultima sesiune si le adaug in baza de date cu sesiune_id asta pe care tocmai am creat-o\n @ultima_sesiune = Sesiune.where(este_deschisa: false).last\n Domeniu.where(sesiune_id: @ultima_sesiune.id).each do |dom|\n nou_dom = Domeniu.create(nume: dom.nume, descriere: dom.descriere, user_id: dom.user_id, sesiune_id: @sesiune.id)\n Tema.where(sesiune_id: @ultima_sesiune.id).where(domeniu_id: dom.id).each do |tema|\n Tema.create(nume: tema.nume, descriere: tema.descriere, domeniu_id: nou_dom.id, este_libera: true, user_id: tema.user_id, sesiune_id: @sesiune.id)\n # ce faci dc user_id-ul temei este un student care a terminat? si th i se desfiinteaza contul?\n end\n end\n\n format.html { redirect_to controlPanel_path, notice: 'Sesiune was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sesiune }\n else\n format.html { render action: 'new' }\n format.json { render json: controlPanel_path.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vaciar\n vaciar_pulmon\n vaciar_recepcion\n end",
"def RepeticionRolCreate(lista_roles, nombre_rol)\n val = true\n lista_roles.each do |rol|\n if rol.descrip_rol == nombre_rol.upcase\n val = false\n break\n end\n end\n return val\n end",
"def create\n @capitol = Capitol.new(capitol_params)\n\n if Licenta.find(@capitol.licenta_id).user_id == get_current_user.id\n respond_to do |format|\n if @capitol.save\n\n # actualizeaza numerele la restul capitolelor de dupa asta nou\n if Capitol.where(\"numar = ?\", \"#{@capitol.numar}\").count > 1\n @capitole = Capitol.where(\"numar >= ? and id != ?\", \"#{@capitol.numar}\", \"#{@capitol.id}\")\n @capitole.each do |cap|\n numar = cap.numar + 1\n cap.update_attributes(numar: numar)\n end\n end\n\n format.html { redirect_to root_path, notice: 'Capitol was successfully created.' }\n format.json { render action: 'show', status: :created, location: @capitol }\n else\n format.html { render action: 'new' }\n format.json { render json: @capitol.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to root_path\n end\n end",
"def check_uniqueness\n if !self.id && Robot.all().any?\n throw(:abort)\n end \n end",
"def revisa_conectado\n unless conectado?\n redirect_to root_path\n end\n end",
"def con_obra?(url)\n # los /obra/new tienen una obra que todavía no existe seteada\n if @obra.try :persisted?\n obra_path(@obra) + url\n else\n url\n end\n end",
"def RepeticionMarcaCreate(lista_tipos, nombre_tipo)\n val = true\n lista_tipos.each do |tipo|\n if tipo.descrip_tipo == nombre_tipo.upcase\n val = false\n break\n end\n end\n return val\n end",
"def create\n @missionario = Missionario.new(params[:missionario])\n return unless access_control\n\n #if @missionario.cargo.nivel < @nivelmin\n # flash[:notice] = 'Cargo não foi alterado.'\n # @missionario.cargo = Cargo.find_by_nivel(5)\n #end\n\n respond_to do |format|\n\n if @missionario.save\n flash[:notice] = \"Missionario criado: #{@missionario.nome_cracha}\"\n coordenacao(params[:missionario][:cargo_id])\n unless @user.missionario\n @user.missionario = @missionario\n @user.save\n redirect_to :controller => :home\n return\n end\n\n format.html { redirect_to(@missionario) }\n format.xml { render :xml => @missionario, :status => :created, :location => @missionario }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @missionario.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def inicio_sesion?\n usuario_id.blank?\n end",
"def validar_pago\n begin\n logger.debug(\"...Inicio validar pago\")\n idtrx = params.require(:idtrx)\n idfactura = params.require(:idfactura)\n result = Hash.new \n result[:idtrx] = idtrx \n result[:validado] = false\n if !idtrx.blank?\n # Se marca la factura como pagadá\n response_inv = InvoicesController.new.pagar_factura(idfactura)\n if response_inv[:status]\n result[:validado] = true\n end\n Spawnling.new do\n ###### Guardamos trx localmente ######\n factura = Factura.where('_id = ?',idfactura).first\n if !factura.blank?\n factura['idtrx'] = idtrx\n factura.save\n end\n ######################################\n\n response_fac = InvoicesController.new.obtener_factura(idfactura)\n if response_fac[:status]\n factura = response_fac[:result]\n if factura\n order_obj = Order.where('_id = ?',factura[0]['oc'].to_s).first\n order_obj.estado = 'pagada'\n order_obj.save\n end\n end \n\n # Se procede a despachar lo establecido en la factura\n mover_despachar(idfactura)\n end\n end\n logger.debug(\"...Fin validar pago\")\n #respond_with result, json: result\n respond_to do |format|\n format.json { render json: result }\n format.html { render json: result }\n end\n rescue => ex\n Applog.debug(ex.message,'validar_pago')\n end\nend",
"def create\n @caracteristica_imovel = CaracteristicaImovel.new(params[:caracteristica_imovel])\n \n descricao_aux = @caracteristica_imovel.descricao.downcase \n descricao_aux = descricao_aux.titleize\n \n @caracteristica_imovel.attributes = {:contador => '0'}\n @caracteristica_imovel.attributes = {:descricao => descricao_aux}\n \n if has_role?(current_user, 'corretor')\n #@imovel_detalhe.attributes = {:ativo => false}\n end\n \n #@caracteristica_imovel.increment!(:contador)\n \n respond_to do |format|\n if @caracteristica_imovel.save\n # Comentado o trecho que direcionava novamente para a tela de cadastro e não a listagem.\n #format.html { redirect_to new_administrativo_caracteristica_imovel_path, notice: 'Característica '+@caracteristica_imovel.descricao+' foi cadastrada com sucesso.' }\n #format.json { render json: @caracteristica_imovel, status: :created, location: new_administrativo_caracteristica_imovel_path }\n format.html { redirect_to administrativo_caracteristica_imovels_path, notice: 'Característica '+@caracteristica_imovel.descricao+' foi cadastrado com sucesso.' }\n format.json { render json: @caracteristica_imovel, status: :created, location: @caracteristica_imovel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @caracteristica_imovel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @producto = Producto.new(params[:producto])\n\n respond_to do |format|\n if @producto.save\n format.html { redirect_to @producto, notice: 'Producto creado.' }\n format.json { render json: @producto, status: :created, location: @producto }\n\n else\n usuarios = Usuario.all #Para coleccion del dueño del producto\n prod = Producto.all\n @marcas = get_marcas(prod)\n @fabricantes = get_fabricantes(prod)\n @companias = []\n for elem in usuarios do\n @companias.push([elem.compania, elem.id])\n end\n\n flash.keep\n format.html { render action: \"new\", alert: 'Producto no pudo ser creado exitosamente.' }\n format.json { render json: @producto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @certificado = Certificado.new(params[:certificado])\n @certificado.participante_id= params[:certificado][:participante_id]\n @inscricao = Inscricao.find(:all, :conditions =>['participante_id =? and curso_id =?', @certificado.participante_id, @certificado.curso_id ])\n w=@inscricao[0].id\n if @inscricao[0].certificado == 1\n render 'ja_emitido'\n else\n respond_to do |format|\n @inscricao[0].certificado = 1\n @inscricao[0].save\n if @certificado.save\n flash[:notice] = 'CERTIFICADO SOLICITADO.'\n format.html { redirect_to(@certificado) }\n format.xml { render :xml => @certificado, :status => :created, :location => @certificado }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @certificado.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def gera_posicao\n r = 0\n i = nil\n while 1\n r = rand(2**30 - 1)\n next if r.zero?\n break unless Eleitor.exists?(r)\n end\n self.numero = r\n end",
"def unsure_no_resources_still_working\n #todo: ver si cambio el estado comparando con el registro en la base de datos (cambio a cancelado o cerrado)\n #todo: si ha cambiado entonces hacer una query pura y dura, lo de abajo no funciona y es confuso, a la mierda, a la vieja usansa\n\n=begin\n users.projects.each do |project|\n if project.project_state.name != 'Cerrado'# || 'Cancelado'\n errors.add_to_base \"La empresa no puede eliminarse por tener recursos trabajando en proyectos en ejecucion\"\n return false\n end\n end\n\n users.each do |hr|\n hr.state_id = 2\n hr.user.state_id = 2\n hr.save\n hr.user.save\n end\n=end\n\n return true\n end",
"def create\n @imovel = Imovel.new(params[:imovel])\n \n @imovel.attributes = {:cadastrado_por_id => current_user.id} \n @imovel.attributes = {:ativo => true}\n \n if has_role?(current_user, 'corretor')\n @imovel.attributes = {:ativo => false}\n end\n \n gerar_codigo_referencia\n \n # arranjo temporario porque não tá cadastrando com nome quando é terreno\n if @imovel.imovel_tipo_id==4\n @imovel.attributes = {:nome => \"TERRENO LOCALIZADO: \"+@imovel.localizacao}\n end\n \n if @imovel.imovel_tipo_id==4\n @imovel.attributes = {:quartos => '0'}\n @imovel.attributes = {:suites => '0'}\n @imovel.attributes = {:vagas => '0'}\n @imovel.attributes = {:imovel_detalhe_ids => []}\n end\n \n respond_to do |format|\n if @imovel.save\n format.html { redirect_to @imovel, notice: 'Imovel foi cadastrado com sucesso.' }\n format.json { render json: @imovel, status: :created, location: @imovel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @imovel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @liga_blaz_blue_general = LigaBlazBlueGeneral.new(params[:liga_blaz_blue_general])\n\n respond_to do |format|\n if LigaBlazBlueGeneral.where(:cuenta => getUsuarioActual.id_cuenta).size==0\n @liga_blaz_blue_general.cuenta=getUsuarioActual.id_cuenta\n @liga_blaz_blue_general.puntos=500\n if @liga_blaz_blue_general.save\n format.html { redirect_to(@liga_blaz_blue_general, :notice => 'Liga blaz blue general was successfully created.') }\n format.xml { render :xml => @liga_blaz_blue_general, :status => :created, :location => @liga_blaz_blue_general }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @liga_blaz_blue_general.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def atributos\n valid = false\n if self.interreps_vencidos.any?\n valid = true\n\n elsif presente_reunioes == true\n valid = true\n end\n\n # elsif Time.now.year - ano_de_fundacao <= 1 \n # valid = true\n # end\n\n valid\n end",
"def ocultar\n @producto = Producto.find(params[:id])\n @logp = Logproducto.new(:usuario_id => current_usuario.id, \n :producto_id => @producto.id,\n :nusuario => current_usuario.nombre, \n :nproducto => @producto.nombre)\n\n x = ocultar_prod(@producto.id)\n if x == 1\n redirect_to @producto, notice: 'Visibilidad cambiada.'\n else\n redirect_to @producto, notice: 'Visibilidad no cambiada.'\n end\n\n end",
"def validar(orden_abono_excedente_arrime, fecha_registro_cheque, numero_cheque)\n logger.debug \"ENTRE A LA VALIDACION EN MI MODELOS ---- \" << orden_abono_excedente_arrime.inspect.to_s\n logger.debug \"ENTRE A LA VALIDACION EN MI MODELOS ---- \" << orden_abono_excedente_arrime_id.inspect.to_s\n \n logger.debug \"Parametros ---- \" << fecha_registro_cheque.to_s << \" - \" << numero_cheque.to_s\n \n msj = \"\"\n\n orden_abono_excedente_arrime = OrdenAbonoExcedenteArrime.find(orden_abono_excedente_arrime_id)\n solicitud = Solicitud.find(orden_abono_excedente_arrime.solicitud_id)\n\n logger.debug \"cheque ---- \" << numero_cheque.to_s\n logger.debug \"fecha ---- \" << fecha_registro_cheque.to_s\n if numero_cheque.to_s==''\n msj << I18n.t('Sistema.Body.Modelos.ViewExcedenteArrime.Errores.numero_cheque_obligatorio',:numero=>solicitud.numero) \n end\n\n if fecha_registro_cheque.to_s==''\n msj << I18n.t('Sistema.Body.Modelos.ViewExcedenteArrime.Errores.fecha_registro_invalida',:numero=>solicitud.numero)\n end\n\n if msj.length > 0\n return msj\n else\n return ''\n end\n end",
"def create\n argumentosRelaciones=especie_params\n argumentosRelaciones.delete(:especies_catalogos_attributes)\n argumentosRelaciones.delete(:especies_regiones_attributes)\n argumentosRelaciones.delete(:nombres_regiones_attributes)\n argumentosRelaciones.delete(:nombres_regiones_bibliografias_attributes)\n @especie = Especie.new(argumentosRelaciones)\n ascendete=Especie.find(argumentosRelaciones[:parent_id])\n @especie.ancestry_ascendente_obligatorio=\"#{ascendete.ancestry_ascendente_obligatorio}/#{ascendete.id}\"\n\n respond_to do |format|\n if @especie.save && params[:commit].eql?('Crear')\n descripcion=\"Creó un nuevo taxón(#{@especie.id}): #{@especie.categoria_taxonomica.nombre_categoria_taxonomica} ✓ #{@especie.nombre_cientifico}\"\n bitacora=Bitacora.new(:descripcion => descripcion, :usuario_id => current_usuario.id)\n bitacora.save\n guardaRelaciones(EspecieCatalogo)\n guardaRelaciones(EspecieRegion)\n format.html { redirect_to @especie, notice: \"El taxón #{@especie.nombre_cientifico} fue creado exitosamente.\" }\n format.json { render action: 'show', status: :created, location: @especie }\n elsif @especie.save && params[:commit].eql?('Crear y seguir editando')\n descripcion=\"Creó un nuevo taxón: #{@especie.categoria_taxonomica.nombre_categoria_taxonomica} ✓ #{@especie.nombre_cientifico}\"\n bitacora=Bitacora.new(:descripcion => descripcion, :usuario_id => current_usuario.id)\n bitacora.save\n guardaRelaciones(EspecieCatalogo)\n guardaRelaciones(EspecieRegion)\n format.html { redirect_to \"/especies/#{@especie.id}/edit\", notice: \"El taxón #{@especie.nombre_cientifico} fue creado exitosamente.\" }\n else\n format.html { render action: 'new' }\n format.json { render json: @especie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n logger.debug(\"Creando calabaza aa #{params[:deuda][:deuda_original_id]} #{params}\")\n @deuda = Deuda.new(params[:deuda])\n if(params[:deuda].has_key?(:deuda_original_id))\n logger.debug(\"Se slecciono deuda original\")\n if(@deuda.credito.present?)\n logger.debug(\"Estaba asociado con un credito\")\n @deuda.credito.deudas.delete(@deuda)\n end\n @deuda.credito_id=nil\n end\n\n respond_to do |format|\n if @deuda.save\n format.html { redirect_to @deuda, notice: 'Deuda was successfully created.' }\n format.json { render json: @deuda, status: :created, location: @deuda }\n else\n format.html { render action: \"new\" }\n format.json { render json: @deuda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def iniciarBodega\n Cliente.destroy_all\n #1. Crear clientes\n if(Cliente.all.count==0)\n clientesIniciar\n end\n #2. Crear Bodega\n ib = Bodega.iniciarBodega(true) #True porque se inicia\n \n #3. Mandar a producir Stock si es Bajo\n ProducirMateriasPrimas.new.producirStockBajo\n render json: \"Iniciada\"\nend",
"def zuruecksetzen()\n end",
"def create\n\n if !params[:disponibilite][:creneau_ids].nil?\n\n Disponibilite.where(enseignant_id: params[:disponibilite][:enseignant_id]).where(jour_id: params[:disponibilite][:jour_id]).where(ecole_id: ecole.id).destroy_all\n\n params[:disponibilite][:creneau_ids].each do |creneau|\n Disponibilite.create(enseignant_id: params[:disponibilite][:enseignant_id], jour_id: params[:disponibilite][:jour_id], user_id: current_user.id, ecole_id: ecole.id, creneau_id: creneau)\n end\n redirect_to disponibilites_url\n #@disponibilite = current_user.disponibilites.new(disponibilite_params)\n else\n redirect_to new_disponibilite_path, notice: \"Veuillez choisir des heures pour la disponibilité du prof\"\n end\n\n end",
"def imprimir_todo\n\n # aqui guardo todos los datos que necesito para imprimirlos en las variable\n\n @width_layout = '955'\n @form_title = ''\n @imprimo='1'\n \n #@ordenes_de_despacho_aux=OrdenDespachoDetalle.find(:all, :conditions=>\"id in #{params[:ordenes_despachos_id]}\")\n\n\n @factura_orden_despacho_otra= FacturaOrdenDespacho.find(:all, :conditions=>\"orden_despacho_detalle_id in #{params[:parciales_id]} and secuencia='#{params[:secuencia]}' and monto_factura>0\")\n\n factura_orden_despacho_count=FacturaOrdenDespacho.count(:all, :conditions=>\"orden_despacho_detalle_id in #{params[:parciales_id]} and secuencia='#{params[:secuencia]}' and monto_factura>0\")\n\n@factura_orden_despacho=FacturaOrdenDespacho.find(:first, :conditions=>\"orden_despacho_detalle_id in #{params[:parciales_id]} and secuencia='#{params[:secuencia]}' and monto_factura>0\")\n\n\nsolicitu=OrdenDespacho.find(OrdenDespachoDetalle.find(@factura_orden_despacho.orden_despacho_detalle_id).orden_despacho_id).solicitud_id\n\n@solicitudes = Solicitud.find(:all,:conditions => ['id = ?', solicitu])\n\n unless @solicitudes[0].nil?\n if !@solicitudes[0].cliente.persona_id.nil?\n \n\t@es_no=1\n\t@datos_cliente=Persona.find(@solicitudes[0].cliente.persona_id) unless @solicitudes[0].nil?\n else\n\t@es_no=2\n\t@datos_cliente=Empresa.find(@solicitudes[0].cliente.empresa_id) unless @solicitudes[0].nil?\n end\n end\n@numero_desembolso=OrdenDespachoDetalle.find(@factura_orden_despacho.orden_despacho_detalle_id).orden_despacho_id\n\n@orden_despacho= OrdenDespacho.find(:all,:conditions => ['id = ?', @numero_desembolso])\n\n\n@oficina= Oficina.find(:all,:conditions => ['id = ?', @solicitudes[0].oficina_id]) unless @solicitudes[0].nil?\n\n\n@parametros_general=ParametroGeneral.find(:first)\n\n @condition = \" orden_despacho_id = #{@factura_orden_despacho.orden_despacho_detalle.orden_despacho_id} and cantidad > 0\"\n\n @total = OrdenDespachoDetalle.count(:conditions=>@condition)\n @list = OrdenDespachoDetalle.find(:all, :conditions => ['orden_despacho_id = ? and cantidad > 0', @factura_orden_despacho.orden_despacho_detalle.orden_despacho_id])\n\n\t@total_saldo_entregar=0\n\t@total_precio_total=0\n\tcont=0\n diferencia=0.00\n @total_monto_confirmado=0.00\n\twhile cont< @total\n #if OrdenDespacho.find(@numero_desembolso).estatus_id==20000 || OrdenDespacho.find(@numero_desembolso).estatus_id==20010 || OrdenDespacho.find(@numero_desembolso).estatus_id==20020\n\t \n # codigo nuevo al 3/9/2013 \n if ( ((@list[cont].cantidad * @list[cont].costo_real)!=@list[cont].monto_financiamiento) and (@list[cont].monto_recomendado!=0))\n \n @total_saldo_entregar+=@list[cont].monto_recomendado\n diferencia=@list[cont].monto_recomendado - @list[cont].monto_facturacion \n \n else\n \n @total_saldo_entregar+=@list[cont].monto_financiamiento\n diferencia=@list[cont].monto_financiamiento - @list[cont].monto_facturacion\n end\n #codigo nuevo al 3/9/2013 \n \n \n #else\n\t #@total_saldo_entregar+=@list[cont].monto_recomendado\n #diferencia=@list[cont].monto_recomendado - @list[cont].monto_facturacion\n #end\n\n @total_monto_confirmado+=@list[cont].monto_facturacion\n\n logger.debug \"monto financiamiento = \" << @list[cont].monto_financiamiento.to_s\n logger.debug \"monto facturacion = \" << @list[cont].monto_facturacion.to_s\n logger.debug \"diferencia = \" << diferencia.to_s\n if diferencia < 0\n diferencia=diferencia * -1 \n\n end\n \n\t@total_precio_total+=diferencia\n\n #@total_precio_total+=@list[cont].monto_facturacion\n\tcont+=1\t\n\tend\n\n\n@marca=params[:marca]\n\n#@vista = 'view_factura_orden_despacho_parciales'\n\n end",
"def create\n respond_to do |format|\n aux= params[:item_pautum][:questao_id]\n if aux.size > 1\n for x in aux\n if x == \"\"\n break#a ultima posição do array e um \"\" e isso não é um id por tanto da erro entao esse if resolve isso\n end\n\n @questao=Questao.find(x) #aqui eupego a pessoa com o id q ta no x\n @item_pautum = ItemPautum.new(item_pautum_params)\n @pautum = Pautum.find(@item_pautum.pautum) \n if ItemPautum.search(@questao.id, @pautum.id) == [] #com esse if eu evito que se convoque a mesma pessoa 2 vezes\n @item_pautum.questao=@questao# passo o objeto questao para item pauta\n @item_pautum.pautum=@pautum# passo o objeto pauta para item pauta\n if Ponto.buscarPonto(@item_pautum.questao.id).size >=1\n @item_pautum.save\n end\n end\n end\n\n format.html { redirect_to @pautum, notice: 'Questões alocadas com sucesso.' }\n format.json { render :show, status: :created, location: @pautum }\n else\n\n\n format.html { redirect_to pautum_path(@item_pautum.pautum), notice: 'Desculpe mas,você não selecionou as questões.' }\n end\n end\n end",
"def create\n @autobus = Autobus.new(autobus_params)\n respond_to do |format|\n @autobus.is_taken = false\n if @autobus.save\n format.html { redirect_to @autobus, notice: 'Autobus creado exitosamente.' }\n format.json { render action: 'show', status: :created, location: @autobus }\n\n 1.upto(@autobus.capacidad.to_i) { |n| \n @asiento = Asiento.new\n @asiento.is_active = true\n @asiento.asiento_no = n\n @asiento.autobus_id = @autobus.id\n if (n < @autobus.capacidad.to_i/2)\n @asiento.tipo = 'V'\n else\n @asiento.tipo = 'P'\n end\n @asiento.save\n }\n else\n format.html { render action: 'new' }\n format.json { render json: @autobus.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6444827",
"0.63993233",
"0.6339595",
"0.6336596",
"0.6326339",
"0.6259272",
"0.6151846",
"0.614463",
"0.6140908",
"0.61345065",
"0.6113508",
"0.60907173",
"0.6078508",
"0.60778344",
"0.6067026",
"0.6048962",
"0.6033119",
"0.6001856",
"0.5981397",
"0.5965884",
"0.5959202",
"0.59478295",
"0.5945633",
"0.59293365",
"0.5909811",
"0.5901031",
"0.58979666",
"0.5895627",
"0.5891955",
"0.58705175",
"0.58651346",
"0.5864006",
"0.586301",
"0.5848241",
"0.5846688",
"0.5843691",
"0.58348703",
"0.58058846",
"0.58029544",
"0.5801282",
"0.5795017",
"0.5791472",
"0.5790999",
"0.5774799",
"0.577435",
"0.57638055",
"0.57620347",
"0.5751304",
"0.57512254",
"0.5747073",
"0.5740417",
"0.57395935",
"0.573281",
"0.5732753",
"0.5730392",
"0.5720141",
"0.57091874",
"0.56965214",
"0.5695837",
"0.56925094",
"0.56903607",
"0.56892025",
"0.5687371",
"0.5686712",
"0.56798303",
"0.56761086",
"0.56739736",
"0.5670911",
"0.56666714",
"0.5659474",
"0.56561595",
"0.5655236",
"0.5648799",
"0.56455994",
"0.5643981",
"0.5640069",
"0.56393737",
"0.5637542",
"0.5637322",
"0.56350756",
"0.5627065",
"0.56252897",
"0.56249166",
"0.5622993",
"0.5622271",
"0.56200683",
"0.5618566",
"0.561766",
"0.56169677",
"0.5612143",
"0.56116104",
"0.5606626",
"0.56063765",
"0.5605922",
"0.5605544",
"0.56027156",
"0.55974483",
"0.55771446",
"0.55736995",
"0.557126",
"0.55695784"
] |
0.0
|
-1
|
Sample names Get sample names containing a substring
|
def get_sample_names(substring)
inputs = Dir.glob("inputs/#{$jobid}/*.txt")
inputs = inputs.select {|x| x.include? substring}
inputs = inputs.map{|x| File.basename(x).sub(".txt", "")}
return inputs
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_sample_names(substring)\n inputs = Dir.glob(\"inputs/#{$jobid}/*.txt\").select {|x| x.include? substring}\n inputs = inputs.map{|x| File.basename(x).sub(\".txt\", \"\")}\n return inputs\nend",
"def get_sample_names(substring)\n inputs = Dir.glob(\"inputs/#{$jobid}/*.txt\").select {|x| x.include? substring}\n inputs = inputs.map{|x| File.basename(x).sub(\".txt\", \"\")}\n return inputs\nend",
"def get_sample_names(substring)\n inputs = Dir.glob(\"inputs/#{$jobid}/*.txt\").select {|x| x.include? substring}\n inputs = inputs.map{|x| File.basename(x).sub(\".txt\", \"\")}\n return inputs\nend",
"def get_sample_names(substring)\n inputs = Dir.glob(\"inputs/#{$jobid}/*.txt\").select {|x| x.include? substring}\n inputs = inputs.map{|x| File.basename(x).sub(\".txt\", \"\")}\n return inputs\nend",
"def get_sample_names(substring)\n inputs = Dir.glob(\"inputs/#{$jobid}/*.txt\").select {|x| x.include? substring}\n inputs = inputs.map{|x| File.basename(x).sub(\".txt\", \"\")}\n return inputs\nend",
"def get_sample_names(substring)\n inputs = Dir.glob(\"inputs/#{$jobid}/*.txt\").select {|x| x.include? substring}\n inputs = inputs.map{|x| File.basename(x).sub(\".txt\", \"\")}\n #puts substring\n #puts inputs\n #puts $jobid\n return inputs\nend",
"def possible_sample_name(filename)\n\t\tfilename.split('/').last.split('.').first\n\tend",
"def possible_sample_name(filename)\n filename.split('/').last.split('.').first\n end",
"def find_by_starts_with(name)\n return nil unless name.present?\n names.select {|e| e.starts_with?(name)}\n end",
"def craft_names(rand_words, snippet, pattern, caps = false)\n\tnames = snippet.scan(pattern).map do\n\t\tword = rand_words.pop()\n\t\tcaps ? word.capitalize : word\n\tend\n\t\n\treturn names * 2\t\nend",
"def sample_names(separator = ':')\n libraries.collect(&:request).collect(&:sample_name).join(separator)\n end",
"def articlePartialMatchNames\n names = []\n if partial_name_match #If partial name matches are allowed for this place\n #Add any words required for a match before each trimmed name\n if before_name_article_accept_strings.length != 0\n\ttrimmed_names.uniq.each do |name|\n\t before_name_article_accept_strings.each do |string|\n\t names << string + \" \" + name\n\t end\n\tend\n else\n\tnames += trimmed_names\n end\n end\n names\n end",
"def sample_names(separator = ':')\n request_libraries.collect(&:request).collect(&:sample_name).join(separator)\n end",
"def prefix\n fetch_sample(PREFIXES)\n end",
"def craft_names(rand_words, snippet, pattern, caps=false) # caps defaults to false\n names = snippet.scan(pattern).map do\n word = rand_words.pop()\n caps ? word.capitalize : word\n end\n\n return names * 2 # return the names variable twice as an array\nend",
"def name(names)\n names.sample\nend",
"def parseSampleName(output)\n if output.match(/Sample=\\S+/)\n temp = output.gsub(/Sample=/,\"\")\n temp.strip!\n if !temp.match(/^[Nn]one/)\n @sample = temp.to_s\n else\n @sample = nil\n end\n end\n end",
"def extract_name_by_multi_name\n name = ''\n names_arr = []\n @text.scan(/(Family|FAMILY|family|First|first|FIRST|Given|GIVEN|given|LAST|Last|last){1}[\\s|\\W]{0,}(name|Name|NAME){1}([\\:|\\s|\\,|\\W]{1,})+([A-Z]{1}[A-Za-z]+)/) do | track |\n names_arr << track\n end \n if names_arr.size == 2\n name = names_arr[0][-1] + names_arr[1][-1]\n end\n return name \n end",
"def partial_matches_for(input_string)\n # [\"aardvark\", \"apple\"]\n @word_list.select do |word|\n word.start_with?(input_string)\n end\n end",
"def search_names(logins)\n logins.select { |x| x[0].end_with?(\"_\")}\nend",
"def sample_names\n material.sample.name\n end",
"def extract_names(content)\n names = []\n \n # Split content into words.\n words = content.split(/[^-_a-z0-9]+/i).select {|v| v.index(/^[-a-z]+$/i)}\n \n # Loop over each bigram and check if the words are title cased and if at\n # least one of the words is a first or last name.\n words.each_with_index do |first_name, index|\n surname = full_surname = words[index+1] || ''\n \n # Skip to the next word if we have a couple of the next words.\n if ['van', 'von'].index(surname)\n surname = words[index+2] || ''\n full_surname = \"#{full_surname} #{surname}\"\n end\n \n # Only look at two words that are titlecase and neither one is a stopword.\n next if !first_name.titlecase? || !surname.titlecase?\n next if !stopwords.index(first_name.upcase).nil? || !stopwords.index(surname.upcase).nil?\n \n # Check if either the first name or last name is a recognized common name.\n if Matlock::Data.first_name?(first_name) || Matlock::Data.surname?(surname)\n full_name = \"#{first_name} #{full_surname}\"\n names << full_name if names.index(full_name).nil?\n end\n end\n \n return names\n end",
"def craft_names(rand_words, snippet, pattern, caps=false)\n names = snippet.scan(pattern).map do\n word = rand_words.pop()\n caps ? word.capitalize : word\n end\n# unsure as to why 2 names are returned\n return names * 2\nend",
"def full_names(names = [])\n names.select { |name| name.match /\\w\\s\\w/ }\nend",
"def suffix\n fetch_sample(SUFFIXES)\n end",
"def craft_names(rand_words, snippet, pattern, caps=false)\nnames = snippet.scan(pattern).map do\n word = rand_words.pop()\n caps ? word.capitalize : word\nend\n\nreturn names * 2\nend",
"def filter_students_by_initial(initial, student_names)\n student_name_array = extract_name(student_names)\n return (student_name_array.select{ |student_name| student_name[0] == initial.to_s.capitalize})\nend",
"def named_t\n array = [\"Taylor\", \"Francis\", \"Bella\", \"Tori\", \"Jay\"]\n array.select do |name|\n name.start_with?(\"T\")\n end\nend",
"def get_sample_name_matches(operation_map, output_item_id)\n sn = Item.find(output_item_id).sample&.name\n operation_map.item_inputs.select { |i| i.sample&.name == sn }\n end",
"def full_names\n names = raw_names\n if match_names\n names += match_names.downcase.split(%r{,\\s*})\n end\n names\n end",
"def extract_name_from_text(text); end",
"def getSampleName()\n return @sample\n end",
"def starting_with(partial_name)\n all.select { |o| o.fullname.start_with?(partial_name) }\n end",
"def starts_with(prefix)\n extract.grep(/^#{prefix}/)\n end",
"def first_name(for_sex = :random)\n fetch_sample(FIRST_NAMES[select_sex(for_sex)])\n end",
"def first_name(for_sex = :random)\n fetch_sample(FIRST_NAMES[select_sex(for_sex)])\n end",
"def students_by_first_letter(students, x)\n @students.each do |student|\n puts \"#{student[:name]} (#{student[:cohort]} cohort)\".center(100) if student[:name].start_with?(x)\n end\nend",
"def last_name(for_sex = :random)\n fetch_sample(LAST_NAMES[select_sex(for_sex)])\n end",
"def last_name(for_sex = :random)\n fetch_sample(LAST_NAMES[select_sex(for_sex)])\n end",
"def run_name_from_path(full_path)\n path = path_parse(full_path)\n bc = \"\"\n if path.bc.upcase.match(/BC/)\n bc = \"_\" + path.bc\n end\n return path.rname + \"_\" + path.sample + bc\n end",
"def get_a_name\n @names.sample.tap { |n| @names.delete n }\n end",
"def catch_phrase\n translate('faker.company.buzzwords').collect { |list| sample(list) }.join(' ')\n end",
"def town_names(amount,location)\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 near_water=['falls','-on-sea']\n mountain=['Mount ', 'The hills of ']\n names=[]\n\n amount.times do\n if location == 'near_water'\n names.push(starts.sample+middles.sample+ends.sample+near_water.sample)\n elsif location == 'mountain'\n names.push(mountain.sample+starts.sample+middles.sample+ends.sample)\n elsif location == 'short_name'\n names.push(starts.sample+ends.sample)\n else\n names.push(starts.sample+middles.sample+ends.sample)\n end\n end\n return names\nend",
"def find(substring)\n first_letter, second_letter, *last_letters = *substring.chars\n return [] unless @root.path?(last_letters.reverse)\n\n @root.follow_path(last_letters.reverse).final_paths.select do |path|\n path.start_with?([second_letter, first_letter])\n end.map do |path|\n Path.new(last_letters.reverse + path).to_word.to_s\n end.uniq\n end",
"def get_first_name\r\n @first_names.sample\r\n end",
"def catch_phrase\n translate('faker.company.buzzwords').collect {|list| list.sample }.join(' ')\n end",
"def find_test_name( filename )\n check = /^[^\\.+$]\\w+_(of.*)\\..*/.match( filename )\n return check[ 1 ].to_s if check\n return \"\"\nend",
"def find_by_name(entry)\n names = []\n self.all.each do |item|\n if item.name.downcase.include? entry\n names << item \n end\n end\n names\n end",
"def test_participant_names\n\t\tnames = []\n\t\tfile.each_with_pagename do |name, sheet|\n\t\t\tnext if name =~/Totaal/\n\n\t\t\t\tpart = sheet.cell(3,3) || \"\"\n\t\t\t\tif part.blank?\n\t\t\t\t\tbyebug\n\t\t\t\telse\n\t\t\t\t\tpart = part.strip.downcase\n\t\t\t\t\tnames.push part\n\n\t\t\t\tend\n\n\t\tend\t\n\n\t\tnames.map{|x| x.strip.downcase}.uniq.sort\t\n\tend",
"def extract_full_names(s)\n\ts = \" \".concat(s).concat(\" \")\n\t#puts \"###############################################\"\n\t#puts s\n\tlist = s.scan(/\\s'?\"?\\w+,?\\s\\w+[,']?\\.?\\s?\\w*\\s?&?\\s?\\w*\"?'?\\s/)\n\t#puts \"=>\", list\n\tlist.map! do |name| \n\t\ttmp = name.sub(/^\\s*/, \"\").sub(/\\s*$/, \"\").sub(/<.+>/, \"\").sub(/,$/, \"\").delete(\"\\\"\\'\\.\")\n\t\tif tmp.include?(\",\") and !tmp.include?(\"&\")then\n\t\t\tl = tmp.split(\",\")\n\t\t\tl[1].sub!(/^\\s*/, \"\")\n\t\t\t#assert(l.length == 2, \"fails at #{tmp} out of #{s}\")\n\t\t\tif (l.length != 2) then\n\t\t\t\ttmp = \"\"\n\t\t\telse\n\t\t\t\ttmp = l[1].concat(\" \").concat(l[0])\n\t\t\tend\n\t\tend\n\t\ttmp\n\tend\n\tlist\nend",
"def last_name\n range = [*'a'..'z']\n \"#{Helpers::FakeIt.last_name}#{Array.new(5) { range.sample }.join}\"\n end",
"def one_word_names(list)\n own = list.select do |c|\n c[:name].include?(\" \") == false\n end\n return own\nend",
"def siteName(sample)\n s = sample\n s = s.gsub(\"GS0\",\"GS\")\n s = s.gsub(\"GS-\",\"GS\")\n s = s.gsub(\"GOS\", \"GS\")\n s = s.gsub(/^0[0-9]+-/,\"\")\n s = s.gsub(\"IOSM\",\"\")\n s = s.gsub(\"IOLG\",\"\") \n s = s.gsub(\"IOVIR\",\"\")\n s = s.gsub(\"XLRVAL\",\"\")\n s = s.gsub(\"viral\",\"\")\n s = s.gsub(\"LG\",\"\") \n return s.split(\"-\").first\nend",
"def match_rawname(name, rawlist)\n rawlist.each { |r| return r if name == r }\n rawlist.each { |r| return r if name.downcase == r.downcase }\n may = rawlist.find_all { |r| r.downcase.index(name.downcase) }\n may.first if may.length == 1\n end",
"def match_rawname(name, rawlist)\n rawlist.each { |r| return r if name == r }\n rawlist.each { |r| return r if name.downcase == r.downcase }\n may = rawlist.find_all { |r| r.downcase.index(name.downcase) }\n may.first if may.length == 1\n end",
"def name_parts(namething, count)\n parts = namething.split(\" \")\n first_name_count = parts.count - count\n return nil if count < 1\n { given: parts.first(first_name_count).join(\" \"), family: parts.last(count).join(\" \") }\n end",
"def substrings(string)\r\n \r\nend",
"def name_search(search)\n words = search.split(' ')\n results = where(\"UPPER(name) LIKE ?\", \"%#{words[0]}%\")\n for i in 1...words.size\n results = results.where(\"UPPER(name) LIKE ?\", \"%#{words[i]}%\")\n end\n return results\n end",
"def matching_a_string_starting_with_hello\n /WRITE ME/\n end",
"def custom_includee(string, substring)\n string.split(substring).length != 1\nend",
"def subwords(word, dictionary)\n arr = substrings(word)\n arr.select { |str| dictionary.include?(str) }\nend",
"def substrings(string)\n\nend",
"def member_names(members)\n members.times do \n @band << @musicians.sample\n end\n\n puts \"Cool, that means the lineup will include:\"\n @band.each do |musician|\n puts \"#{musician}\"\n end\n\n end",
"def all_name_strings\n names.collect { |a| a.name }\n end",
"def articleFullyQualifiedMatchNames\n #Add raw_names and article_match strings first\n names = []\n #Add any words required for a match before each name\n if before_name_article_accept_strings.length != 0\n raw_names.each do |name|\n\tbefore_name_article_accept_strings.each do |string|\n\t names << string + \" \" + name\n\tend\n end\n else\n names = raw_names\n end\n\n #Add additional article matches to the list\n if(!match_names.nil?)\n names += match_names.downcase.split(%r{,\\s*})\n end\n names\n end",
"def sample(*names)\n File.read(sample_path(*names))\nend",
"def print_names_begins_with(letter)\n name_begin_with = @students.select {|student| student[:name].start_with?(letter, letter.upcase)}\n if name_begin_with.empty?\n puts \"-There are no students whose names begin with an 'A'\"\n else\n print_names(name_begin_with)\n end\nend",
"def my_pets_name(a)\n a.each do |name|\n if name[0] == \"S\" \n puts \"My name starts with an S for super!\"\n else\n puts \"I'm still pretty special too!\"\n end\n end\nend",
"def service_name_variations(name)\n name = name.to_s\n variations = []\n variations << name\n if name.start_with? 'p_'\n variations << name.gsub(/^p_/, '')\n else\n variations << \"p_#{name}\"\n end\n\n simple_name = name.gsub(/^(ms-)|(clone-)/, '')\n unless simple_name == name\n variations << simple_name\n if simple_name.start_with? 'p_'\n variations << simple_name.gsub(/^p_/, '')\n else\n variations << \"p_#{simple_name}\"\n end\n end\n variations\n end",
"def expand_name_wide(names, pattern)\n re1 = /\\A#{Regexp.quote(pattern)}/i\n names.grep(re1)\n end",
"def generate_identifier(sample)\n # Here, I will include every 'location adjective' and 'discovery' beginning with a vowel. These must all be preceeded by 'an'.\n if [\"alternative-timeline\", \"alternate-history\", \"ancient\", \"anachronistic\", \"arcane prophecy\", \"alien artifact\", \"enchanted sword\", \"otherworldly portal\", \"encrypted data feed\", \"exiled angel\"].include?(sample)\n \"an\"\n else\n \"a\"\n end\nend",
"def term_to_name_string(term)\n self.search_string ? sstring = self.search_string : sstring = terms[term]\n if not sstring.blank?\n names = sstring.split(/, +|[,\\^\\- ]/).collect do |e|\n Regexp.escape(e)\n end\n names.uniq\n else\n []\n end\n end",
"def greet2(name)\n hi = [\"Hello\", \"Hi\", \"Ohai\", \"ZOMG\"]\n \"#{hi.sample} #{name}!\"\nend",
"def uniq_abbrev(list, name)\n candidates = list.select do |try_name|\n try_name.start_with?(name)\n end\n candidates.size == 1 ? candidates.first : name\n end",
"def related_names_in_use\n @in_use.map { |n| /\\A#{normalised_name}_(\\d+)\\z/.match(n) }.compact\n end",
"def create_match(nominee)\n names = []\n pname = nominee[:name]\n names << pname\n names << pname.sub(%r{ [A-Z]\\. }, ' ') # drop initial\n personname = ASF::Person.find(nominee[:id]).public_name\n names << personname if personname\n list = names.uniq.map{|name| Regexp.escape(name)}.join('|')\n # N.B. \\b does not match if it follows ')', so won't match John (Fred)\n # TODO: Work-round is to also look for EOS, but this needs to be improved\n %r{\\b(#{list})(\\b|$)}i\nend",
"def custom_start_with?(string, substring)\n array_of_strings = string.split(\" \")\n array_of_strings.first == substring ? true : false\nend",
"def names name = \"\"\n find_all_by_name( name ).map(&:name)\n end",
"def spec_letter(array, char)\n # select through the array\n array.select do |str|\n # using include to find the substrings\n # if str has specific letter\n str.include? char\n end\nend",
"def find_subgenre(subgenres, subgenre_titles, description) \n description.downcase!\n subgenres.each_with_index do |subgenre, index|\n subgenre.each do |word|\n if description.include?(word)\n return subgenre_titles[index]\n end\n end\n end\n return \"other\"\n end",
"def split_out_matches(list, substring)\n matches = list.select do |loc|\n (loc.name.to_s[0,substring.length] == substring)\n end\n if matches.empty?\n nil\n else\n [matches, list - matches]\n end\n end",
"def find_partial_name(file_path)\n return name = file_path.split('/').last.to_sym;\n end",
"def get_word\n words = File.readlines(\"lib/5desk.txt\")\n words.each { |word| word.chomp! }\n words_list = words.select { |word| word.length.between?(5, 12)}\n\n words_list.sample.downcase.split(\"\")\n end",
"def cases(test_name)\n test_name\n .split('__')\n .map { |group| group.split('_') }\n .select { |elements| elements.all? { |case_id| case_id =~ /C\\d+/i } }\n .flatten\n .map { |case_id| case_id[1..-1] }\n end",
"def name_with_middle; end",
"def name_filter(results, search)\n words = search.split(' ')\n for i in 0...words.size\n results = results.where(\"UPPER(name) LIKE ?\", \"%#{words[i]}%\")\n end\n return results\n end",
"def sample_text(name)\n File.read(File.expand_path(\"samples/#{name}\", __dir__))\nend",
"def prefix\n (\"aa\"..\"zz\").to_a.sample(2).to_s\n end",
"def name\n @example.description.scan(/\\((\\w+)\\)/).flatten.first\n rescue\n @example.description\n end",
"def myfind (str)\n if str.match(/^[[:graph:]]+$/)\n Provider.where(\"lower(name) like ?\", \"%#{str}%\")\n end\n end",
"def substring_test(st1, st2)\n subs_st1 = []\n subs_st2 = []\n sub_length = 2\n\n loop do\n st1.downcase.chars.each_cons(sub_length) { |cons| subs_st1 << cons }\n sub_length += 1\n break if sub_length > st1.size\n end\n\n sub_length = 2\n\n loop do\n st2.downcase.chars.each_cons(sub_length) { |cons| subs_st2 << cons }\n sub_length += 1\n break if sub_length > st2.size\n end\n\n subs_st1.any? { |substr| subs_st2.include?(substr) }\nend",
"def search_firstname(input)\n \n search_name = input.downcase\n lower = 0\n upper = entries.length - 1\n \n while lower<= upper\n mid = (upper+lower)/2\n mid_name_array = entries[mid].name.split(' ').map! { |el| el.downcase }\n \n if search_name == mid_name_array[0]\n return entries[mid]\n elsif search_name < mid_name_array[0]\n upper = mid - 1\n elsif search_name > mid_name_array[0]\n lower = mid + 1\n end\n end\n return nil\n end",
"def listing_name(text)\n\t\t\tar = text.split(', ')\n\t\t\tlastname = ar[0]\n\t\t\tfirstpart = ar[1]\n\t\t\tinitials = firstpart.gsub(/([[:upper:]])[a-zé]+/, '\\1.')\n\t\t\tinitials + ' ' + lastname\n\t\tend",
"def insured_name\n id, qual = eob.member_id_and_qualifier\n sub_name_ele = []\n sub_name_ele << 'NM1'\n sub_name_ele << 'IL'\n sub_name_ele << '1'\n sub_name_ele << eob.subscriber_last_name\n sub_name_ele << eob.subscriber_first_name\n sub_name_ele << eob.subscriber_middle_initial\n sub_name_ele << ''\n sub_name_ele << eob.subscriber_suffix\n sub_name_ele << qual\n sub_name_ele << id\n sub_name_ele = Output835.trim_segment(sub_name_ele)\n sub_name_ele.join(@element_seperator)\n end",
"def starring(whazzername)\n # Find the movies with an actor who had a name like `whazzername`.\n # A name is like whazzername if the actor's name contains all of the\n # letters in whazzername, ignoring case, in order.\n\n # ex. \"Sylvester Stallone\" is like \"sylvester\" and \"lester stone\" but\n # not like \"stallone sylvester\" or \"zylvester ztallone\"\n\nend",
"def town_names(i=3)\nstarts = Array['Bed','Brunn','Dun','Far','Glen','Tarn']\nmiddles = Array['ding','fling','ly','ston']\nends = Array['bourough','burg','ditch','hall','pool','ville','way','worth']\n\nfinished_town_names = []\n\n\n (0...i).each do |element|\n finished_town_names[element] = starts.sample + middles.sample + ends.sample\n end\n\n return finished_town_names\n\nend",
"def print_specific_lttr student_arr\n\tputs \"Please enter a letter to display all students whose name begins with that letter\"\n\tchoice = gets.chomp.upcase\n\tstudent_arr.each do |student|\n\t\tif student[:name].chars.first == choice\n\t\t\tputs \"#{student[:name]} (#{student[:cohort]} cohort)\"\n\t\tend\n\tend\nend",
"def recipe_name_search\n key_word = User.prompt.ask(\"Please piece of recipe name\")\n key_word == nil ? (key_word = 'bdncjkascndxasklxnasmndxb') : (key_word)\n recipe_query = Recipe.all.filter{|recipe| recipe.name.include?(key_word.capitalize())}\n\n if recipe_query != []\n recipe_viewer(recipe_query)\n else\n puts 'Invalid Search!'.colorize(:red);\n end\n end",
"def search_by_name(name)\n name = name.capitalize\n result_name = []\n @name_list.each_value do |element|\n if element.include? name\n result_name.push(element)\n end\n end\n if result_name.empty?\n puts \"Nobody has name is #{name}\"\n else\n puts \"\\nList member of #{name} keyword\"\n result_name.each do |element|\n index = @name_list.values.index(element)\n show_profile(index, @name_list, @dob_list)\n end\n puts \"\\n\"\n end\n end",
"def bank_name_via_custom_sublet(code)\n custom_sublet_data.each do |prefix, value|\n if prefix == code[0..prefix.length - 1]\n if value.length == 4\n return bank_name_data[value]\n else\n return value\n end\n end\n end\n return nil\n end"
] |
[
"0.7544055",
"0.7544055",
"0.7544055",
"0.7544055",
"0.7541987",
"0.7073276",
"0.6378959",
"0.6314352",
"0.6258772",
"0.6256963",
"0.6181172",
"0.6140425",
"0.60791445",
"0.6078461",
"0.6075472",
"0.60706043",
"0.6051366",
"0.58784837",
"0.5877926",
"0.5872074",
"0.58698726",
"0.5865676",
"0.5839899",
"0.58268607",
"0.5812277",
"0.58066314",
"0.5778968",
"0.57588315",
"0.57366234",
"0.57189834",
"0.5655505",
"0.5587582",
"0.5583544",
"0.5556298",
"0.55316275",
"0.55316275",
"0.5531151",
"0.5526902",
"0.5526902",
"0.5492679",
"0.5487273",
"0.54726523",
"0.54581386",
"0.5457911",
"0.5419368",
"0.54175293",
"0.5408911",
"0.54021853",
"0.5397952",
"0.5397918",
"0.5397239",
"0.5394759",
"0.53918916",
"0.5386525",
"0.5386525",
"0.5360261",
"0.535741",
"0.5355524",
"0.5352301",
"0.53326726",
"0.53284574",
"0.5323252",
"0.5315672",
"0.53001285",
"0.5296978",
"0.52912796",
"0.5287578",
"0.5286599",
"0.5285672",
"0.52515835",
"0.5245834",
"0.5244398",
"0.5238515",
"0.5238033",
"0.52310014",
"0.522883",
"0.5214377",
"0.5211895",
"0.52101654",
"0.5180516",
"0.5173034",
"0.5166676",
"0.5163804",
"0.5161935",
"0.5151749",
"0.5147803",
"0.51452965",
"0.51398385",
"0.51296574",
"0.5127011",
"0.51173764",
"0.5092515",
"0.5091986",
"0.5084079",
"0.5083987",
"0.5070164",
"0.5070147",
"0.5066697",
"0.5065795",
"0.5065142"
] |
0.76673555
|
0
|
Function to get the .root files for an analyzer and samples
|
def get_analyzer_results(analyzer, the_samples)
output = Array.new
analyzer_base = analyzer.sub('.py', '')
the_samples.each do |sample|
output << "results/#{$jobid}/#{analyzer_base}/#{sample}.root"
end
return output
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_analyzer_results(analyzer, the_samples)\n output = Array.new\n analyzer_base = analyzer.sub('.py', '')\n puts the_samples\n puts analyzer\n the_samples.each do |sample|\n output << \"results/#{$jobid}/#{$selection}#{$jetcorrection}/iso#{$isolation}/#{analyzer_base}/#{sample}.root\"\n #output << \"results/#{$jobid}/#{analyzer_base}/#{sample}.root\"\n end\n return output\nend",
"def paths\n tree_path = File.join(File.dirname(__FILE__), 'rails_tree')\n [\"\", \"multitest\", \"results\"].inject([tree_path]) do |result, suffix|\n result << File.join(result[-1], suffix)\n end[1..3]\n end",
"def samples\n home = File.expand_path('../..', __FILE__)\n Dir.glob(\"#{home}/spec/samples/*.ooc\")\nend",
"def test_files\n get_folder_files(TESTS_PATH)\n end",
"def sample_dir\n\t\t\"#{@dir}/samples\"\n\tend",
"def ingest_paths\n path = Pathname.new(Figgy.config[\"ingest_folder_path\"]).join(ingest_directory)\n return [] unless path.exist?\n path.children.select(&:directory?)\n end",
"def audio_files\n @audio_files ||= path.join(\"data\").each_child.select { |file| [\".wav\", \".mp3\"].include? file.extname }.map { |file| IngestableAudioFile.new(path: file) }\n end",
"def initialize root_dir\n find_files root_dir\n end",
"def files(root = '')\n files = []\n dir = @path.join(root)\n Dir.chdir(dir) do\n files = Dir.glob('**/*').select { |p| dir.join(p).file? }\n end\n end",
"def file_get_files(directories) \n directory = \"\"\n files = []\n directories.each do |directory| \n unless directory == \"/root\"\n Dir.chdir(\"#{directory}\") \n Dir.foreach(\"#{directory}\") do |d| \n files.push(d) unless d == \".\" || d == \"..\" \n end\n @file_information.store(directory, files)\n files = []\n end\n end\n return @file_information\n end",
"def get_filelist(root_path)\n array = Dir[root_path+'**/*'].reject {|fn| File.directory?(fn) }\nend",
"def main_files\n retrieve_files_in_main_dir\n end",
"def paths\n root.paths\n end",
"def find_files\n find_files_recursive(@build_result_dir, '')\n end",
"def fakedir_get_all_names(root, basename = '')\n result = (['.', '..'] + root[:files] + root[:dirs].keys).map{|e| basename + e}\n root[:dirs].each do |name, content|\n result += fakedir_get_all_names(content, \"#{basename}#{name}/\")\n end\n result\n end",
"def test_files\n files = tests\n files = files.map{ |f| Dir[f] }.flatten\n files = files.map{ |f| File.directory?(f) ? Dir[File.join(f, '**/*.rb')] : f }\n files = files.flatten.uniq\n files = files.map{ |f| File.expand_path(f) }\n files\n end",
"def retrieve_files_in_main_dir\n ensure_file_open!\n @file.glob('*').map do |entry|\n next if entry.directory?\n\n entry_file_name = Pathname.new(entry.name)\n [entry_file_name, entry.get_input_stream(&:read)]\n end.compact.to_h\n end",
"def root_dir\n existing_paths = root_paths.select { |path| File.exist?(path) }\n if existing_paths.size > 0\n MultiplexedDir.new(existing_paths.map do |path|\n dir = FileSystemEntry.new(name, parent, path)\n dir.write_pretty_json = !!write_pretty_json\n dir\n end)\n end\n end",
"def from_root(*components)\n base_path = File.join(@root_path, *components.map(&:to_s))\n Dir[base_path + '*'].first\n end",
"def category_result_files\n crs = self.data_directory.find_all { |name| name =~ /^multi_.*\\.htm\\.yml$/ }\n crs.collect { |fn| File.join(self.data_directory.path, fn) }\n end",
"def getAllXMLFiles() \n originalDir = Dir.pwd\n Dir.chdir @results_path\n filesArray = Array.new\n debug_msg \"#{@results_path}/**/*.xml\"\n Dir.glob(\"**/*.xml\") do |f|\n debug_msg \"XML: #{f}\"\n filesArray << \"#{@results_path}/\" + f\n end\n Dir.chdir originalDir\n return filesArray\n end",
"def spec_dirs; end",
"def all\n rootdir = Cfg.rootdir\n dirlist = [\"#{rootdir}/*/*\", \"#{rootdir}/*/*/*/*\"]\n filelist = [\"Packages\", \"Packages.gz\", \"Release\", \"Release.gpg\" ]\n files = []\n\n dirlist.each do |dirs|\n Dir.glob(dirs).each do |dir|\n filelist.each do |file|\n fullname = File.join(dir, file)\n files << fullname if File.exists? fullname\n end\n end\n end\n return files\n end",
"def scan\n results = []\n dirs.each do |dir|\n files_in_dir = Dir.glob(File.join(dir,'**','*'))\n results.concat(files_in_dir)\n end\n @known_files = results\n end",
"def files\n file = Dir[self.path + \"/*\"]\n file.each do |file_name|\n file_name.slice!(self.path + \"/\")\n end\n file\n end",
"def directories; end",
"def directories; end",
"def index\n\t\t@directories = []\n\t\troot_directory = Jedd::Directory.joins(:v_user).where(:v_users => {:nick => params[:v_user_nick]}).includes(:jedd_file_nodes).first\n\t\t# root_directory = V::User.find_by_nick(params[:v_user_nick]).jedd_directories.where(:jedd_directory_id => nil).joins(:jedd_directories => [:jedd_file_nodes]).first\n\t\tnot_found unless root_directory\n\n\t\tif root_directory\n\t\t\t@directories << root_directory\n\t\tend\n\tend",
"def find_root(info_files)\n # Try source file(s) covered by the lcov tracefile(s).\n root_dirs = Hash.new(0)\n info_files.each do |file|\n File.open(file).each do |line|\n line.match(/^SF:(.*)$/) do |match|\n Dir.chdir(File.dirname(match[1])) do\n root_dir = `\"#{@options[:git]}\" rev-parse --show-toplevel`.rstrip\n root_dirs[root_dir] = root_dirs[root_dir] + 1 unless root_dir.empty?\n end if Dir.exist?(File.dirname(match[1]))\n end\n end\n end\n\n if root_dirs.empty?\n nil\n elsif root_dirs.size == 1\n root_dirs.shift[0]\n else\n root_dir = root_dirs.max_by { |key, value| value }[0]\n @log.warn \"Found multiple possible repo roots; settled on: #{root_dir}\"\n root_dir\n end\n end",
"def get_dirs\n Dir.glob(\"#{@options[:load_path]}/*/**/\")\n end",
"def takeFilesNames\nDir['result*.*'].each do |file_name|\n @files_names.push(file_name)\nend\nend",
"def root_dir\n superblock.root_dir\n end",
"def root_file_path; end",
"def hiera_file_names\n return @hiera_file_names if @hiera_file_names\n error \"No #{Noop::Config.dir_path_hiera} directory!\" unless Noop::Config.dir_path_hiera.directory?\n exclude = [ Noop::Config.dir_name_hiera_override, Noop::Config.dir_name_globals, Noop::Config.file_name_hiera_plugins ]\n @hiera_file_names = find_files(Noop::Config.dir_path_hiera, Noop::Config.dir_path_hiera, exclude) do |file|\n file.to_s.end_with? '.yaml'\n end\n end",
"def root\n '../' * file.count('/')\n end",
"def files\n files = Dir.glob(\"#{@path}/*.mp3\")\n normalized = files.map do |file|\n file.split(\"./spec/fixtures/mp3s/\") \n end\n why = normalized.map do |file|\n file.reject {|c| c.empty?}\n end.flatten\n end",
"def get_js root_dir\n file_paths = []\n\n Find.find(root_dir) do |path|\n file_paths << path if path =~ /.*\\.js$/\n end\n\n return file_paths\n end",
"def files\n real_path = self.path[2...-1] + \"s/*\"#trim './' and add 's/*' \n \n Dir[real_path].map{|file| file.split(\"/\")[-1]} \n end",
"def getResultFileNames()\n resultDir = File.dirname(File.dirname(File.expand_path(Dir.pwd)))\n @demuxBustardSummaryXML = resultDir + \"/DemultiplexedBustardSummary.xml\"\n\n baseCallsStatsDir = Dir[resultDir + \"/Basecall_Stats_*\"]\n @demuxStatsHTM = baseCallsStatsDir[0] + \"/Demultiplex_Stats.htm\"\n\n if !File::exist?(@demuxBustardSummaryXML)\n raise \"File \" + @demuxBustardSummaryXML + \" does not exist or is unreadable\"\n end\n\n if !File::exist?(@demuxStatsHTM)\n raise \"File \" + @demuxStatsHTM + \" does not exist or is unreadable\"\n end\n \n end",
"def all\n Pathname.new(dir).children.map do |score_dir|\n load_best score_dir\n end\n end",
"def required_files(root = nil)\n sort!\n files = sources.map {|s| s.required_files }.flatten\n if root\n root = Pathname.new(File.expand_path(root))\n files = files.map {|f| Pathname.new(File.expand_path(f)).relative_path_from(root).to_s }\n end\n files\n end",
"def x_get_tree_roots\n objects = []\n objects.push(:id => \"xx-system\",\n :text => _(\"Examples (read only)\"),\n :icon => \"pficon pficon-folder-close\",\n :tip => _(\"Examples (read only)\"))\n PxeImageType.all.sort.each do |item, _idx|\n objects.push(item)\n end\n objects\n end",
"def retrieve_dirs(_base, dir, dot_dirs); end",
"def get_filepaths(target_dir)\n dirpaths = [target_dir + \"/subnodes\", target_dir + \"/headnodes\"]\n filepaths = []\n dirpaths.each do |dirpath|\n Dir[dirpath+\"/*\"].each do |filepath|\n filepaths << filepath\n end\n end\n return filepaths\n end",
"def get_all_mediatype_files\n puts \"Searching for files in #{directory_tree}\"\n # Rewrote to use absolute search paths because FakeFS chokes on Dir.chdir\n matching_files = []\n @extensions.each do |ex|\n search_for = File.join(directory_tree, \"**\", '*' + ex) # example: \"/home/xavier/Tech/Docs/**/*.pdf\"\n matching_files.concat(Dir.glob(search_for))\n end\n #puts \"Found these files: \" + matching_files.to_s\n convert_to_pathnames(matching_files).delete_if { |file| file.dirname.to_s == mediatype_dirname.to_s }\n end",
"def test_list_root_items\n elfinder = ElFinder::Connector.new({\n :root => @vroot,\n :url => '/elfinder',\n :tree_sub_folders => false,\n :original_filename_method => lambda {|file| File.basename(file.path)}\n })\n\n h, r = elfinder.run(:cmd => 'open', :init => 'true', :target => '', :tree => true)\n assert_equal 0, r[:tree][:dirs].count\n end",
"def fetch_feature_docs\n docs=[]\n d = Dir[@source + \"/*.xml\"]\n #puts d.inspect\n\n d.entries.each do |file|\n docs << file\n end\n #puts docs.inspect\n docs\n end",
"def files\n Dir.glob(bag_dir/\"**\"/\"*\")\n .map {|f| Pathname.new(f) }\n .reject(&:directory?)\n end",
"def files\n @files.map do |file|\n if File.directory?(file)\n Dir[File.join(file, '**', '*.rb')]\n else\n file\n end\n end.flatten\n end",
"def scan_directories_for_txtfiles fitNesseRoot, type=\"all\"\n\t\n\tfolder = case type\n\t\twhen \"regression\"\n\t\t\t\"RegressionSuite\"\n\t\twhen \"scenario\"\n\t\t\t\"ScenarioLib\"\n\t\twhen \"component\"\n\t\t\t\"*Components\"\n\t\twhen \"all\"\n\t\t\t\"**\"\n\t\telse\n\t\t\traise Exception, \"Need regression, component, scenario, all or none as an argument.\"\n\t\tend\n\n\t# Putting the Dir.glob search in a block will return the working directory\n\t# to it's original location - important for loading new classes and modules.\n\tDir.chdir(fitNesseRoot + \"./LearnMainline/BbLearnTests/\") {\n\t\tDir.glob(\"./**/\" + folder + \"/**/content.txt\") { |f| \n\t\t\t#puts File.expand_path(f)\n\t\t\tyield File.expand_path(f) #Can remove this and return an array instead. \n\t\t}\t\n\t}\n\n\t# We also have the ability to pass this up as an array of files. I can't decide if holding an array\n\t# is better than keeping the search open and yeilding one file at a time. \nend",
"def findPaths (conf)\n puts aktTime()+' collecting files...'\n STDOUT.flush #write out immediately\n\tconf[:saveDirs].each do |d|\n\t\tif File.directory?(d)\n\t\t\tDir.chdir(d)\n\t\t\tgetFiles(conf)\n\t\telse\n\t\t\tputs \"\\nWarning: Directory: \\n\"+d+\" **not** found !\"\n\t\tend\n\tend\nend",
"def solution_files\n get_folder_files(SOLUTION_PATH)\n end",
"def root\n folders.first\n end",
"def files\n files_equivs = \"\"\n @package.documents.each do |file|\n ActiveRecord::Base.logger.info(\"#{file.attach_file_name} #{file.install_path}\")\n files_equivs += \"#{file.attach_file_name} #{file.install_path}\\n\\t\"\n end\n files_equivs\n end",
"def files\n Dir[root_path(\"app\", \"**\", \"*.rb\")] + [@app_class.app_file]\n end",
"def crawl_hiera_directory(directory)\n files = []\n Dir[directory + '/**/*.yaml'].each { |f| files << File.absolute_path(f) }\n return files\n end",
"def folders\n xpath './folder'\n end",
"def find_files folder\n unless @started\n Logger.<<(__FILE__,\"ERROR\",\"FileManager is not started yet !\")\n abort\n end\n if @subfolders\n files = sub_listing folder\n else\n path = ::File.join(@source.base_dir,folder)\n files = files_listing path\n end\n files = files_filtering files\n files = files.take(@take) if @take\n to_file(files)\n end",
"def _folders\r\n Dir.glob(File.join(\"templates\", \"**/\"))\r\n end",
"def staged_root\n c = Configuration.per_cluster_dataroot? ? cluster_id : nil\n self.class.dataroot(token, cluster: c).join(\"output\", id)\n end",
"def folders\n wayfinder.decorated_ephemera_folders\n end",
"def files\n file_sets.map{|fs| fs.files }.flatten\n end",
"def result_paths( pattern = '*' )\n paths = nil\n Dir.chdir(dir) {\n paths = Dir.glob(pattern).map {|x| Pathname.new(x).expand_path }\n }\n # remove directories of Analysis\n anl_dirs = analyses.map {|anl| /^#{anl.dir.to_s}/ }\n paths.reject do |path|\n anl_dirs.find {|anl_dir| anl_dir =~ path.to_s }\n end\n end",
"def spec_files\n glob_files(@root_dir, 'spec', '**/*_spec.rb')\n end",
"def files(uri)\n [].tap do |ary|\n ary.concat Dir[uri]\n search_paths.each { |p| ary.concat Dir[File.join p, uri] }\n end\n end",
"def files_to_analyze\n require 'find'\n ignore_dirs = ['.git','bin','test','assets','lib','log','vendor','tmp','img', 'images', 'uploads', 'fonts']\n ignore_files = Regexp.union(/^\\..*$/i, /^.*(.md)$/i, /^.*(.json)$/i, /^.*(.yml)$/i, /^.*(.log)$/i, /^.*(.png)$/i, /^.*(.jpg)$/i, /^.*(.jpeg)$/i)\n final_files = []\n # for every file in repository - keep the files to process\n Find.find('.') do |path|\n path_name = File.basename(path)\n if FileTest.directory?(path)\n if ignore_dirs.include?(path_name)\n Find.prune\n else\n next\n end\n else\n if path_name.match(ignore_files)\n next\n else\n path.gsub!(/^\\.\\//, '')\n final_files.push(path)\n end\n end\n end\n return final_files\n end",
"def run_through_directory\n@file_array = []\n Dir.foreach('text_files') do |item|\n next if item == '.' or item == '..'\n @file_array << item\n end\nend",
"def findFlacFiles()\nflacdirs = Array.new\nDir.foreach(\".\") { |file| \\\n if(File.directory?(file))\n Dir.foreach(file) { |subfile| \\\n if(!subfile[-5..-1].nil?)\n if(subfile[-5..-1] == \".flac\")\n flacdirs << file + \"/\"\n break\n end\n end\n }\n end\n }\n return flacdirs;\nend",
"def get_root_json_filename\n File.expand_path(\"#{@api_directory}/root.json\")\n end",
"def breadcrumb_files\n Dir[*Gretel.breadcrumb_paths]\n end",
"def recursive_file_list( root_dir)\n\t\treturn nil unless File.directory?(root_dir)\n\t\tlist = []\n\t\tDir.entries( root_dir).reject{|e| e=~/^\\./}.each { |e| \n\t\t\tpath = File.join( root_dir, e)\n\t\t\tif File.directory?( path)\n\t\t\t\t# puts \"Dir: #{path}\"\n\t\t\t\t list += recursive_file_list(path)\n\t\t\telsif File.file?(path)\n\t\t\t\t# puts \"File: #{path}\"\n\t\t\t\t list << path\n\t\t\tend\t\n\t\t}\n\t\tlist\n\tend",
"def root_fs\n\t\t\t\tfind_root[2].to_s\n\t\t\tend",
"def files\n return get_result('files')\n end",
"def dirs; end",
"def dirs; end",
"def expanded\n raise \"You need to set a path root\" unless @root.path\n result = []\n\n each do |path|\n path = File.expand_path(path, @root.path)\n\n if @glob && File.directory?(path)\n result.concat files_in(path)\n else\n result << path\n end\n end\n\n result.uniq!\n result\n end",
"def output_files\n get_info :output_files\n end",
"def all_files() = path.glob('**/*').select(&:file?).map(&:to_s)",
"def root\n Pathname.new(File.dirname(__dir__))\n end",
"def get_measures_in_dir(measures_dir)\n measures = Dir.glob(File.join(measures_dir, '**/measure.rb'))\n if measures.empty?\n # also try nested 2-deep to support openstudio-measures\n measures = Dir.glob(File.join(measures_dir, '**/**/measure.rb'))\n end\n\n result = []\n measures.each { |m| result << File.dirname(m) }\n return result\n end",
"def log_files\n files = []\n Find.find(File.join(Dir.pwd, 'features', 'logs')) do |p|\n next if FileTest.directory? p\n files << p\n end\n files\nend",
"def file_get_initialization(structure = ENV[\"HOME\"]) # this is linux specific for now\n @file_information = {} # {\"/directory\"=>[\"file\"], \"/directory/directory\"=>[\"file\", \"file\"]\n files = [] \n directory = \"\"\n directories = [] \n things = structure.split('/')\n things.each do |thing|\n if thing == \"\"\n directories.push(\"/root\")\n else\n directory = \"#{directory}/#{thing}\" \n @current_directory = directory\n directories.push(\"#{directory}\") if File.directory?(\"#{directory}\")\n end\n end \n return directories\n end",
"def build_file_list\n puts_and_logs 'Finding files...'\n file_list = []\n config[:source].each do |entry|\n if File.directory?(entry)\n populate_list_of_files_from_directory(file_list, entry) \n next\n end\n if File.file?(entry)\n populate_list_of_files_from_file(file_list, entry) \n next\n end\n logger.warn \"\\\"#{entry}\\\" is neither a directory nor a regular file. Ignored...\"\n end\n logger.debug(file_list)\n file_list\n end",
"def 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 documents\n Dir[\"#{source_path}/**/*.xml\"].map do |path|\n Document.from_xml File.read(path)\n end.sort {|d1, d2| d1.position <=> d2.position }\n end",
"def directories\n directory.directoires\n end",
"def collect_roots\n\n\t\t# Array to return\n\t\troots = Array.new\n\t\t# For each template\n\t\ttemplates.each do |key, val|\n\t\t\t# Push to array if root\n\t\t\troots << val if template_root? key\n\t\tend\n\t\t\n\t\t# Return results\n\t\troots\n\n\tend",
"def templates\n Dir.glob(::Webby.path('examples') / '*').sort\n end",
"def discover_items_via_crawl(root)\n Dir.glob(\"#{root}/**/*\").select { |fname| File.file?(fname) }\n end",
"def recursive_find_directories_and_files dirname\r\n base_path = self.class.lookup('ExtAdminSection').path + \"/templates/\"\r\n \r\n directories = []\r\n files = []\r\n \r\n Find.find(File.join(base_path, dirname)) do |path|\r\n if FileTest.directory?(path)\r\n directories << path.gsub(base_path, '')\r\n else\r\n files << path.gsub(base_path, '')\r\n end\r\n end\r\n \r\n return directories, files\r\n end",
"def find_files(levels=[\"0\"],up_to=300)\n\tarr = []\n\tnames = []\n\t(0...up_to).each do |i|\n\t\tlevels.each do |j|\n\t\t\tif (File.exists?(\"../scraper_and_data/scraped_genomes/level_\" + j + \"/\"+i.to_s))\n\t\t\t\tarr << \"../scraper_and_data/scraped_genomes/level_\" + j + \"/\"+i.to_s\n\t\t\t\tnames << i.to_s\n\t\t\tend\n\t\tend\n\tend\n\treturn arr,names\nend",
"def read_files\n Dir['*', '*/*'].group_by { |f| f.ext || :_dir }.to_symkey\n end",
"def files\n directory.files\n\n #@files ||= (\n # files = []\n # Dir.recurse(directory.to_s) do |path|\n # next if IGNORE_FILES.include?(File.basename(path))\n # files << path.sub(directory.to_s+'/','')\n # end\n # files.reject{ |f| File.match?(CONFIG_FILE) }\n #)\n end",
"def find\r\n scanner = DirectoryScanner.new\r\n scanner.setBasedir(@context.root)\r\n scanner.setCaseSensitive(false)\r\n scanner.setIncludes(@includes.to_java :String) unless @includes.empty?\r\n scanner.setExcludes(@excludes.to_java :String) unless @excludes.empty?\r\n scanner.scan\r\n scanner.included_files.collect{|f| @context.filepath_from_root(f) }\r\n end",
"def roots\n self.ontology_classes(force_reload=true).select{|c| c.isroot?}\n end"
] |
[
"0.69281185",
"0.6593671",
"0.65053207",
"0.629359",
"0.6245648",
"0.61364573",
"0.60480756",
"0.60313416",
"0.6030906",
"0.5993595",
"0.5981229",
"0.5954594",
"0.59488773",
"0.58552146",
"0.58543193",
"0.58522147",
"0.5799286",
"0.57409644",
"0.57221437",
"0.5694884",
"0.5686261",
"0.5670897",
"0.5667913",
"0.5648097",
"0.5629589",
"0.56259155",
"0.56259155",
"0.5621371",
"0.56145436",
"0.5600933",
"0.55884105",
"0.5585559",
"0.5576651",
"0.55728567",
"0.55670464",
"0.55653787",
"0.5561911",
"0.555521",
"0.5547153",
"0.55246377",
"0.55144364",
"0.5513957",
"0.5513704",
"0.55091",
"0.5509069",
"0.55011326",
"0.5493534",
"0.5488231",
"0.54810447",
"0.54787964",
"0.5471735",
"0.54695565",
"0.5468571",
"0.54579586",
"0.5455629",
"0.54432577",
"0.54424334",
"0.54371476",
"0.54258883",
"0.54248327",
"0.54189074",
"0.54181737",
"0.5412063",
"0.5409722",
"0.5407405",
"0.5393586",
"0.5393418",
"0.53837335",
"0.53781974",
"0.53752565",
"0.5370932",
"0.53662336",
"0.53595024",
"0.5352787",
"0.5352787",
"0.5348508",
"0.5348099",
"0.53447837",
"0.5342371",
"0.534197",
"0.53372985",
"0.53256583",
"0.5321684",
"0.53173375",
"0.53085554",
"0.5307809",
"0.5306366",
"0.5304396",
"0.529726",
"0.529354",
"0.5292956",
"0.5292341",
"0.52904534",
"0.52892494",
"0.52858967"
] |
0.71319383
|
4
|
Recipes for adding stat. error shapes. Makes a new file task: input_file_stat_errors.root => input_file.root
|
def add_fake_errors(input_file, channel, prefix)
output_file = "#{File.dirname(input_file)}/#{channel}_shapes_#{prefix}_statshapes.root"
output_sys_list = output_file.sub('.root', ".txt")
file output_file => [input_file] do |t|
sh "add_stat_shapes.py #{input_file} #{output_file} --filter '#{prefix}/fakes' --prefix CMS_vhtt_#{$period}_#{prefix}_fakeshape > #{output_sys_list}"
end
return output_file
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_fake_errors(input_file, prefix)\n output_file = input_file.sub('.root', '_statshapes.root')\n output_sys_list = input_file.sub('.root', '_statshapes.txt')\n file output_file => [input_file] do |t|\n sh \"add_stat_shapes.py #{input_file} #{output_file} --filter '#{prefix}/fakes' --prefix CMS_vhtt_#{$period}_#{prefix}_fakeshape > #{output_sys_list}\"\n end\n return output_file\nend",
"def test_operator_file_errors\n optest_command_ok(\"reset\")\n optest_command_ok(\"load data/Tests/Default/JD.yml data/Tests/Default/ED.yml OK\")\n optest_file_error(\"add data/Tests/Default/CC0.yml\")\n File.chmod(0222,\"data/Tests/Validation/CC3_Write_Only.yml\")\n optest_file_error(\"add data/Tests/Validation/CC3_Write_Only.yml\")\n File.chmod(0644,\"data/Tests/Validation/CC3_Write_Only.yml\")\n optest_file_error(\"add tabulator.rb\")\n optest_file_error(\"add data/Tests/Default/ED.yml\")\n optest_file_error(\"add data/Tests/Validation/ARRAY.yml\")\n optest_file_error(\"add data/Tests/Validation/CC2_Syntax_Error.yml\")\n end",
"def add_to_errors_file(filename,output)\n self.add_to_file(filename,output)\n end",
"def add_errors(_errors)\n _errors.sort { |a,b|\n a_attrs = [a.location[:filename], a.location[:line]].compact\n b_attrs = [b.location[:filename], b.location[:line]].compact\n a_attrs <=> b_attrs\n }.each do |e|\n self.add_error(e)\n end\n end",
"def process_build_errors(errors, error_file)\n error_count = 0\n if errors && errors.length > 0\n err_file = File.new(error_file, \"w\") if error_file\n begin\n msg, msg_num, source_line, mbr = nil, nil, nil, nil\n errors.to_s.each_line do |line|\n err_file.puts(line) if err_file\n if line =~ /^\\\\\\\\(?:Record #\\d+ - )?(.+) \\((\\d+)\\)/\n yield msg, mbr, source_line if msg && block_given?\n msg = $1\n msg_num = $2.to_i\n msg_template = DATA_LOAD_ERROR_CODES[msg_num]\n if msg_template\n re = Regexp.new(msg_template.gsub('%s', '(.+)'), Regexp::IGNORECASE)\n mbr = re.match(msg)[1]\n end\n error_count += 1\n else\n source_line = line\n yield msg, mbr, source_line if block_given?\n msg, msg_num, source_line, mbr = nil, nil, nil, nil\n end\n end\n yield msg, mbr, source_line if msg && block_given?\n ensure\n err_file.close if err_file\n end\n end\n log.warning \"There were #{error_count} build errors\" if error_count > 0\n error_count\n end",
"def map_schema_errors(file, errors)\n errors.map { |m| \"#{file}#{m}\" }\n end",
"def do_error_command(name, file) \n output, result = compile_file(name)\n errors = parse_output(output)\n saved = []\n ln = 1 # first line is already parsed, start loop at 2\n file.each do |line| \n ln = ln + 1\n match = line.match(/(\\/\\/+).*ERROR(.*)/)\n unless !match.nil? && match[1].length == 2 \n\t\t\tunless errors[ln].nil?\n\t\t\t\terrors[ln].each do |err|\n\t\t\t\t\tsaved << [err, \"\"]\n\t\t\t\tend\n\t\t\tend\n next\n end\n\n regex = \"#{name}:#{ln}:.+:.*#{match[2].strip}\"\n regelse = \"#{name}:#{ln}:.+:.*\"\n\n\t\tif errors[ln].nil? \n\t\t\tsaved << [\"\", regex]\n\t\t\tnext\n\t\tend\n\n errors[ln].each do |err|\n omatch = output.match(regex)\n unless omatch.nil? \n next\n\t\t\tend\n\t\t\tsaved << [err, regex]\n end\n\tend\n\n if saved.length > 0 \n puts \"----------------------------------------------------------------------\"\n puts \"BUG: %s unmatched errors \" % name\n puts \"----------------------------------------------------------------------\"\n saved.each do |error|\n puts \"#{error[0]} -- #{error[1]}\"\n end\n puts \"----------------------------------------------------------------------\"\n exit 1\n end\nend",
"def map_error_output(filename)\r\n\tDir.mkdir(\"#{settings.root}/tmp\") unless File.exists?(\"#{settings.root}/tmp\")\r\n\tfile = File.new(\"#{settings.root}/tmp/#{filename}\", 'a+')\r\n\tfile.sync = true\r\n\t$stderr.reopen file\r\nend",
"def propagate_errors_to_file\n errors = aggregate_errors\n current_course.errors.add(:invitations_file, errors.to_sentence) unless errors.empty?\n end",
"def propagate_errors_to_file\n errors = aggregate_errors\n current_course.errors.add(:invitations_file, errors.to_sentence) unless errors.empty?\n end",
"def propagate_errors_to_file\n errors = aggregate_errors\n current_course.errors.add(:invitations_file, errors.to_sentence) unless errors.empty?\n end",
"def check_for_errors\n @errors += Tags.tag_errors(path)\n\n # Check for invalid filenames\n if (whitespace_led_component = Pathname(path).each_filename.to_a.find { |p| p.start_with?(/\\s+/) })\n @errors << \"path contains a file or directory name with leading whitespace: #{whitespace_led_component}\"\n end\n\n if (forbidden_substrings = FORBIDDEN_SUBSTRINGS.select { |fss| path.to_s.include?(fss) }).any?\n @errors << \"path contains invalid character(s): #{forbidden_substrings.join(\" \")}\"\n end\n\n if format == \"FLAC\"\n _stdout, stderr, status = Open3.capture3(\"flac -wt \\\"#{path}\\\"\")\n\n unless status.success?\n error_line = stderr.split(\"\\n\")\n .find { |line| line.include?(File.basename(path)) }\n\n @errors << if error_line\n \"failed flac verification test: #{error_line}\"\n else\n \"failed flac verification test\"\n end\n end\n end\n\n if (bit_depth && ![16, 24].include?(bit_depth))\n @errors << \"#{bit_depth} is an invalid bit depth\"\n elsif !bit_depth && format == \"FLAC\"\n @errors << \"unable to determine bit depth\"\n end\n\n if sample_rate.nil?\n @errors << \"unable to determine sample rate\"\n else\n case bit_depth\n when 16\n unless [44_100, 48_000].include?(sample_rate)\n sample_rate_khz = sample_rate.to_f / 100\n @errors << \"#{sample_rate_khz} kHz is not a valid sample rate for a 16-bit lossless file\"\n end\n when 24\n unless [44_100, 88_200, 176_400, 352_800, 48_000, 96_000, 192_000, 384_000].include?(sample_rate)\n sample_rate_khz = sample_rate.to_f / 100\n @errors << \"#{sample_rate_khz} kHz is not a valid sample rate for a 24-bit lossless file\"\n end\n when nil # will happen for Lossy formats\n unless [44_100, 48_000].include?(sample_rate)\n sample_rate_khz = sample_rate.to_f / 100\n @errors << \"#{sample_rate_khz} kHz is not a valid sample rate for a lossy file format\"\n end\n end\n end\n\n @checked_for_errors = true\n\n @errors\n end",
"def test_invalid_file_correct_args_length\n assert_output(\"File not found!\\n\") {@grapher.make_graph(['hi.txt'])}\n end",
"def compute_validation_file_specs(input_file_specs)\n input_file_specs.inject({}) { |m,(fs_name, fs_string)|\n base_dir, file_pattern = fs_string.split(Repositext::Cli::FILE_SPEC_DELIMITER).compact\n if base_dir.nil? || file_pattern.nil?\n raise ArgumentError.new(\"file_spec requires both base_dir and file_pattern: #{ fs_string.inspect } in #{ input_file_specs.inspect }\")\n end\n if base_dir !~ BASE_DIR_NAME_REGEX\n raise ArgumentError.new(\"base_dir is not valid: #{ base_dir.inspect }\")\n end\n if file_pattern !~ FILE_PATTERN_NAME_REGEX\n raise ArgumentError.new(\"file_pattern is not valid: #{ file_pattern.inspect }\")\n end\n m[fs_name] = [base_dir(base_dir), file_pattern(file_pattern)]\n m\n }\n end",
"def test_should_read_error_from_file\n \n input = \"test_should_read_error_from_file\"\n outname = \"test_should_read_error_from_file\"\n \n errorFile =\"./error/#{outname}.txt\"\n file = File.open(errorFile, 'w')\n file.write(input);\n file.close();\n \n dir = \"./p/test_should_read_error_from_file.rb\"\n filename = \"test_should_read_error_from_file.rb\"\n \n result = get_compile_error( dir , filename )\n \n assert_equal(input, result)\n \n end",
"def config_error(path, error); end",
"def script_error(path, error); end",
"def test_compare_error_locations_across_files\n a = { file_name: nil }\n b = { file_name: 'beta' }\n assert_equal 1, compare_error_locations_across_files(a, b)\n\n a = { file_name: 'alpha' }\n b = { file_name: 'beta' }\n assert_equal(-1, compare_error_locations_across_files(a, b))\n\n a = { file_name: 'delta', location: '/div[1]/div[1]/div[2]' }\n b = { file_name: 'delta', location: '/div[1]/div[2]/div[1]' }\n assert_equal(-1, compare_error_locations_across_files(a, b))\n end",
"def propagate_errors\n propagate_errors_to_file if invite_by_file?\n end",
"def propagate_errors\n propagate_errors_to_file if invite_by_file?\n end",
"def propagate_errors\n propagate_errors_to_file if invite_by_file?\n end",
"def extract_error_for(path, errors)\n content = File.read(path).strip\n if(content.start_with?('{'))\n errors[:json_load]\n elsif(content.start_with?('<'))\n errors[:xml_load]\n elsif(content.match(/\\.new\\s*(do|\\{)/))\n errors[:struct_load]\n else\n errors[:yaml_load]\n end\n end",
"def errors_handling(err_code)\n\n\t\terr_code = err_code.to_i + 32000\n\n\t\t# PJL File System Errors (32xxx)\n\t\tfs_errors = {\n\t\t\t'32000' => 'General error',\n\t\t\t'32001' => 'Volume not available',\n\t\t\t'32002' => 'Disk full',\n\t\t\t'32003' => 'File not found',\n\t\t\t'32004' => 'No free file descriptors',\n\t\t\t'32005' => 'Invalid number of bytes',\n\t\t\t'32006' => 'File already exists',\n\t\t\t'32007' => 'Illegal name',\n\t\t\t'32008' => 'Can\\'t delete root',\n\t\t\t'32009' => 'File operation attempted on a directory',\n\t\t\t'32010' => 'Directory operation attempted on a file',\n\t\t\t'32011' => 'Not same volume',\n\t\t\t'32012' => 'Read only',\n\t\t\t'32013' => 'Directory full',\n\t\t\t'32014' => 'Directory not empty',\n\t\t\t'32015' => 'Bad disk',\n\t\t\t'32016' => 'No label',\n\t\t\t'32017' => 'Invalid parameter',\n\t\t\t'32018' => 'No contiguous space',\n\t\t\t'32019' => 'Can\\'t change root',\n\t\t\t'32020' => 'File Descriptor obsolete',\n\t\t\t'32021' => 'Deleted',\n\t\t\t'32022' => 'No block device',\n\t\t\t'32023' => 'Bad seek',\n\t\t\t'32024' => 'Internal error',\n\t\t\t'32025' => 'Write only',\n\t\t\t'32026' => 'Write protected',\n\t\t\t'32027' => 'No filename',\n\t\t\t'32051' => 'End of directory',\n\t\t\t'32052' => 'No file system',\n\t\t\t'32053' => 'No memory',\n\t\t\t'32054' => 'Vol name out of range',\n\t\t\t'32055' => 'Bad FS',\n\t\t\t'32056' => 'Hardware failure'\n\t\t}\n\n\t\tif (fs_errors.has_key?(err_code.to_s))\n\t\t\treturn fs_errors[err_code.to_s]\n\t\telse\n\t\t\treturn 'Bad command or error'\n\t\tend\n\tend",
"def errors_handling(err_code)\n\n\t\terr_code = err_code.to_i + 32000\n\n\t\t# PJL File System Errors (32xxx)\n\t\tfs_errors = {\n\t\t\t'32000' => 'General error',\n\t\t\t'32001' => 'Volume not available',\n\t\t\t'32002' => 'Disk full',\n\t\t\t'32003' => 'File not found',\n\t\t\t'32004' => 'No free file descriptors',\n\t\t\t'32005' => 'Invalid number of bytes',\n\t\t\t'32006' => 'File already exists',\n\t\t\t'32007' => 'Illegal name',\n\t\t\t'32008' => 'Can\\'t delete root',\n\t\t\t'32009' => 'File operation attempted on a directory',\n\t\t\t'32010' => 'Directory operation attempted on a file',\n\t\t\t'32011' => 'Not same volume',\n\t\t\t'32012' => 'Read only',\n\t\t\t'32013' => 'Directory full',\n\t\t\t'32014' => 'Directory not empty',\n\t\t\t'32015' => 'Bad disk',\n\t\t\t'32016' => 'No label',\n\t\t\t'32017' => 'Invalid parameter',\n\t\t\t'32018' => 'No contiguous space',\n\t\t\t'32019' => 'Can\\'t change root',\n\t\t\t'32020' => 'File Descriptor obsolete',\n\t\t\t'32021' => 'Deleted',\n\t\t\t'32022' => 'No block device',\n\t\t\t'32023' => 'Bad seek',\n\t\t\t'32024' => 'Internal error',\n\t\t\t'32025' => 'Write only',\n\t\t\t'32026' => 'Write protected',\n\t\t\t'32027' => 'No filename',\n\t\t\t'32051' => 'End of directory',\n\t\t\t'32052' => 'No file system',\n\t\t\t'32053' => 'No memory',\n\t\t\t'32054' => 'Vol name out of range',\n\t\t\t'32055' => 'Bad FS',\n\t\t\t'32056' => 'Hardware failure'\n\t\t}\n\n\t\tif (fs_errors.has_key?(err_code.to_s))\n\t\t\treturn fs_errors[err_code.to_s]\n\t\telse\n\t\t\treturn 'Bad command or error'\n\t\tend\n\tend",
"def validate_file_input file, type\n @logger.debug \"Validating input file for #{type} file #{file}\"\n error = false\n unless file.is_a?(String) and !file.nil?\n error = \"The #{type} filename (#{file}) is not valid.\"\n else\n unless File.exists?(file)\n error = \"The #{type} file (#{file}) was not found.\"\n end\n end\n if error\n @logger.error \"Could not validate input file: #{error}\"\n raise \"InvalidInput\"\n end\nend",
"def test_load_invalid_png_files\n\n each_file_with_updated_info do\n |file_path|\n\n if @test_feature == \"x\"\n #Invalid png files should generally raise exception (except in the specific cases below).\n\n if @parameter == \"cs\" || @parameter == \"hd\"\n if @parameter == \"cs\"\n chunk_str = \"IDAT\"\n else\n chunk_str = \"IHDR\"\n end\n #Test images with bad crc warn\n actual_stderr = $stderr\n $stderr = StringIO.new\n assert_nothing_raised do\n Imgrb::Image.new(file_path)\n end\n $stderr.rewind\n assert_equal \"Critical chunk '#{chunk_str}' failed crc check. Image may not be decoded correctly.\", $stderr.string.chomp\n $stderr = actual_stderr\n else\n assert_raise do\n Imgrb::Image.new(file_path)\n end\n end\n\n #Reading only metadata should not raise an error if IDAT chunk is\n #missing. Maybe try harder to extract metadata from other invalid files\n #as well.\n if @parameter == \"dt\"\n assert_nothing_raised do\n Imgrb::Image.new(file_path, :only_metadata)\n end\n end\n\n end\n\n end\n\n end",
"def optest_file_error(line)\n print \"\\nTesting Operator File Error: #{line}\\n\"\n args = line.split(/ /)\n result = TabulatorOperator.new.operator_command(args)\n assert((result =~ /^File*/), \"Expected File error: #{result}\")\n end",
"def format_compile_error(file_name, file_path, reason,\n line, cursor); EMPTY; end",
"def add_error(line)\n add_value(line, \"error\")\n end",
"def graph_file(name_valid, arr_pass, arr_error)\n total = arr_pass.length + arr_error.length\n percentage_valid = ((arr_pass.length.to_f / total) * 100).round(2)\n percentage_invalid = ((arr_error.length.to_f / total) * 100).round(2)\n file = File.open(name_valid, 'a')\n file.puts\n file.puts 'GRAPH'\n file.puts '╔═══════════════════════════════════════════════════════════════════'\n file.puts \"║Valids: #{arr_pass.length} #{'█' * (percentage_valid / 2)} #{percentage_valid}%\"\n file.puts '║'\n file.puts \"║Invalids: #{arr_error.length} #{'▓' * (percentage_invalid / 2)} #{percentage_invalid}%\"\n file.puts '║ % ───│────│────│────│────│────│────│────│────│────│'\n file.puts '║ 10 20 30 40 50 60 70 80 90 100'\n file.puts '╚═══════════════════════════════════════════════════════════════════'\nrescue Exception => e\n puts \"ERROR, #{e.message}\"\nend",
"def check_file(file_result)\n begin\n ::YAML.load(File.read(file_result.path))\n rescue Psych::SyntaxError => e\n file_result.add_issue(\n line_number: e.line,\n character: e.column,\n level: :error,\n raw_message: e.problem,\n )\n end\n end",
"def rpt_error(error_list)\n file_name = @dir + \"rpt_error_list.txt\"\n printf(\"@I:generate %s\\n\",file_name)\n f = open(\"#{file_name}\",\"w\")\n comment = \"Error attribute list refferd from Synplify Rpt file\" \n Common.print_file_header(f,\"#{comment}\",$TOOL,$VERSION,\"##\") \n print_synplify_rpt(f,error_list)\n f.close\n end",
"def file_patterns_errors\n messages = []\n messages << \"The sources did not match any file\" if !@spec.source_files.empty? && @pod.source_files.empty?\n messages << \"The resources did not match any file\" if !@spec.resources.empty? && @pod.resource_files.empty?\n messages << \"The preserve_paths did not match any file\" if !@spec.preserve_paths.empty? && @pod.preserve_files.empty?\n messages << \"The exclude_header_search_paths did not match any file\" if !@spec.exclude_header_search_paths.empty? && @pod.headers_excluded_from_search_paths.empty?\n messages\n end",
"def build_errors(type, category = nil, row = nil, column = nil, content = nil, constraints = {})\n handle_output(Csvlint::ErrorMessage.new(type, category, row, column, content, constraints), @errors, :red)\n \n end",
"def add_error(message, filename = @node.file, line_number = @node.line_number)\n errors <<\n RailsBestPractices::Core::Error.new(\n filename: filename, line_number: line_number, message: message, type: self.class.to_s, url: url\n )\n end",
"def test_create_invalid_file\r\n \treader = GraphReader.new('invalid')\r\n \tassert_output(\"Error: file not found\\n\") {reader.create_graph()}\r\n end",
"def process_one_dir(dir)\n Dir.glob(dir + '/*.txt') do |log_file|\n\n File.open(log_file, \"r\") do |infile|\n size = \"UNKNOWN\"\n jobid = \"UNKNOWN\"\n error = \"NO\"\n while (line = infile.gets)\n if (line.strip == \"------------------------------------------\")\n jobid, nnodes, ntasks, query, dbsize, run, nsplits, nrecords = parse_log_header(infile)\n next\n end\n if (line.include? \"VP:partitioningTime\")\n partitioningTime = line.split(\"VP:partitioningTime:\")[1].strip\n partitioningTime.sub!(\"ms\",\"\").strip!\n end\n if (line.include? \"Running job:\")\n hadoopjob = line.split(\"Running job:\")[1].strip\n end\n if (line.include? \"COMPOSING_TIME_LOAD_PARTIALS=\")\n loadpartials = line.split(\"COMPOSING_TIME_LOAD_PARTIALS=\")[1].strip\n end \n if (line.include? \"COMPOSING_TIME_COMBINE_PARTIALS=\")\n combinepartials = line.split(\"COMPOSING_TIME_COMBINE_PARTIALS=\")[1].strip\n end \n if (line.include? \"Copy result time:\")\n transferResult = line.split(\"Copy result time:\")[1].strip\n transferResult.sub!(\"ms.\",\"\").strip!\n end \n if (line.include? \"Total execution time:\")\n totaltime = line.split(\"Total execution time:\")[1].strip\n totaltime.sub!(\"ms.\",\"\").strip!\n end \n if (line.include? \"Size of output\")\n size = line.split(\":\")[1]\n size = size.split(\" \")[0].strip\n end\n if (line.include? \"Error\")\n error = \"YES\"\n end\n if (line.include? \"Failed reduce tasks\")\n if line.split(\"=\")[1].strip.to_i > 0\n error = \"YES\"\n end\n end\n if (line.include? \"Failed map tasks\")\n if line.split(\"=\")[1].strip.to_i > 0\n error = \"YES\"\n end\n end\n end\n nfragments = nsplits.to_i * nrecords.to_i\n puts \"#{jobid};#{hadoopjob};#{nnodes};#{nnodes.to_i * ntasks.to_i};#{query};#{run};#{dbsize};#{ntasks};#{nfragments};#{nsplits};#{nrecords};#{partitioningTime};#{loadpartials};#{combinepartials};#{transferResult};#{totaltime};#{size};#{error}\"\n end\n end\nend",
"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 add_error(msg)\n @errors << \"#{self.class.get_check_name.capitalize} found a problem with '#{@path.path}': #{msg}\"\n end",
"def record_error (error)\n\n path = get_path(error.fei)\n\n dirpath = File.dirname(path)\n\n FileUtils.mkdir_p(dirpath) unless File.exist?(dirpath)\n\n File.open(path, 'a+') do |f|\n f.puts(error.to_yaml)\n end\n end",
"def save_errors(config)\n # get the location of the config file, we'll use the same dir\n # and base name\n path = \"#{config.config_path}.errors\"\n if @metrics[:failed_list].empty?\n # delete any existing file if we have no errors\n File.delete(path) if File.exist?(path)\n else\n # otherwise save the errors to file\n File.write(path, @metrics[:failed_list].to_yaml)\n end\n end",
"def process_result\n require 'sass'\n\n if @options[:recursive]\n process_directory\n return\n end\n\n super\n input = @options[:input]\n if File.directory?(input)\n raise \"Error: '#{input.path}' is a directory (did you mean to use --recursive?)\"\n end\n output = @options[:output]\n output = input if @options[:in_place]\n process_file(input, output)\n end",
"def checkErrorFile(file, logkey='')\n if File.file?(file)\n Mcmlln::Tools.deleteFile(file)\n else\n logstring = 'n-a'\n end\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def file_patterns_errors_for_spec(spec, file, platform_name)\n Dir.chdir(config.project_pods_root + spec.name ) do\n messages = []\n messages += check_spec_files_exists(spec, :source_files, platform_name, '*.{h,m,mm,c,cpp}')\n messages += check_spec_files_exists(spec, :resources, platform_name)\n messages << \"license[:file] = '#{spec.license[:file]}' -> did not match any file\" if spec.license[:file] && Pathname.pwd.glob(spec.license[:file]).empty?\n messages.compact\n end\n end",
"def process_files(log)\n each_exercise_file do |root, position, original_id, title|\n\n description = markdown(root, 'description') || (log.no_description title; next)\n\n hint = markdown(root, 'hint')\n\n meta = meta(root) || (log.no_meta(title); next)\n\n test_code, test_extension = test_code(root) || (log.no_test title; next)\n\n extra_code, _extra_extension = extra_code(root)\n\n language = language(test_extension) || (log.no_lang(title); next)\n\n expectations = (expectations(root).try { |it| it['expectations'] } || []).map do |e|\n Expectation.new(binding: e['binding'], inspection: e['inspection'])\n end\n\n yield original_id,\n {title: title,\n description: description,\n hint: hint,\n tag_list: meta['tags'],\n locale: meta['locale'],\n language: language,\n expectations: expectations,\n author: @author,\n test: test_code,\n extra_code: extra_code,\n position: position}\n end\n end",
"def make_f3_postfit_shapes_task(channel)\n shape_file = \"results/#{$jobid}/plots/#{channel}/f3/postfit/#{channel}_f3_postfit_shapes.root\"\n carddir = $carddir #makes a copy so that if $cardir changes this does not\n file shape_file => \"#{$carddir}/#{channel}/.pulls_computed\" do |t|\n sh \"mkdir -p `dirname #{t.name}`\"\n sh \"cp #{carddir}/#{channel}/shapes.root #{t.name}\" #FIXME this may create to rake some problems if next command fails!\n sh \"#{ENV['CMSSW_BASE']}/src/HiggsAnalysis/HiggsToTauTau/test/postfit.py #{t.name} #{$carddir}/#{channel}/120/vhtt_#{channel}.txt --verbose --bins #{$categories_map[channel].join(' ')} --fitresults #{$carddir}/#{channel}/120/out/mlfit.txt\"\n end\n return shape_file\nend",
"def load_translations_and_collect_file_errors(files); end",
"def summarize_file(path); end",
"def dev_error_filepath\n \"parse_logs/#{study_file.id}/log.txt\"\n end",
"def output_yaml_errors\n File.open(@options['output-file'], 'w+') do |file|\n file.write YAML.dump(errors)\n end\n end",
"def init_files(input, output)\n can_read?(input)\n\n @output_file = prepare_write_file(output)\n @error_file = prepare_write_file(ERROR_FILE)\n\n @output_file << LineParser::RESULT_HEADER.to_csv\n @error_file << LineParser::ERROR_HEADER.to_csv\n end",
"def run_errored_task(broker, targets, task, files, input: {}, metadata: nil)\n run_task(broker, targets, task, files, input: input, metadata: metadata,\n blocking_request: true,\n expected_response_type: \"http://puppetlabs.com/rpc_error_message\") do |response_dataset|\n response_dataset.each { |data| yield data['description'] } if block_given?\n end\nend",
"def validate_errors validation_errors\n error_tests= {:type=>\"TYPE\", :cardinality=>\"CARDINALITY\", :meta_wrapper=> \"METAWRAPPER\"}\n\n # make sure everything that produced an error was marked appropriately\n validation_errors.each_pair do |name, errs|\n if []== errs then\n assert( name.to_s=~/OK/, \"expected naming 'OK': \\n#{errs.inspect}\")\n else\n assert( !(name.to_s=~/OK/), \"unexpected naming 'OK': \\n#{name} : #{errs.inspect}\")\n errs.each do |er|\n assert_equal Hash, er.class, er.inspect\n assert name == er[:name], er.inspect\n ert= er[:error]\n if error_tests[ert]\n naming_excerpt= error_tests[ert]\t\n assert name.to_s=~/#{naming_excerpt}/, \n \"expected naming_excerpt #{naming_excerpt}: \\n#{er.inspect}\"\n else\n flunk \"unknown error '#{er[:error]}' - #{er.inspect}\"\n end\n end\n # make sure if the name contains an err string then the err is in the array with the same name\n error_tests.each_pair do|ert,naming_excerpt|\n if name.to_s=~/#{naming_excerpt}/ then\n have_this_error_with_name= errs.select{ |er| er[:error]==ert }\n assert( have_this_error_with_name.length>0, \n \"should have an error of '#{ert}' in #{errs.inspect}\\n\" \\\n \"errs:\\n#{errs.report_rmof_errors}\")\n end\n end\n end\n end\n end",
"def run_failed_task(broker, targets, task, files, input: {}, metadata: nil, **kwargs, &block)\n run_task(broker, targets, task, files, input: input, metadata: metadata) do |response_dataset|\n ensure_failed(broker, targets, response_dataset, **kwargs, &block)\n end\nend",
"def validate\n @files.each {|fn| check_file fn}\n end",
"def generate_flux_input_files\n # At the moment we must use subfolders\n for i in 0...n_flux_tubes\n #gs2run = gs2_run(:base).dup\n #gs2_run(i).instance_variables.each do |var|\n #gs2run.instance_variable_set(var, gs2_run(i).instance_variable_get(var))\n #end\n fluxrun = flux_runs[i]\n #ep ['gs2_runs[i] in generate', gs2_runs[i].nwrite]\n #p ['i',i]\n #if i >= n_flux_tubes_jac\n #jn = i - n_flux_tubes_jac + 1\n #run_name = \"calibrate_\" + @run_name + (jn).to_s\n #folder = \"calibrate_#{jn}\"\n #else\n #jn = i + 1\n #run_name = @run_name + (jn).to_s\n #folder = \"flux_tube_#{jn}\"\n #end\n\n folder = flux_folder_name(i)\n run_name = flux_run_name(i)\n\n if @subfolders and @subfolders.fortran_true?\n fluxrun.directory = @directory + \"/\" + folder\n FileUtils.makedirs(fluxrun.directory)\n fluxrun.relative_directory = @relative_directory + \"/\" + folder\n fluxrun.restart_dir = fluxrun.directory + \"/nc\"\n else\n fluxrun.directory = @directory\n fluxrun.relative_directory = @relative_directory\n end\n fluxrun.run_name = run_name\n fluxrun.nprocs = @nprocs\n if i==0\n block = Proc.new{check_parameters}\n else\n block = Proc.new{}\n end\n #if @restart_id\n #gs2run.restart_id =\n Dir.chdir(fluxrun.directory) do\n fluxrun.generate_input_file(&block)\n fluxrun.write_info\n end\n\n ### Hack the input file so that gs2 gets the location of\n # the restart dir correctly within trinity\n if @subfolders and @subfolders.fortran_true? \n infile = fluxrun.directory + \"/\" + fluxrun.run_name + \".in\"\n text = File.read(infile)\n File.open(infile, 'w'){|f| f.puts text.sub(/restart_dir\\s*=\\s*\"nc\"/, \"restart_dir = \\\"#{folder}/nc\\\"\")}\n end\n end\n end",
"def write_error_info\n end",
"def report_st_ops_file_analysis(options)\n $stderr.puts \"st-ops file analysis:\".color(:blue)\n $stderr.puts \"-\" * 40\n st_ops_file_path = Subtitle::OperationsFile.find_latest(\n config.base_dir(:subtitle_operations_dir)\n )\n if st_ops_file_path.nil?\n $stderr.puts \"No st-ops file found, aborting.\".color(:red)\n end\n $stderr.puts \" - Loading st-ops file at #{ st_ops_file_path }\"\n st_ops_for_repository = Subtitle::OperationsForRepository.from_json(\n File.read(st_ops_file_path),\n repository.base_dir\n )\n r = {\n files_count: 0,\n ops_type_counts: Hash.new(0),\n ops_type_signatures: {\n delete: Hash.new(0),\n insert: Hash.new(0),\n merge: Hash.new(0),\n move_left: Hash.new(0),\n move_right: Hash.new(0),\n split: Hash.new(0),\n },\n st_ops_count: 0,\n unexpected_ops: [],\n }\n st_ops_for_repository.operations_for_files.each do |st_ops_for_file|\n r[:files_count] += 1\n # Record ops_type_signatures\n st_ops_for_file.operations.each do |st_op|\n r[:st_ops_count] += 1\n type_signature = st_op.operation_type.to_sym\n r[:ops_type_counts][type_signature] += 1\n ins_del_signature = st_op.affected_stids.map { |e|\n # Mark unchanged/existing st as :noc, added as :add, and deleted as :del\n case ['' == e.tmp_attrs[:before], '' == e.tmp_attrs[:after]]\n when [false, false]\n # No subtitles were added or deleted\n :noc\n when [false, true]\n # before is present, after is blank\n :del\n when [true, false]\n # before is blank, after is present\n :add\n else\n # both before and after are blank. Shouldn't happen!\n raise \"Handle this: #{ st_op.to_hash }\"\n end\n }\n # Record unexpected ops\n if :merge == type_signature && [:noc, :del] != ins_del_signature.uniq\n r[:unexpected_ops] << [\n \"\\nFirst st was deleted in merge:\\n\".color(:red),\n \"File: #{ st_ops_for_file.content_at_file.filename }\",\n st_op.print_pretty,\n ].join(\"\\n\")\n end\n r[:ops_type_signatures][type_signature][ins_del_signature] += 1\n end\n end\n $stderr.puts\n $stderr.puts \" - File count: #{ r[:files_count] }\".color(:blue)\n $stderr.puts \" - Subtitle operations count: #{ r[:st_ops_count] }\".color(:blue)\n\n $stderr.puts \" - Operation signatures:\".color(:blue)\n r[:ops_type_signatures].each { |ops_type, ins_del_signatures|\n $stderr.puts \" - #{ ops_type.inspect }: #{ r[:ops_type_counts][ops_type] }\"\n ins_del_signatures.each { |ins_del_sig, count|\n $stderr.puts \" - #{ ins_del_sig.inspect}: #{ count }\"\n }\n }\n\n $stderr.puts \" - Unexpected operations:\".color(:red)\n r[:unexpected_ops].each { |op| $stderr.puts op }\n end",
"def check_error\n if @errors.empty?\n false\n else\n @log.error(@taskname) { \"--- Configuration for #{@taskname} ---\" }\n @doc.each do |doc|\n @log.error(@taskname) { \"#{doc}\" }\n end\n @log.error(@taskname) { \"--- Errors found for #{@taskname} ---\" }\n @errors.each do |error|\n @log.error(@taskname) { \" #{error}\" }\n end\n @log.fatal(@taskname) { 'terminated' }; exit\n end\n end",
"def user_error_filepath\n \"parse_logs/#{study_file.id}/user_log.txt\"\n end",
"def _validation_errors()\n errors = []\n @tasks.each_value { |t| errors += t._validation_errors() }\n errors\n end",
"def validate_file_patterns\n attributes = DSL.attributes.values.select(&:file_patterns?)\n attributes.each do |attrb|\n patterns = consumer.send(attrb.name)\n if patterns.is_a?(Hash)\n patterns = patterns.values.flatten(1)\n end\n patterns.each do |pattern|\n if pattern.start_with?('/')\n error \"File patterns must be relative and cannot start with a \" \\\n \"slash (#{attrb.name}).\"\n end\n end\n end\n end",
"def validate_shape\n base.validate\n base.errors.collect{|error|\n errors.add_to_base(error.show_message)\n }\n end",
"def split_data_into_files(datafile)\n\n datafiles = []\n output = NIL\n File.open(Rails.root.join(datafile)) do |file| \n counter = 0\n something_was_written = FALSE\n while line = file.gets \n # parse lines and break into different files at #\n if( line.match( /^\\s*\\#+/ ) )\n if (something_was_written && output) \n output.close\n output = NIL\n end\n something_was_written = FALSE\n else \n if (!something_was_written) \n outputfile_name = datafile.gsub(/input/,\"input\" +\n counter.to_s)\n counter +=1\n output = File.open(Rails.root.join(outputfile_name), \"w\") \n datafiles.push((Rails.root.join(outputfile_name)).to_s)\n #datafiles.push( \"../\" + outputfile_name)\n #datafiles.push(Dir.getwd + \"/\" + outputfile_name)\n end\n # check if line matches @n_nodes digits\n nodes_minus_one = (@job.nodes - 1).to_s\n if (line.match( /^\\s*(\\.?\\d+\\.?\\d*\\s+){#{nodes_minus_one}}\\.?\\d+\\.?\\d*\\s*$/ ) ) \n output.puts line\n logger.info \"write line\" + line\n something_was_written = TRUE\n else\n @error_message = \"The data you entered is invalid. This :#{line.chop!}: is not a correct line.\"\n logger.warn \"Error: Input data not correct. This :#{line}: is not a correct line.\"\n return NIL\n end\n end\n end \n file.close\n if (output) \n output.close\n end\n end\n return datafiles\n end",
"def each_step_error(&blk)\n return enum_for(:each_step_error) if blk.nil?\n @errors.each_step_with_path(&blk)\n self\n end",
"def initialize(rfile)\n @errors = []\n @path = rfile\n end",
"def load_error!(msg, path, node)\n line = node.start_line + 1\n column = node.start_column\n raise \"#{path}:#{line}:#{column}: error: #{msg}\"\n end",
"def add_done_files_for_plagiarism_check_of(td, tmp_path, force, to_check)\n tasks = tasks_for_definition(td)\n tasks_with_files = tasks.select { |t| t.has_pdf }\n\n if td.group_set\n # group task so only select one member of each group\n seen_groups = []\n\n tasks_with_files = tasks_with_files.select do |t|\n if t.group.nil?\n result = false\n else\n result = ! seen_groups.include?(t.group)\n if result\n seen_groups << t.group\n end\n end\n result\n end\n end\n\n # check number of files, and they are new\n if tasks_with_files.count > 1 && (tasks.where(\"tasks.file_uploaded_at > ?\", last_plagarism_scan ).select { |t| t.has_pdf }.count > 0 || force )\n td.plagiarism_checks.each do |check|\n next if check[\"type\"].nil?\n\n type_data = check[\"type\"].split(\" \")\n next if type_data.nil? or type_data.length != 2 or type_data[0] != \"moss\"\n\n # extract files matching each pattern\n # -- each pattern\n check[\"pattern\"].split(\"|\").each do |pattern|\n tasks_with_files.each do |t|\n FileHelper.extract_file_from_done(t, tmp_path, pattern, lambda { | task, to_path, name | File.join(\"#{to_path}\", \"#{t.student.username}\", \"#{name}\") } )\n end\n MossRuby.add_file(to_check, \"**/#{pattern}\")\n end\n end\n end\n\n self\n end",
"def define_task_validate(*args)\n desc 'Validate the git urls and branches, refs, or tags'\n task :validate do\n gitvalididation = Ra10ke::Validate::Validation.new(get_puppetfile.puppetfile_path)\n exit_code = 0\n if gitvalididation.bad_mods?\n exit_code = 1\n message = BAD_EMOJI + ' Not all modules in the Puppetfile are valid. '.red + BAD_EMOJI\n else\n message = GOOD_EMOJI + ' Puppetfile looks good. '.green + GOOD_EMOJI\n end\n tp gitvalididation.sorted_mods, :name, { url: { width: 50 } }, :ref, :status\n abort(message) if exit_code.positive?\n puts message\n end\n end",
"def check_files\n @files.each do |f|\n stat = File.stat f rescue next\n raise RDoc::Error, \"file '#{f}' not readable\" unless stat.readable?\n end\n end",
"def test_configfailures\n # create an example file with each of them\n conffile = tempfile\n\n invalidmounts = {\n \"noexist\" => \"[noexist]\n path /this/path/does/not/exist\n allow 192.168.0.*\n\"\n}\n\n invalidconfigs = [\n \"[not valid]\n path /this/path/does/not/exist\n allow 192.168.0.*\n\",\n\"[valid]\n invalidstatement\n path /etc\n allow 192.168.0.*\n\",\n\"[valid]\n allow 192.168.0.*\n\"\n]\n\n invalidmounts.each { |mount, text|\n File.open(conffile, \"w\") { |f|\n f.print text\n }\n\n\n # create a server with the file\n server = nil\n assert_nothing_raised {\n\n server = Puppet::Network::Handler.fileserver.new(\n\n :Local => true,\n\n :Config => conffile\n )\n }\n\n\n assert_raise(\n Puppet::Network::Handler::FileServerError,\n\n \"Invalid mount was mounted\") {\n server.list(mount, :manage)\n }\n }\n\n invalidconfigs.each_with_index { |text, i|\n File.open(conffile, \"w\") { |f|\n f.print text\n }\n\n\n # create a server with the file\n server = nil\n\n assert_raise(\n Puppet::Network::Handler::FileServerError,\n\n \"Invalid config #{i} did not raise error\") {\n\n server = Puppet::Network::Handler.fileserver.new(\n\n :Local => true,\n\n :Config => conffile\n )\n }\n }\n end",
"def check_files_array_format\n error_msg = 'has invalid entries. Each entry must be a hash with the keys of name (String), size (Integer), and '\\\n 'generation (String). The following entries are invalid: '\n has_error = false\n self.files.each do |file|\n unless file.keys.map(&:to_s).sort == %w(generation name size)\n error_msg += \"#{file}\"\n end\n end\n if has_error\n errors.add(:files, error_msg)\n end\n end",
"def checkErrorFile(file, logkey='')\n\tif File.file?(file)\n\t\tMcmlln::Tools.deleteFile(file)\n\telse\n\t\tlogstring = 'n-a'\n\tend\nrescue => logstring\nensure\n\tMcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def process( input )\n if not File.exists?( input )\n puts \"ERROR. #{input} not found.\"\n return\n end\n\n inputPath = File.absolute_path( input )\n\n if File.file?( input )\n flacFile = FlacFile.new inputPath\n flacFile.normalize\n elsif File.directory?( inputPath )\n if not File.symlink?( inputPath )\n processDir inputPath\n end\n end\nend",
"def process()\n @file_info = FileInfoFile.new(@file_info_file)\n @namespace = @file_info.default_namespace\n \n namespaces_file = NamespacesFile.new(@uploads_directory, @scan_only)\n namespaces_file.add_namespace(@namespace)\n namespaces_file.write()\n @prefix = namespaces_file.prefix(@namespace)\n \n create_image_files_where_needed()\n end",
"def test_input_method_raises_error_if_target_does_not_exist\n filename = 'this/file/does/not/Exist.as'\n Crd::Spec.new 'Testing' do |s|\n assert_equal( false, File.exist?( filename ) )\n assert_raise( RuntimeError ) { s.input = filename }\n end\n end",
"def validate_file_patterns\n attributes = DSL.attributes.values.select(&:file_patterns?)\n attributes.each do |attrb|\n patterns = consumer.send(attrb.name)\n if patterns.is_a?(Hash)\n patterns = patterns.values.flatten(1)\n end\n patterns.each do |pattern|\n if pattern.start_with?('/')\n error '[File Patterns] File patterns must be relative ' \\\n \"and cannot start with a slash (#{attrb.name}).\"\n end\n end\n end\n end",
"def add_errors_header_file (file, pattern, error_array)\n ignore_array = get_ignore_error_array(IGNORE_FILE)\n lines = File.read(file)\n lines.gsub! /\\/\\*![^*]*\\*+(?:[^*\\/][^*]*\\*+)*\\//, '' # Remove multi-line comments\n lines.gsub! /\\/\\/.*$/, '' # Remove single-line comments\n lines.each_line do |line|\n line.scan(pattern) do |errorname,errorcode|\n # puts line if DEBUG\n if ! errorname.start_with?(\"LJME_\")\n puts \"Weird errorname: #{errorname}. line: #{line}\"\n end\n error_array << Array[errorcode, errorname] unless ((errorcode.to_i == 0) || (ignore_array.include? errorname))\n end\n end\nend",
"def compare_error_locations_across_files(error1, error2)\n return 1 if error1.file_name.nil?\n return -1 if error2.file_name.nil?\n return error1.file_name <=> error2.file_name if error1.file_name != error2.file_name\n return 1 if error1.location.nil?\n return -1 if error2.location.nil?\n\n error1.location <=> error2.location\n end",
"def fr_error input\n if @calling_command.nil? then\n $stderr.puts input\n else\n @calling_command.stderr = \"#{calling_command.stderr}#{input}\\n\"\n @calling_command.save\n end\n end",
"def consolidate_photo_validations\n\n [:photo_file_name, :photo_file_size, :photo_content_type].each do |name|\n if (err = errors.on(name))\n errors.add(:photo, err)\n break\n end\n end\n \n end",
"def run_it\n run_through_directory\n file_array_parser\n remove_initial_and_format_change\n array_to_hash\n final_name_info\n create_goal_file\nend",
"def dev_format(errors = @output[:raw_data])\n return if errors.blank?\n\n pretty_output = ''\n errors.each do |filename, error_list|\n filename = strip_working_dir(filename)\n pretty_output << \"\\n#{filename.color(:cyan).underline} \\n\"\n error_list.each do |message|\n pretty_output << severity_color(message['severity'])\n pretty_output << \" #{message['line'].to_s.color(:blue)} #{message['linter'].color(:green)}: #{message['reason']} \\n\"\n end\n end\n pretty_output << \"-----\\n\\n\"\n pretty_output\n end",
"def error(*codes, &block)\n path = caller_files[1] || File.expand_path($0)\n result = super\n codes.each do |c|\n watch_element(path, :error, code: c, handler: @errors[c])\n end\n result\n end",
"def validate\n @has_validated = true\n\n unless File.exist?(@commits_path)\n @errors.push(\"#{File.basename(@commits_path)}: does not exist\")\n end\n\n unless File.exist?(@data_path)\n @errors.push(\"#{File.basename(@data_path)}: does not exist\")\n end\n\n # Stop as further validations need to read the files.\n return if @errors.any?\n\n begin\n data_file.peek\n rescue StopIteration\n @errors.push(\"#{File.basename(@data_path)}: has no data to import\")\n return\n end\n\n DataValidator.call(self).each do |error|\n @errors.push(\"#{File.basename(@data_path)}: #{error}\")\n end\n\n CommitsValidator.call(self).each do |error|\n @errors.push(\"#{File.basename(@commits_path)}: #{error}\")\n end\n\n nil\n end",
"def migrate_lots_of_ug_papers(path_to_fox, path_to_foxdone, content_server_url, collection_mapping_doc_path, user)\r\nputs \"doing a bulk migration from \" + path_to_fox\r\n\r\nfname = \"tally.txt\"\r\ntallyfile = File.open(fname, \"a\")\r\nDir.foreach(path_to_fox)do |item|\t\r\n\t# we dont want to try and act on the current and parent directories\r\n\tnext if item == '.' or item == '..'\r\n\t# trackingfile.puts(\"now working on \" + item)\r\n\tputs \"found\" + item.to_s\r\n\titempath = path_to_fox + \"/\" + item\r\n\tresult = 9 # so this wont do the actions required if it isnt reset\r\n\tbegin\r\n\t\tresult = migrate_undergraduate_paper(itempath, content_server_url, collection_mapping_doc_path, user)\r\n\trescue\r\n\t\tresult = 1\t\r\n\t\ttallyfile.puts(\"rescue says FAILED TO INGEST \"+ itempath) \r\n\tend\r\n\tif result == 0\r\n\t\ttallyfile.puts(\"ingested \" + itempath)\r\n\t\t#sleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\t\tFileUtils.mv(itempath, path_to_foxdone + \"/\" + item) # move files once migrated\r\n\telsif result == 1 # this may well not work, as it may stop part way through before it ever gets here. rescue block might help?\r\n\t\ttallyfile.puts(\"FAILED TO INGEST \"+ itempath)\r\n\t\tsleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\telsif result == 2 # apparently some records may not have an actual resource paper of any id!\r\n\t\ttallyfile.puts(\"ingested metadata but NO MAIN RESOURCE DOCUMENT IN \"+ itempath)\r\n\t\t#sleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\telsif result == 3 # couldnt identify parent collection in mappings\r\n\t\ttallyfile.puts(\"FAILED TO INGEST \" + itempath + \" because couldnt identiy parent collection mapping\")\r\n\t\tsleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\telsif result == 4 # this may well not work, as it may stop part way through before it ever gets here. \r\n\t\ttallyfile.puts(\"FAILED TO INGEST RESOURCE DOCUMENT IN\"+ itempath)\r\n\t\tsleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\telse\r\n tallyfile.puts(\" didnt return expected value of 0 or 1 \")\t\r\n\tend\r\nend\r\ntallyfile.close\r\nputs \"all done\"\r\nend",
"def create_copy_file_tasks(source_files, source_root, dest_root, invoking_task)\n source_files.each do |source|\n target = source.pathmap(\"%{#{source_root},#{dest_root}}p\")\n directory File.dirname(target)\n file target => [File.dirname(target), source] do |t|\n cp source, target\n end\n task invoking_task => target\n end\nend",
"def generate_input_file\n @run_name += \"_t\"\n if @restart_id\n @runner.run_list[@restart_id].restart(self)\n else\n make_initial_profiles if self.respond_to?(:make_initial_profiles) \n end\n if uses_ecom?\n setup_ecom\n elsif uses_chease?\n setup_chease\n end\n #eputs \"nwrite 6 is \", new_run.flux_runs[0].nwrite\n @avail_cpu_time = (@wall_mins-1.0) * 60 if @wall_mins\n if flux_gs2? or flux_gryfx?\n @avail_cpu_time = (@wall_mins-6.0) * 60 if @wall_mins\n end\n check_parameters\n write_input_file\n #eputs \"nwrite 7 is \", new_run.flux_runs[0].nwrite\n generate_flux_input_files if flux_gs2? or flux_gryfx?\n #eputs \"nwrite 8 is \", new_run.flux_runs[0].nwrite\n end",
"def mark \n @paths.unshift Proc.new {self.fail!}\n end",
"def run_pxp_errored_task(broker, targets, task, files, input: {}, metadata: nil, &block)\n target_identities = targets.map {|agent| \"pcp://#{agent}/agent\"}\n\n run_task(broker, target_identities, task, input, files, metadata,\n method(:rpc_blocking_request), \"http://puppetlabs.com/rpc_error_message\") do |datas|\n descriptions = datas.map { |data| data[\"description\"] }\n descriptions.each { |description| block.call(description) }\n end\nend",
"def create_rake_files(base_dir)\n\n one_task_fn = File.join(base_dir, 'one_task.rake')\n make_tasks_in_file(['one_task'], one_task_fn) if ok_to_create?(one_task_fn)\n\n another_task_fn = File.join(base_dir, 'another_task.rake')\n make_tasks_in_file(['another_task'], another_task_fn) if ok_to_create?(another_task_fn)\n\n my_tasks_mine_fn = File.join(base_dir, 'my_tasks_all_mine.rake')\n make_tasks_in_file(['task1', 'task2', 'task3', 'task4'], my_tasks_mine_fn, namespace: 'mine') if ok_to_create?(my_tasks_mine_fn)\n\n tasks_run_all_fn = File.join(base_dir, 'other_tasks_run_all.rake')\n make_tasks_in_file(['other_task1_run_me', 'other_task2_run_me', 'other_task3_run_me', 'other_task_not_run_yet'], tasks_run_all_fn) if ok_to_create?(tasks_run_all_fn)\n\n tasks_mixed_duplicates_fn = File.join(base_dir, 'other_tasks_mixed_duplicates.rake')\n make_tasks_in_file(['other_task2_run_me', 'other_task3_run_me'], tasks_mixed_duplicates_fn) if ok_to_create?(tasks_mixed_duplicates_fn)\n\n task2_duplicate_fn = File.join(base_dir, 'task2_duplicate.rake')\n make_tasks_in_file(['task2'], task2_duplicate_fn, namespace: 'mine') if ok_to_create?(task2_duplicate_fn)\n\n task4_duplicate_fn = File.join(base_dir, 'task4_duplicate.rake')\n make_tasks_in_file(['task4'], task4_duplicate_fn, namespace: 'mine') if ok_to_create?(task4_duplicate_fn)\n end",
"def validate\n errors[:filename_no_extension] = filename_no_extension unless filename_no_extension.empty?\n @counts = {\n total_size: object.object_files.map(&:filesize).sum,\n mimetypes: Hash.new(0),\n filename_no_extension: filename_no_extension.count\n }\n object.object_files.each { |obj_file| counts[:mimetypes][obj_file.mimetype] += 1 } # number of files by mimetype\n empty_files = object.object_files.count { |obj_file| obj_file.filesize == 0 }\n errors[:empty_files] = empty_files if empty_files > 0\n if using_file_manifest? # if we are using a file manifest, let's add how many files were found\n batch_id = File.basename(object.container)\n if batch_id && file_manifest.manifest[batch_id]\n manifest_files = file_manifest.manifest[batch_id].fetch(:file_sets, []).flat_map { |_seq, val| val[:files] }\n counts[:files_in_manifest] = manifest_files.count\n relative_paths = object.object_files.map(&:relative_path)\n counts[:files_found] = (manifest_files.pluck(:filename) & relative_paths).count\n errors[:empty_manifest] = true unless counts[:files_in_manifest] > 0\n errors[:files_found_mismatch] = true unless counts[:files_in_manifest] == counts[:files_found]\n else\n errors[:missing_media_container_name_or_manifest] = true\n end\n end\n errors[:wrong_content_structure] = true if object_has_hierarchy? && batch.content_structure != 'file'\n errors[:empty_object] = true unless counts[:total_size] > 0\n errors[:missing_files] = true unless object_files_exist?\n errors[:dupes] = true unless object_filepaths_unique?\n errors.merge!(registration_check)\n self\n end",
"def error\n raise StandardError, 'Error parsing input'\n end",
"def error job, exception\n if tracetop = exception.backtrace&.first\n # Extract the file and line # from the stack top\n tracetop = \" at<br>\" + tracetop.match(/(.*:[\\d]*)/).to_s.if_present || tracetop\n tracetop.sub! Rails.root.to_s+'/', ''\n end\n errors.add :base, exception.to_s+tracetop\n self.status = :bad if processing? # ...thus allowing others to set the status\n end",
"def check_summary_for_errors(summary)\n if summary.has_key?(\"resources\")\n resources = summary[\"resources\"]\n\n failed_to_restart = resources[\"failed_to_restart\"]\n if failed_to_restart.nil?\n @errors << \"failed to restart count not in summary.\"\n elsif failed_to_restart > 0\n @errors << \"#{failed_to_restart} resources failed to restart.\"\n end\n\n failed = resources[\"failed\"]\n if failed.nil?\n @errors << \"failed resources count not in summary.\"\n elsif failed > 0\n @errors << \"#{failed} failed resources.\"\n end\n\n total = resources[\"total\"]\n # this happens when execution expired sometimes. \n if total.nil?\n @errors << \"total resources count not in summary.\"\n elsif total == 0\n @errors << \"there were zero total resources in the run summary, which suggests something went wrong.\"\n end \n else\n @errors << \"no resources information.\"\n end\n\n # failure events are usually failed resourced, but sometimes aren't.\n # we record these if there aren't already failed resources.\n if summary.has_key?(\"events\")\n failure = summary[\"events\"][\"failure\"]\n if failure.nil?\n @errors << \"no failure count in summary events.\"\n elsif failure > 0 and failed == 0\n @errors << \"#{failure} failure events.\"\n end\n else\n @errors << \"no events in summary.\"\n end\n\n @errors.length\n end",
"def errors=(_); end",
"def check_errors\n unless valid? \n bigmessage = self.errors.full_messages.join \"\\n\" \n raise bigmessage unless bigmessage.empty?\n \n raise \"format should not be nil\" if format.nil?\n raise \"invalid format #{format}\" unless format.valid? \n raise \"#{self.errors.to_a}, error encountered while saving #{@datafile_id}, #{@bitstream_id} \" \n end\n end",
"def create_image_files_where_needed()\n @file_info.data.each do |line|\n uri, filename = line\n process_file_info(uri, filename)\n end\n end",
"def errorfile(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"errorfile \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end",
"def parse_input_files\n ids = params[:interface_userfile_ids]\n ids.each do |id|\n u = Userfile.find(id) rescue nil\n cb_error \"Error: input file #{id} doesn't exist.\" unless u\n cb_error \"Error: '#{u.name}' does not seem to be a single file.\" unless u.is_a?(SingleFile)\n cb_error \"Error: found a #{u.type}. \\n #{usage}\" unless ( u.is_a?(CSVFile) || u.is_a?(FSLDesignFile) || u.name.end_with?(\".csv\") || u.name.end_with?(\".fsf\"))\n if u.is_a?(FSLDesignFile) || u.name.end_with?(\".fsf\")\n cb_error \"Error: you may select only 1 design file. \\n #{usage}\" unless params[:design_file_id].nil?\n params[:design_file_id] = id\n end\n if u.is_a?(CSVFile) || u.name.end_with?(\".csv\")\n cb_error \"Error: you may select only 1 CSV file. \\n #{usage}\" unless params[:csv_file_id].nil?\n params[:csv_file_id] = id\n end\n end\n cb_error \"Error: design file missing. \\n #{usage}\" if params[:design_file_id].nil?\n cb_error \"Error: CSV file missing. \\n #{usage}\" if params[:csv_file_id].nil?\n end"
] |
[
"0.713875",
"0.5739326",
"0.56185156",
"0.53063333",
"0.52506006",
"0.5243376",
"0.5230361",
"0.5130129",
"0.51293904",
"0.51293904",
"0.51293904",
"0.5126742",
"0.50969017",
"0.5093162",
"0.50008947",
"0.49912214",
"0.49550954",
"0.49535787",
"0.49491897",
"0.49491897",
"0.49491897",
"0.4942321",
"0.49386472",
"0.49386472",
"0.4929346",
"0.49218866",
"0.49135196",
"0.4911386",
"0.49081156",
"0.49031374",
"0.48974717",
"0.48780027",
"0.48530772",
"0.48454884",
"0.48442775",
"0.4843593",
"0.482724",
"0.48109898",
"0.48034787",
"0.47997576",
"0.47917143",
"0.4789669",
"0.47698945",
"0.47664595",
"0.47555372",
"0.47494653",
"0.4745789",
"0.47369733",
"0.47311765",
"0.47283855",
"0.4719487",
"0.47181708",
"0.4717607",
"0.4715095",
"0.4710036",
"0.47011206",
"0.469135",
"0.46784475",
"0.4658197",
"0.46508104",
"0.4639168",
"0.46352917",
"0.46270788",
"0.46240833",
"0.46228862",
"0.4621786",
"0.46166947",
"0.46114278",
"0.46095344",
"0.4609438",
"0.46016705",
"0.4593684",
"0.45914435",
"0.45787713",
"0.45770597",
"0.457518",
"0.4574981",
"0.45649937",
"0.45405826",
"0.45362872",
"0.4533783",
"0.45198816",
"0.451936",
"0.45183715",
"0.45174205",
"0.45134038",
"0.4512028",
"0.45044187",
"0.45034552",
"0.45003036",
"0.44943184",
"0.4492537",
"0.44809487",
"0.44754642",
"0.44729158",
"0.44667742",
"0.44620073",
"0.4457561",
"0.44494683",
"0.4449424"
] |
0.69926775
|
1
|
cardmasses.each do |mass| task :cards => make_datacard_task(mass, 'mmt') task :cards => make_datacard_task(mass, 'emt') task :cards => make_datacard_task(mass, 'eet') task :cards => combine_channels(mass) task :cards => make_datacard_task(mass, 'llt', '') end Recipes to make limits targets: limit_mmt limit_emt limit_eet limit_llt limits
|
def make_limit_task(channel)
limit_timestamp = "#{$carddir}/#{channel}/.limits_computed"
carddir = $carddir #makes a copy so that if $cardir changes this does not
file limit_timestamp => "#{$carddir}/#{channel}/.creation_timestamp" do |t|
chdir("#{carddir}/#{channel}") do
sh "ls -d [0-9]* | xargs -n 1 -P 10 -I {} compute_significance.sh {} #{$blind}"
end
sh "compute_limits.sh #{carddir}/#{channel} 10 #{$blind}"
end
return limit_timestamp
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_todoist_tasks(cards)\n cards = filter_tasks(cards)\n if cards\n cards.each do |card|\n create_todoist_task(card.name, false, card.id)\n create_subtasks(card)\n end\n end\n end",
"def make_json_limit_task(channel)\n samples_map = Hash['mmt' => 'data_DoubleMu', \n 'eet' => 'data_DoubleElectron', \n 'emt' => 'data_MuEG',\n 'llt' => 'data_DoubleMu',\n ]\n carddir = $carddir #makes a copy so that if $cardir changes this does not\n json_stamp = \"#{$carddir}/#{channel}/.limit_harvested\"\n file json_stamp => \"#{$carddir}/#{channel}/.limits_computed\" do |t|\n sh \"harvest_limits.py #{carddir}/#{channel}\"\n sh \"touch #{t.name}\"\n sh \"add_tag_to_json.py #{carddir}/#{channel}/*.json -l jobid -t #{$jobid}\"\n sh \"add_tag_to_json.py #{carddir}/#{channel}/*.json -l lumi -t #{get_lumi(samples_map[channel], $jobid)}\"\n end\n return json_stamp\nend",
"def create_subtasks(card)\n #if card.checklists\n # task_item = Cards.get_first_unchecked_item(card.checklists.first.check_items) \n #end \n end",
"def run\n super\n \n # Grab options\n masscan_options = @options['masscan_options']\n \n ports = [ \"U:162\",\"U:49152\",\"U:514\",\"U:4500\",\"25\",\"U:1900\",\"U:520\",\n \"U:500\",\"22\",\"U:139\",\"21\",\"443\",\"U:53\",\"23\",\n \"U:67\",\"U:135\",\"U:445\",\"U:1434\",\"U:123\",\"U:137\",\n \"U:161\",\"U:631\",\"80\",\"U:111\",\"3389\",\"U:4500\"]\n \n ports.each do |port|\n # Write the range to a path\n @output_path = \"#{Dir::tmpdir}/masscan_output_#{rand(100000000)}.temp\"\n\n # shell out to binary and run the scan\n @task_logger.log \"scanning #{@entity.range}\" \n @task_logger.log \"masscan options: #{masscan_options}\"\n \n masscan_string = \"sudo masscan -p #{port} #{@entity.range} > #{@output_path}\" \n @task_logger.log \"calling masscan: #{masscan_string}\"\n safe_system(masscan_string)\n \n # Gather the output and parse\n @task_logger.log \"Raw Result:\\n #{File.open(@output_path).read}\"\n @task_logger.log \"Parsing #{@output_path}\"\n\n f = File.open(@output_path).each_line do |host_string|\n host_string = host_string.delete(\"\\n\").strip unless host_string.nil?\n host = host_string.split(\" \").last\n\n \n proto = \"tcp\"\n if port =~ /^U/\n port = port.split(\":\").last\n proto = \"udp\"\n end\n\n # Create entity for each discovered host + service\n @host_entity = create_entity(Entities::Host, {:name => host })\n create_entity(Entities::NetSvc, {\n :name => \"#{host}:#{port}/tcp\",\n :host_id => @host_entity.id,\n :port_num => port,\n :proto => proto,\n :fingerprint => \"masscanned\"})\n end\n end\nend",
"def description\n \"This task runs a masscan scan for the top ports on the target range.\"\nend",
"def plan(tasks)\n\t\t\ttasks.each do |day,task|\n\t\t\t puts \"#{day}, we must complete the #{task}\"\n\t\t\tend\n\t\t\tputs \"I'm the Boss! No one must do anything without my knowledge!\"\n\t\tend",
"def process_foreach(options, filter, vars)\n agent = rpcclient('rpcutil')\n set_filter(agent, filter, vars)\n nodes = agent.discover\n nodes.each do |node|\n options['tasks'].each do |task|\n vars.merge!('node' => node)\n process_task(task, {:discovery => [node]}, vars)\n end\n end\nend",
"def make_cards\n #14 restuarants\n scrape_cards.each do |res|\n binding.pry\n ResInfo::Restaurant.new_from_scraper(res)\n end\n end",
"def index\n\n @tasks = Card.where(authorization_id: Authorization.current_id).find(params[:card_id]).tasks\n end",
"def tasks() []; end",
"def task()\n world = Robota::World\n world.read_world(\"../karel/empty.map\")\n \n karel = Question3.new(1, 1, Robota::NORTH, 1)\n karel2 = Question3.new(6, 1, Robota::EAST, 0)\n karel3 = Question3.new(6, 6, Robota::SOUTH, 0)\n karel4 = Question3.new(1, 6, Robota::WEST, 0)\n karel.put_beeper\n karel.run\n karel2.run\n karel3.run\n karel4.run\n karel4.run\n karel.run\n karel2.run\n karel3.run\n karel3.run\n karel4.run\n karel.run\n karel2.run\n karel2.run\n karel3.run\n karel4.run\n karel.run\n \n \nend",
"def question_cards\n template = @generation.question_card.question_card\n @cards = @generation.variants.map do |v|\n card = template.gsub('$V', v.number.to_s)\n\n doc = Nokogiri::HTML(card)\n doc.css('.task').each do |task|\n task.inner_html = generate_task_text( v.generated_tasks.find_by(task_in_card: task[:id].to_i) )\n end\n doc.to_html\n end\n\n respond_to do |format|\n format.html { render layout: false }\n format.pdf do\n orientation = params[:orientation] ? 'Portrait' : 'Landscape'\n render pdf: \"question_card\", # Excluding \".pdf\" extension.\n orientation: orientation\n end\n end\n end",
"def distribute_cards\n i=0\n while @players[0].cards.length != 8\n @players.each do |player|\n card = select_card\n @trump_card = card if @cards.length == 25\n player.cards.push(card)\n\n if(player.id.to_i==1)\n elsif(player.id.to_i==2)\n @machine.children() << Tree.new(card.value.to_s,card.type.to_s)\n # puts @machine.children[0].type.to_s\n elsif(player.id.to_i==3)\n\n elsif(player.id.to_i==4)\n\n elsif(player.id.to_i==5)\n\n end\n\n end\n\n end\n end",
"def schedule_task taskname, feature\r\n file_momonga = \"#{RELEASE_DIRECTORY}momonga.#{taskname}.js\"\r\n file_release = \"#{RELEASE_DIRECTORY}AzureaVim#{taskname === 'default' ? '' : '.' + taskname}.js\"\r\n feature.each do |key, value|\r\n \r\n task \"#{taskname}__#{key}\" => value.collect{|item| \"#{taskname}__#{item}\"} do |tsk|\r\n puts \"#{file_momonga} << #{key}\"\r\n open file_momonga, 'a' do |momonga_js|\r\n open(\"../src/#{key}.js\"){|key_js| momonga_js.puts key_js.read}\r\n end\r\n end\r\n \r\n end\r\n \r\n desc file_momonga\r\n task \"momonga_#{taskname}\" => feature.keys.collect{|item| \"#{taskname}__#{item}\"} do\r\n paste_parts file_momonga, taskname\r\n end\r\n \r\n desc file_release\r\n task \"build_#{taskname}\" => \"momonga_#{taskname}\" do |tsk|\r\n compile_js file_momonga, file_release\r\n write_metainfo file_release\r\n end\r\n \r\n $DEBUG_TASKS.push \"momonga_#{taskname}\"\r\n $RELEASE_TASKS.push \"build_#{taskname}\"\r\n CLEAN.include file_momonga\r\n CLOBBER.include file_release\r\nend",
"def createDeck\n\t\t10.times do |f|\n\t\t\t@deck.push(Card.new(5, 5, 5, '5 cost minion'))\n\t\tend\n\t\t10.times do |f|\n\t\t\t@deck.push(Card.new(2, 2, 2, '2 cost minion'))\n\t\tend\n\t\t10.times do |f|\n\t\t\t@deck.push(Card.new(1, 1, 1, '1 cost minion'))\n\t\tend\t\t\n\t\t@deck.shuffle!\t\n\tend",
"def task_e2c(task)\n\n case task\n when 'vat_jan'\n '1~2月營業稅'\n when 'vat_mar'\n '3~4月營業稅'\n when 'vat_may'\n '5~6月營業稅'\n when 'vat_jul'\n '7~8月營業稅'\n when 'vat_sept'\n '9~10月營業稅'\n when 'vat_nov'\n '11~12月營業稅'\n when 'voucher'\n '扣繳憑單申報'\n when 'income_tax'\n '結算申報'\n else\n '###'\n end\n end",
"def make_tasks\n make_clean_task\n make_wix_folder_task\n make_copy_file_tasks\n make_sourcery_wxs_file_task\n make_sourcery_wixobj_file_task\n make_product_wxs_file_task\n make_product_wixobj_file_task\n make_msi_file_task\n make_msi_task\n make_test_task\n end",
"def process_task(options, filter, vars)\n printtitle(options['name']) if options['name']\n filter = options['filter'] || filter\n case\n when options['foreach_node']\n process_foreach(options['foreach_node'], filter, vars)\n when options['tasks']\n options['tasks'].each do |task|\n process_task(task, filter, vars)\n end\n when options['action']\n process_action(options, filter, vars)\n end\nend",
"def description\n \"This task converts a netblock into host records\"\nend",
"def filter_tasks(cards)\n cards = Array(cards) unless cards.respond_to?(:count)\n return cards.select { |card| Task.first(:name => card.name).nil? } #TODO: move this to method with descriptive name\n end",
"def make_cards_by_set(file)\n data = json_to_hash(\"data/#{file}\")\n card_params = {}\n sett = Sett.find_by_name(data.first[1])\n data[\"cards\"].each do |card|\n card_params[\"artist\"] = card[\"artist\"]\n card_params[\"mtg_json_id\"] = card[\"id\"]\n card_params[\"cmc\"] = card[\"cmc\"]\n card_params[\"color_identity\"] = card[\"colorIdentity\"]\n card_params[\"colors\"] = card[\"colors\"]\n card_params[\"flavor\"] = card[\"flavor\"]\n card_params[\"image_name\"] = card[\"imageName\"]\n card_params[\"layout\"] = card[\"layout\"]\n card_params[\"mana_cost\"] = card[\"manaCost\"]\n card_params[\"names\"] = card[\"names\"]\n card_params[\"number\"] = card[\"mciNumber\"]\n card_params[\"multiverse_id\"] = card[\"multiverseId\"]\n card_params[\"name\"] = card[\"name\"]\n card_params[\"power\"] = card[\"power\"]\n card_params[\"rarity\"] = card[\"rarity\"]\n card_params[\"subtypes\"] = card[\"subtypes\"]\n card_params[\"text\"] = card[\"text\"]\n card_params[\"toughness\"] = card[\"toughness\"]\n card_params[\"type\"] = card[\"type\"]\n card_params[\"types\"] = card[\"types\"]\n card_params[\"plaintext_name\"] = ActiveSupport::Inflector.transliterate(card[\"name\"].downcase.gsub(/[^a-z0-9\\s\\\"]/i, ''))\n card = Card.create(card_params)\n sett.cards << card\n card.update_attributes(image: card.make_pic_url, setname: card.sett.name)\n end\n end",
"def create_deck(number)\n deck = []\n deck_cards = []\n number.times do\n deck_cards << CARDS\n end\n deck_cards.flatten!\n deck = deck_cards.product(SUITES)\nend",
"def with_c3_task(task)\n return [task] unless task.product_test.product.c3_test\n\n case task\n when C1Task\n return [task, task.product_test.tasks.c3_cat1_task] if task.product_test.c3_cat1_task?\n when C2Task\n return [task, task.product_test.tasks.c3_cat3_task] if task.product_test.c3_cat3_task?\n end\n [task]\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n #use the built-in error checking\n if not runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n #assign the user inputs to variables\n eff = runner.getDoubleArgumentValue(\"eff\",user_arguments)\n\n #check the user_name for reasonableness\n if eff <= 0\n runner.registerError(\"Please enter a positive value for Nominal Thermal Efficiency.\")\n return false\n end\n if eff > 1\n runner.registerWarning(\"The requested Nominal Thermal Efficiency must be <= 1\")\n end\n \n #change the efficiency of each boiler\n #loop through all the plant loops in the mode\n model.getPlantLoops.each do |plant_loop|\n #loop through all the supply components on this plant loop\n plant_loop.supplyComponents.each do |supply_component|\n #check if the supply component is a boiler\n if not supply_component.to_BoilerHotWater.empty?\n boiler = supply_component.to_BoilerHotWater.get\n #set the efficiency of the boiler\n boiler.setNominalThermalEfficiency(eff)\n runner.registerInfo(\"set boiler #{boiler.name} efficiency to #{eff}\")\n end\n end\n end\n \n \n=begin \n initial_effs = []\n missing_initial_effs = 0\n\n #find and loop through air loops\n air_loops = model.getAirLoopHVACs\n air_loops.each do |air_loop|\n supply_components = air_loop.supplyComponents\n\n #find two speed dx units on loop\n supply_components.each do |supply_component|\n dx_unit = supply_component.to_CoilCoolingDXTwoSpeed\n if not dx_unit.empty?\n dx_unit = dx_unit.get\n\n #change and report high speed cop\n initial_high_cop = dx_unit.ratedHighSpeedCOP\n if not initial_high_cop.empty?\n runner.registerInfo(\"Changing the Rated High Speed COP from #{initial_high_cop.get} to #{cop_high} for two speed dx unit '#{dx_unit.name}' on air loop '#{air_loop.name}'\")\n initial_high_cop_values << initial_high_cop.get\n dx_unit.setRatedHighSpeedCOP(cop_high)\n else\n runner.registerInfo(\"Setting the Rated High Speed COP to #{cop_high} for two speed dx unit '#{dx_unit.name}' on air loop '#{air_loop.name}. The original object did not have a Rated High Speed COP value'\")\n missing_initial_high_cop = missing_initial_high_cop + 1\n dx_unit.setRatedHighSpeedCOP(cop_high)\n end\n\n #change and report low speed cop\n initial_low_cop = dx_unit.ratedLowSpeedCOP\n if not initial_low_cop.empty?\n runner.registerInfo(\"Changing the Rated Low Speed COP from #{initial_low_cop.get} to #{cop_low} for two speed dx unit '#{dx_unit.name}' on air loop '#{air_loop.name}'\")\n initial_low_cop_values << initial_low_cop.get\n dx_unit.setRatedLowSpeedCOP(cop_low)\n else\n runner.registerInfo(\"Setting the Rated Low Speed COP to #{cop_low} for two speed dx unit '#{dx_unit.name}' on air loop '#{air_loop.name}. The original object did not have a Rated Low Speed COP COP value'\")\n missing_initial_low_cop = missing_initial_low_cop + 1\n dx_unit.setRatedLowSpeedCOP(cop_low)\n end\n\n end #end if not dx_unit.empty?\n\n end #end supply_components.each do\n\n end #end air_loops.each do\n\n #reporting initial condition of model\n runner.registerInitialCondition(\"The starting Rated High Speed COP values range from #{initial_high_cop_values.min} to #{initial_high_cop_values.max}. The starting Rated Low Speed COP values range from #{initial_low_cop_values.min} to #{initial_low_cop_values.max}.\")\n\n #warning if two counts of cop's are not the same\n if not initial_high_cop_values.size + missing_initial_high_cop == initial_low_cop_values.size + missing_initial_low_cop\n runner.registerWarning(\"Something went wrong with the measure, not clear on count of two speed dx objects\")\n end\n\n if initial_high_cop_values.size + missing_initial_high_cop == 0\n runner.registerAsNotApplicable(\"The model does not contain any two speed DX cooling units, the model will not be altered.\")\n return true\n end\n\n #reporting final condition of model\n runner.registerFinalCondition(\"#{initial_high_cop_values.size + missing_initial_high_cop} two speed dx units had their High and Low speed COP values set to #{cop_high} for high, and #{cop_low} for low.\")\n=end\n return true\n\n end",
"def call\n cube = []\n\n deck = Deck.find(context.deck_id)\n\n deck.card_decks.each do |card_deck|\n (1..card_deck.occurences_in_main_deck).each do\n cube.push(card_deck.card_id)\n end\n end\n\n tirages = []\n # reste = []\n\n while cube.length > 14\n tirage = cube.sample(15)\n tirage.each do |card_id|\n cube.delete_at(cube.find_index(card_id))\n end\n tirages.push(tirage)\n end\n context.tirages = tirages\n # reste = cube\n end",
"def make_limit_task(channel)\n limit_timestamp = \"#{$carddir}/#{channel}/.limits_computed\"\n file limit_timestamp => \"#{$carddir}/#{channel}/.creation_timestamp\" do |t|\n sh \"compute_limits.sh #{$carddir}/#{channel} 10 #{$blind}\"\n end\n return limit_timestamp\nend",
"def sdrm_rt_bulk(sequences, cutoff = 0, temp_r_dir = File.dirname($0))\n region = \"RT\"\n rf_label = 1\n start_codon_number = 34\n gap = \"AGACTTCAGGAAGTATACTGCATTTACCATACCTAGTATAAACAATGAGACACCAGGGATTAGATATCAGTACAATGTGCTTCCAC\"\n\n n_seq = sequences.size\n mut_nrti = {}\n mut_nnrti = {}\n mut_com = []\n r1_aa = {}\n r2_aa = {}\n point_mutation_list = []\n sequences.each do |name,seq|\n r1 = seq[0,267]\n r2 = seq[267..-1]\n seq = r1 + gap + r2\n s = Sequence.new(name,seq)\n s.get_aa_array(rf_label)\n aa_seq = s.aa_array\n\n r1_aa[name] = aa_seq[0,89].join(\"\")\n r2_aa[name] = aa_seq[-85..-1].join(\"\")\n nrti = sdrm_nrti(aa_seq,start_codon_number)\n nnrti = sdrm_nnrti(aa_seq,start_codon_number)\n mut_com << (nrti.merge(nnrti))\n\n nrti.each do |position,mutation|\n if mut_nrti[position]\n mut_nrti[position][1] << mutation[1]\n else\n mut_nrti[position] = [mutation[0],[]]\n mut_nrti[position][1] << mutation[1]\n end\n end\n nnrti.each do |position,mutation|\n if mut_nnrti[position]\n mut_nnrti[position][1] << mutation[1]\n else\n mut_nnrti[position] = [mutation[0],[]]\n mut_nnrti[position][1] << mutation[1]\n end\n end\n end\n\n mut_nrti.each do |position,mutation|\n wt = mutation[0]\n mut_list = mutation[1]\n count_mut_list = count(mut_list)\n count_mut_list.each do |m,number|\n ci = r_binom_CI(number, n_seq, temp_r_dir)\n label = number < cutoff ? \"*\" : \"\"\n point_mutation_list << [\"NRTI\", n_seq, position, wt, m, number, (number/n_seq.to_f).round(5), ci[0], ci[1], label]\n end\n end\n\n mut_nnrti.each do |position,mutation|\n wt = mutation[0]\n mut_list = mutation[1]\n count_mut_list = count(mut_list)\n count_mut_list.each do |m,number|\n ci = r_binom_CI(number, n_seq, temp_r_dir)\n label = number < cutoff ? \"*\" : \"\"\n point_mutation_list << [\"NNRTI\", n_seq, position, wt, m, number, (number/n_seq.to_f).round(5), ci[0], ci[1], label]\n end\n end\n point_mutation_list.sort_by! {|record| record[2]}\n\n link = count(mut_com)\n link2 = {}\n link.each do |k,v|\n pattern = []\n if k.size == 0\n pattern = ['WT']\n else\n k.each do |p,m|\n pattern << (m[0] + p.to_s + m[1])\n end\n end\n link2[pattern.join(\"+\")] = v\n end\n linkage_list = []\n link2.sort_by{|_key,value|value}.reverse.to_h.each do |k,v|\n ci = r_binom_CI(v, n_seq, temp_r_dir)\n label = v < cutoff ? \"*\" : \"\"\n linkage_list << [region, n_seq, k, v, (v/n_seq.to_f).round(5), ci[0], ci[1], label]\n end\n\n report_list = []\n\n div_aa = {}\n r1_aa_start = 34\n r2_aa_start = 152\n\n r1_aa_size = r1_aa.values[0].size - 1\n r2_aa_size = r2_aa.values[0].size - 1\n\n (0..r1_aa_size).to_a.each do |p|\n aas = []\n r1_aa.values.each do |r1|\n aas << r1[p]\n end\n count_aas = count(aas)\n div_aa[r1_aa_start] = count_aas.sort_by{|_k,v|v}.reverse.to_h\n r1_aa_start += 1\n end\n\n (0..r2_aa_size).to_a.each do |p|\n aas = []\n r2_aa.values.each do |r1|\n aas << r1[p]\n end\n count_aas = count(aas)\n div_aa[r2_aa_start] = count_aas.sort_by{|k,v|v}.reverse.to_h\n r2_aa_start += 1\n end\n\n div_aa.each do |k,v|\n record = [region, k, n_seq]\n $amino_acid_list.each do |amino_acid|\n aa_count = v[amino_acid]\n record << (aa_count.to_f/n_seq*100).round(4)\n end\n report_list << record\n end\n\n return [point_mutation_list, linkage_list, report_list]\nend",
"def task_c2e(task)\n\n case task\n when '1~2月營業稅'\n 'vat_jan'\n when '3~4月營業稅'\n 'vat_mar'\n when '5~6月營業稅'\n 'vat_may'\n when '7~8月營業稅'\n 'vat_jul'\n when '9~10月營業稅'\n 'vat_sept'\n when '11~12月營業稅'\n 'vat_nov'\n when '扣繳憑單申報'\n 'voucher'\n when '結算申報'\n 'income_tax'\n else\n redirect_to '/'\n end\n end",
"def group_matter_team_tasks(col)\n total_data,table_headers,conditions,data,total_tasks = {},{},{:users => {}},[],0\n \n method = use_method\n col.each do |matter|\n matter.matter_tasks.each do|task_obj|\n next unless params[:report][:task_type] != \"All\" ? task_obj.client_task : true\n date = task_obj.send(task_obj.category == \"todo\" ? \"end_date\": \"start_date\")\n next unless check_task_status(task_obj.completed,date)\n next unless self.send(method,date)\n total_tasks += 1\n next unless task_obj.matter_people && task_obj.matter_people.assignee\n unless conditions[:users].has_key?(task_obj.matter_people.assignee.id)\n conditions[:users][task_obj.matter_people.assignee.id] = task_obj.matter_people.assignee.try(:full_name).try(:titleize)\n end\n data << [matter.matter_no,matter.name,matter.contact ? matter.contact.name : \"\",matter.contact ? matter.contact.get_account ? matter.contact.get_account.name : \"None\" : \"\",task_obj.name ,task_obj.end_date.strftime('%m/%d/%y'),task_obj.completed ? \"Closed\" : (date < Time.zone.now.to_date) ? \"Overdue\" : \"Open\",task_obj.client_task ? \"Yes\" : \"No\",task_obj.matter_people.assignee.id]\n end\n end\n data.each do|matter|\n key = matter.pop\n if total_data.has_key?(key)\n total_data[key] << matter\n else\n total_data[key] = [matter]\n end\n end\n conditions[:total_tasks] = total_tasks\n column_widths = {0=> 60,1=> 140,2=> 120,3=> 90,4=> 70,5=> 60,6=> 50,7=> 70}\n alignment={0=>:center,1=>:left,2=>:left,3=>:left,4=>:left,5=>:center,6=>:center,7=>:center} if params[:format] == \"pdf\"\n table_headers = [t(:label_matter_id),t(:label_matter),t(:text_client),\"#{t(:label_Account)}\",t(:text_activity_name),t(:text_due_date),t(:text_status),\"#{t(:label_client)}#{t(:text_activity)}\"]\n [total_data,table_headers,conditions,column_widths,alignment]\n end",
"def perform(*args)\n user_id, task_id, task_type, empirical_value, obi, from = args[0][0][0], args[0][0][1], args[0][0][2], args[0][0][3], args[0][0][4], args[0][0][5]\n empirical_value = empirical_value.to_i\n obi = obi.to_i\n user = Core::User.find_by(id: user_id)\n return p \"#{Time.now}————————>error---------------->用户不对!\" unless user.present?\n size = Core::TaskAward.where(user_id: user_id, task_type: task_type).where(\"created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size\n case task_type\n when 'Shop::DynamicComment'\n if size <= 50\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from )\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n comment = Shop::DynamicComment.find_by(id: task_id)\n comment.dynamic.topic.shop_task.get_obi user\n comment.dynamic.topic.shop_task.increment!(:participants)\n when 'Shop::VoteResult'\n if size <= 50\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from )\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n vote_result = Shop::VoteResult.find_by(id: task_id)\n vote_result.resource.topic.shop_task.get_obi user\n vote_result.resource.topic.shop_task.increment!(:participants)\n when 'Shop::TopicDynamic'\n topic = Shop::TopicDynamic.find_by(id: task_id).topic\n if from.match(/._share/)\n topic.shop_task.share_state[\"#{Shop::Topic}:#{user.id}\"] += 1\n share_size = Core::TaskAward.where(user_id: user_id, task_type: task_type).where(\"`from` like '%_share' AND created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size #分享次数\n\n if share_size < 20\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from)\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n end\n #创建动态\n create_size = Core::TaskAward.where(user_id: user_id, task_type: task_type, from: \"create_topic_dynamic\").where(\"created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size\n #点赞\n like_size = Core::TaskAward.where(user_id: user_id, task_type: task_type, from: \"self\").where(\"created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size\n #被别人点赞次数\n liked_size = Core::TaskAward.where(user_id: user_id, task_type: task_type, from: \"other\").where(\"created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size\n\n if (from == 'self' && like_size <= 5) || (from == 'other' && liked_size <= 50) || from == 'create_topic_dynamic' && create_size <= 5\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from )\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n if from == 'self' || from == \"create_topic_dynamic\"\n topic.shop_task.get_obi user\n topic.shop_task.increment!(:participants)\n end\n when 'Shop::Comment'\n if size <= 50\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from )\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n comment = Shop::Comment.find_by(id: task_id)\n comment.task.shop_task.get_obi user\n comment.task.shop_task.increment!(:participants)\n when 'Shop::FundingOrder'\n if size <= 50\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from )\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n order = Shop::FundingOrder.find_by(id: task_id)\n task = order.owhat_product.shop_task\n #task.increment!(:participants)\n task.get_obi(user)\n when 'Shop::Order'\n if size <= 50\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from)\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n order = Shop::Order.find_by(id: task_id)\n order.order_items.each do |item|\n #item.owhat_product.shop_task.increment!(:participants)\n item.owhat_product.shop_task.get_obi(user)\n end\n when 'Core::User', 'Core::Star', 'Qa::Poster', \"Shop::Event\", \"Shop::Product\", \"Shop::Topic\", \"Shop::Media\", \"Shop::Subject\", \"Shop::Funding\"\n if from.match(/._share/)\n if task_type != 'Core::User' && task_type != 'Core::Star'\n task = eval(task_type).find_by(id: task_id).shop_task\n task.share_state[\"#{task.shop_type}:#{user.id}\"] += 1\n task.get_obi(user, type: 'share')\n end\n share_size = Core::TaskAward.where(user_id: user_id, task_type: task_type).where(\"`from` like '%_share' AND created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size\n if share_size < 20\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from)\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n else\n #发任务暂时不送O元 包含媒体任务参与 打卡任务\n if task_type != 'Core::User' && task_type != 'Core::Star'\n task = eval(task_type).find_by(id: task_id).shop_task\n task.get_obi user\n task.increment!(:participants)\n end\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from)\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n end\n\n level, obi = user.update_obi_and_empirical_value(user.empirical_value, user)\n unless user.level == level\n Core::TaskAward.create(user_id: user_id, task_id: user.id, task_type: user.class, empirical_value: 0, obi: (obi - user.obi), from: 'level_up')\n user.update(level: level, obi: obi)\n end\n end",
"def create_52_card_deck\n\n end",
"def generate_demands\n\t\n\t\tcase @inputs.generation_method\n\t\twhen 'Centroïd'\n\t\t\n\t\t\tnbCreatedDemands = 1\n\t\t\t(1..@inputs.nb_demands).each do |idDemand|\n\t\t\t\t\n\t\t\t\t# Find a time\n\t\t\t\trt = generate_random_time\n\t\t\t\t\n\t\t\t\t# Find 2 stations for that time\n\t\t\t\tstation_O, station_D = pickTwoStations(rt)\n\t\t\t\t\n\t\t\t\t# Demand creation\n\t\t\t\ttravelTime = calculate_TravelTime_TS(station_O, station_D, rt)\n\t\t\t\tarrivalTime = (rt + travelTime) % @nbTSInOneDay \n\t\t\t\t\n\t\t\t\tdemandAlreadyExists = false\n\t\t\t\t@list_demands.each do |d| # if the demand already exists, just increase its internal demand by 1\n\t\t\t\t\tif(d.sOrigin == station_O && d.sDestination == station_D && d.departureTime_TS == rt)\n\t\t\t\t\t\td.increaseDemandBy(1)\n\t\t\t\t\t\tdemandAlreadyExists = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tunless(demandAlreadyExists) # create a new demand if it does not exist\n\t\t\t\t\t@list_demands.push(CS_demand.new(nbCreatedDemands, station_O, station_D, rt, arrivalTime))\n\t\t\t\t\tnbCreatedDemands += 1\n\t\t\t\tend\n\t\t\tend\n\t\t\n\t\twhen 'Uniform'\n\t\telse \n\t\tend\n\tend",
"def task\n end",
"def create_cards\r\n @cards.each{|e| e.create}\r\n @symbols_card.each{|e| e.create}\r\n @cards_rotated.each{|e| e.create}\r\n end",
"def dilute_plates(input, output)\r\n \r\n # Creates a hash that groups all the running operations to the input collection id it corresponds to\r\n grouped_by_collection = operations.running.group_by { |op| op.input(input).collection.id }\r\n \r\n # takes output container/collection and iterates through it filling it with media and colonies\r\n operations.output_collections[output].each do |outputPlate| \r\n \r\n # Load 96 well plate with media in respective wells \r\n load_media(outputPlate)\r\n \r\n # Diluting input 96-deep well plate to 1:1000 output plate \r\n transfer_cults(grouped_by_collection, outputPlate)\r\n \r\n # Move overnights to 30 C shaker incubator\r\n outputPlate.location = \"30 C shaker incubator\"\r\n outputPlate.save\r\n end \r\n end",
"def run\n super\n\n # first, ensure we're fingerprinted\n require_enrichment\n\n opt_max_rate = _get_option(\"max_rate\")\n\n results = _masscan_netblock(@entity,[4786],[],opt_max_rate)\n _log_error \"Invalid params\" unless results\n\n results.each do |r|\n _log \"Result: #{r}\"\n\n # check to see if it's a smart install enabled device\n ip_entity = _create_entity \"IpAddress\", {\"name\" => r[\"ip_address\"]}\n _create_network_service_entity(ip_entity,r[\"port\"],r[\"protocol\"],{})\n end\n\n end",
"def generate_deck # ANTHONY\n @suits.each do |suit|\n @rank.each do |rank|\n color = (suit == 'Spades' || suit == 'Clubs') ? 'Black' : 'Red'\n @cards << Card.new(rank, suit, color)\n end\n end\n end",
"def align_tasks\n # task_log_items = scan_tasks\n # task_metainfos = series_metainfos.select {|m| m.series_description =~ /Task|fMRI/i}\n\n series_with_metainfos = series.with_functional_metainfo.order(:position)\n\n \n if scan_tasks.size == series_with_metainfos.size\n scan_tasks.zip(series_with_metainfos).each do |item, series|\n # if defined?(PP)\n # pp \"Item: \", item\n # pp \"Series: \", series\n # end\n item.update_attributes(:series => series) unless item.series == series\n end\n else\n self.errors.add(:base, \"Can't align tasks of different sizes: Items (#{scan_tasks.size}), Metainfos (#{series_with_metainfos.size})\")\n return nil\n end\n end",
"def tasks_data_today \n tasks_of_today = self.tasks_due_today\n tasks = []\n tasks_of_today.each do |task|\n task = {\n task_name: task.name, \n completion_value: task.completions.last.completion_value,\n completion_max: task.completion_max,\n completion_unit: task.completion_unit\n }\n tasks << task \n end\n tasks \n end",
"def perform\n @requests = Request.find(:all, :conditions => [\"DATE(created_at) = ?\", Date.today])\n #Generate request mail for each Expert containing the \n if @requests.size > 0 \n Expert.all.each do |e|\n @skills = e.subscription_list\n @req_ids = []\n @requests.each do |r|\n @tags = r.skill_list\n if (@tags & @skills).size > 0\n @req_ids.push(r)\n end\n end\n \n if @req_ids.size > 0\n UserMailer.delay.request_created_suggest_experts(@req_ids, e) \n end\n\n end \n end\n \n end",
"def build_dag(dataset)\n \n Scarcity::Dagger.new do\n \n # use the job statement to create nodes\n # job :head, 'null.submit'\n \n # jobs can take a block to specify dag configurations relevant to the node\n job :autorecon1, \"condorsurfer.submit\" do\n pre 'prejob.sh'\n post 'postjob.sh'\n vars :args => \"#{dataset.uniq} 1 -nuintensitycor-3T\",\n # vars :args => \"#{dataset.uniq} 1\",\n :exec => \"condorsurfer.sh\",\n :inputfiles => \"#{dataset.uniq}.tar.gz\"\n priority 5\n retries 3\n end\n\n job :autorecon2, \"condorsurfer.submit\" do\n pre 'prejob.sh'\n post 'postjob.sh'\n vars :args => \"#{dataset.uniq} 2\",\n :exec => \"condorsurfer.sh\",\n :inputfiles => \"freesurfer_results.tar.gz\"\n priority 5\n retries 3\n end\n \n job :autorecon3, \"condorsurfer.submit\" do\n pre 'prejob.sh'\n post 'postjob.sh'\n vars :args => \"#{dataset.uniq} 3\",\n :exec => \"condorsurfer.sh\",\n :inputfiles => \"freesurfer_results.tar.gz\"\n priority 5\n retries 3\n end\n \n breed :autorecon1, :children => :autorecon2\n breed :autorecon2, :children => :autorecon3\n \n # job :tail, 'null.submit'\n \n # breed parent nodes to define child nodes\n # breed :head, :children => :main\n # breed :main, :children => :tail\n\n end\n \nend",
"def main\n # TODO: handle settings better\n $History = 7 # minimum spacing between cards from the same word\n $defaultDelay = 1 # default long-term delay, in days\n $Noise = 0.2 # noise in assigning long-term duedates\n $optimalStreak = 5 # how long should we go before switching categories?\n $Magic = 2 # affects the desired size of CardManager's queue\n $Adventure = 0.3 # percentage of novel cards to show the user\n\n # load data from data.yml\n dm = DeckManager.new('data.yml')\n loop do\n puts dm.getPrompt\n print \">> \"\n x = gets[0...-1] # discard trailing \\n\n if x == \"quit\"\n dm.closeEverything\n puts \"ნახვამდის!\" # \"goodbye!\" ქართულად\n return\n else\n response = dm.acceptAnswer(x) # response might be nil\n puts response if response\n end\n end\nend",
"def prepare_materials\n total_beads = ((PLATE_SIZE * VOL_BEADS_PER_WELL * OVERAGE) / 1000).round(2)\n total_bs = ((PLATE_SIZE * VOL_BS_PER_WELL * OVERAGE) / 1000).round(2)\n total_vol = total_beads + total_bs\n num_tubes = { qty: (total_vol / VOL_CONICAL_TUBE_ML).round,\n units: TUBE_15_ML_CONICAL }\n bs_per_tube = { qty: total_bs / num_tubes[:qty], units: MILLILITERS }\n beads_per_tube = { qty: total_beads / num_tubes[:qty], units: MILLILITERS }\n\n show do\n title 'Prepare Binding Bead Mix'\n check \"Vortex the Total Nucleic Acid Magnetic Beads to ensure \\\n that the bead mixture is homogeneous\"\n check \"Add #{qty_display(bs_per_tube)} Binding Solution per tube to \\\n #{qty_display(num_tubes)}\"\n check \"Add #{qty_display(beads_per_tube)} Nucleic Acid Magnetic Beads \\\n per tube to #{qty_display(num_tubes)}\"\n check 'Mix well by inversion, leave at room temperature'\n end\n end",
"def make_all\n puts \"Making all modules and activities - this will take a while\"\n make_all_modules\n make_all_activities\nend",
"def generate_tests\n for tweet_json in TWEET_JSONS\n test_description = \"tweet_json: '#{tweet_json}'\"\n #puts \"scheduling test #{test_description}\"\n generate_one_test test_description, tweet_json\n end\nend",
"def next_distances(save = true) ; next_task(@@DISTANCE_TASKS, save) ; end",
"def compile_all(options = {})\n # Each tasks\n @tasks.keys.map do |name|\n # Compile the task\n compile name, options\n end\n end",
"def cards(card_numbers, api_token)\n EnumerableUtils.batch_reduce([], card_numbers, 165) do |combined_result, card_numbers|\n result = _card(card_number: card_numbers.join(','), token: api_token)\n combined_result += result.collect{|card| Card.new(card)}\n end\n end",
"def create_deck\n deck = Array.new\n for number in 0..2\n for color in 0..2\n for shape in 0..2\n for shade in 0..2\n deck.push(Card.new(number,color,shape,shade))\n end\n end\n end\n end\n return deck\nend",
"def create_deck deck\n suits = ['clubs', 'spades', 'hearts', 'diamonds']\n values = [ ['2',2], ['3', 3], ['4',4], ['5',5], ['6', 6], [\"7\", 7], [\"8\", 8], [\"9\", 9], ['10', 10], ['Jack', 10], ['Queen', 10], ['King', 10], ['Ace', 11]]\n\n suits.each {|suit|\n \n values.each{ |number|\n card = Cards.new number[0], number[1], suit\n deck.push(card)\n }\n \n }\n\nend",
"def run\n super\n\n bucket_name = _get_entity_name\n opt_use_file = _get_option(\"use_file\")\n opt_filename = _get_option(\"brute_file\")\n opt_additional_buckets = _get_option(\"additional_buckets\")\n opt_use_creds = _get_option(\"use_creds\")\n opt_threads = _get_option(\"threads\")\n opt_permute = _get_option(\"create_permutations\")\n\n if opt_use_file\n _log \"Using file: #{opt_filename}\"\n potential_buckets = File.read(\"#{$intrigue_basedir}/data/#{opt_filename}\").split(\"\\n\")\n else\n _log \"Using provided brute list\"\n potential_buckets = [bucket_name]\n end\n\n # add in any additional buckets to the list of potentials\n all_potential_buckets = potential_buckets.concat(opt_additional_buckets.split(\",\"))\n\n # Create our queue of work from the checks in brute_list\n work_q = Queue.new\n all_potential_buckets.each do |pb|\n work_q << pb.strip\n\n # Add permutations\n if opt_permute\n begin\n # AWS is case sensitive.\n # https://forums.aws.amazon.com/thread.jspa?threadID=19928\n first_letter_cap = \"#{pb.strip}\".slice(0,1).upcase + \"#{pb.strip}\".slice(1..-1)\n work_q << \"#{first_letter_cap}\" unless \"#{first_letter_cap}\" == \"#{pb.strip}\"\n work_q << \"#{pb.strip.upcase}\" unless \"#{pb.strip.upcase}\" == \"#{pb.strip}\"\n work_q << \"#{pb.strip.downcase}\" unless \"#{pb.strip.downcase}\" == \"#{pb.strip}\"\n\n # General development permutations\n work_q << \"#{pb.strip}-backup\"\n work_q << \"#{pb.strip}-beta\"\n work_q << \"#{pb.strip}-dev\"\n work_q << \"#{pb.strip}-development\"\n work_q << \"#{pb.strip}-eng\"\n work_q << \"#{pb.strip}-engineering\"\n work_q << \"#{pb.strip}-old\"\n work_q << \"#{pb.strip}-prod\"\n work_q << \"#{pb.strip}-qa\"\n work_q << \"#{pb.strip}-stage\"\n work_q << \"#{pb.strip}-staging\"\n work_q << \"#{pb.strip}-test\"\n work_q << \"#{pb.strip}-web\"\n work_q << \"backup-#{pb.strip}\"\n work_q << \"beta-#{pb.strip}\"\n work_q << \"dev-#{pb.strip}\"\n work_q << \"development-#{pb.strip}\"\n work_q << \"eng-#{pb.strip}\"\n work_q << \"engineering-#{pb.strip}\"\n work_q << \"old-#{pb.strip}\"\n work_q << \"prod-#{pb.strip}\"\n work_q << \"qa-#{pb.strip}\"\n work_q << \"stage-#{pb.strip}\"\n work_q << \"staging-#{pb.strip}\"\n work_q << \"test-#{pb.strip}\"\n work_q << \"web-#{pb.strip}\"\n rescue TypeError => e\n puts \"Unable to permute: #{pb}, failing\"\n end\n end\n\n end\n\n # Create a pool of worker threads to work on the queue\n workers = (0...opt_threads).map do\n Thread.new do\n begin\n while bucket_name = work_q.pop(true)\n\n #skip anything that isn't a real name\n next unless bucket_name && bucket_name.length > 0\n\n # Authenticated method\n if opt_use_creds\n\n access_key_id = _get_task_config \"aws_access_key_id\"\n secret_access_key = _get_task_config \"aws_secret_access_key\"\n\n unless access_key_id && secret_access_key\n _log_error \"FATAL! To scan with authentication, you must specify a aws_access_key_id aws_secret_access_key in the config!\"\n return\n end\n\n # Check for it, and get the contents\n Aws.config[:credentials] = Aws::Credentials.new(access_key_id, secret_access_key)\n exists = check_existence_authenticated(bucket_name)\n\n # create our entity and store the username with it\n _create_entity(\"AwsS3Bucket\", {\n \"name\" => \"#{s3_uri}\",\n \"uri\" => \"#{s3_uri}\",\n \"authenticated\" => true,\n \"username\" => access_key_id\n }) if exists\n\n #########################\n # Unauthenticated check #\n #########################\n else\n\n s3_uri = \"https://#{bucket_name}.s3.amazonaws.com\"\n exists = check_existence_unauthenticated(s3_uri)\n _create_entity(\"AwsS3Bucket\", {\n \"name\" => \"#{s3_uri}\",\n \"uri\" => \"#{s3_uri}\",\n \"authenticated\" => false\n }) if exists\n\n next if exists ## Only proceed if we got an error above (bucket exists!) !!!\n\n s3_uri = \"https://s3.amazonaws.com/#{bucket_name}\"\n exists = check_existence_unauthenticated(s3_uri)\n _create_entity(\"AwsS3Bucket\", {\n \"name\" => \"#{s3_uri}\",\n \"uri\" => \"#{s3_uri}\",\n \"authenticated\" => false,\n }) if exists\n\n end # end if opt_use_creds\n\n\n end # end while\n rescue ThreadError\n end\n end\n end; \"ok\"\n workers.map(&:join); \"ok\"\n\n end",
"def determine_playable_cards\n playable_cards = []\n hand.each do |card_in_hand|\n if card_in_hand[\"cost\"] <= @mana_available\n playable_cards.push(card_in_hand)\n end \n end\n if mana_available >= 2\n playable_cards.push(\"hero ablity\")\n end\n playable_cards\n end",
"def eval_5_cards( c1, c2, c3, c4, c5)\n 1\n end",
"def batch_create_emissions_flows(input,output,coefficient=1,source=\"\",name=\"%\")\n i, o = get_in_out(input, output)\n p = Parameter.find_by_name(\"eff_flo\")\n i.consumed_by.where([\"name like ?\",name]).each do |t|\n if t.inputs.size == 1\n inflow_id = t.in_flows.first.id\n unless t.outputs.include?(o)\n\n #add out_flow\n flow = OutFlow.new(:technology_id => t.id)\n flow.commodities = [o]\n if flow.save\n puts \"Create out_flow for #{t}\"\n else\n flow.errors.each_full{|msg| puts \"error \" + msg }\n end\n outflow_id = flow.id\n\n #add coefficient\n attributes = Hash.new\n attributes[:parameter_id] = p.id\n attributes[:in_flow_id] = inflow_id\n attributes[:out_flow_id] = outflow_id\n attributes[:technology_id] = t.id\n attributes[:value] = coefficient\n attributes[:source] = source\n pv = ParameterValue.new(attributes)\n if pv.save\n puts \"Create parameter_value eff_flo\"\n else\n pv.errors.each_full{|msg| puts \"error \" + msg }\n end\n\n end\n end\n end\n end",
"def recipe_condense\n @recipe_pools = []\n for recipe in $mix_recipes\n input, output = recipe[0], recipe[1]\n input_s = []\n for component in input\n #fill default values\n if component.length < 2\n component = [component[0],1,0]\n elsif component.length < 3\n component = [component[0], component[1], 0]\n end\n updated = false\n for item in input_s\n #condense items of the same type\n if component[0] == item[0] && component[1] == item[1]\n item[2] += component[2]\n updated = true\n break\n end\n end\n if !updated then input_s.push(component) end\n end\n #sort input_s to have highest-quality requirements first, makes\n #things easier later\n input_s.sort! { |a, b| a[2] <=> b[2] }\n @recipe_pools.push([input_s, output]) \n end\n end",
"def mass_copier_batch(project_id, from_rfc5646_locale, to_rfc5646_locale)\n b = Sidekiq::Batch.new\n b.description = \"Project Translations Mass Copier #{project_id} (#{from_rfc5646_locale} -> #{to_rfc5646_locale})\"\n b.on :success, ProjectTranslationsMassCopier::Finisher, project_id: project_id\n b\n end",
"def perform\n multiples_3_and_5()\nend",
"def main\n pr = intro\n operations.group_by {|op| get_parameter(op: op, fv_str: MEASUREMENT_TYPE).to_sym}.each do |measurement_type, ops|\n new_mtype = true\n pr.measurement_type = measurement_type\n ops.group_by {|op| op.input(INPUT).sample.sample_type}.each do |st, ops|\n ops.group_by {|op| op.input(MEDIA).item}.each do |media_item, ops|\n ops.group_by {|op| get_uninitialized_output_object_type(op)}.each do |out_ot, ops|\n ops.make\n ops.group_by {|op| op.output(OUTPUT).collection}.each do |out_collection, ops|\n pr.setup_experimental_measurement(experimental_item: out_collection, output_fv: nil)\n new_mtype = setup_plate_reader_software_env(pr: pr, new_mtype: new_mtype)\n # Gather materials and items\n take_items = [media_item].concat([pr.experimental_item].flatten)\n gather_materials(empty_containers: [pr.measurement_item], transfer_required: pr.transfer_required, new_materials: ['P1000 Multichannel'], take_items: take_items)\n # Prep plate\n display_hash = get_transfer_display_hash(ops: ops, input_str: INPUT, output_str: OUTPUT, dilution_str: DILUTION)\n prefill_plate_w_media(collection: pr.measurement_item, media_sample: media_item.sample, media_vol_ul: nil, display_hash: display_hash) # media_vol_ul must be > 0 to run show block\n take ops.map {|op| op.input(INPUT).item}, interactive: true\n tech_transfer_cultures(collection: pr.measurement_item, display_hash: display_hash)\n tech_add_blanks(pr: pr, blanking_sample: media_item.sample, culture_vol_ul: 0.0, media_vol_ul: 300.0) # Cannot handle a plate without blanks, esp in processing of upload\n \n take_measurement_and_upload_data(pr: pr)\n \n dilution_factor_arr = ops.map {|op| get_dilution_factor(op: op, fv_str: DILUTION)}\n \n process_and_associate_data(pr: pr, ops: ops, blanking_sample: media_item.sample, dilution_factor: dilution_factor_arr)\n end\n keep_p_arr = ops.select {|op| op.input(KEEP_OUT_PLT).val.to_s.downcase == 'yes'}\n (keep_p_arr.empty?) ? pr.measurement_item.mark_as_deleted : pr.measurement_item.location = 'Bench'\n end\n end\n end\n end\n cleaning_up(pr: pr)\n end",
"def create_deck\n\n\tdeck = Array.new\n\tcard_val = Array.new\n\tcard_type = [\"h\",\"d\",\"c\",\"s\"] # Hearts, Diamonds, Clubs, Spades\n\n (2..10).each do |i|\n \tcard_val << i.to_s\n end\n card_val << \"J\" << \"Q\" << \"K\" << \"A\"\n\n for type in card_type\n \tfor val in card_val\n \t\tdeck << val+type\n \tend\n end\n\n return deck\n\nend",
"def ingredients_and_amounts(perfect_10_recipe)\n perfect_10_recipe.each do |ingredients, amounts|\n puts \"You need #{amounts} of #{ingredients}\"\n end \nend",
"def deal5cards (n)",
"def executeSimpleTest(iSimpleTestData)\n lMaxDays = 10\n lFirstDay = Date.new(2000, 1, 1)\n # Create a standard calendar (lMaxDays days, 1 hour per day) for each resource\n # It will be populated lated\n # map< Date, Integer >\n lCalendar = {}\n # Create the index of resources\n # map< String, Resource >\n lResourcesMap = {}\n # Create the index of tasks\n # map< String, Task >\n lTasksMap = {}\n # Create the final assignment\n # map< Task, map< Date, map< Resource, Integer > > >\n lFinalAssignment = {}\n iSimpleTestData.each do |iSimpleTaskInfo|\n lTaskName, lResourceName, lPriority, lSizing, lSuccessorNamesList, lStrFinalAssignment = iSimpleTaskInfo\n if (lStrFinalAssignment.size > lMaxDays)\n lMaxDays = lStrFinalAssignment.size\n end\n # Do we already know this resource ?\n if (!lResourcesMap.has_key?(lResourceName))\n # Create the resource\n lResource = Resource.new(lResourceName, lCalendar)\n lResourcesMap[lResourceName] = lResource\n else\n lResource = lResourcesMap[lResourceName]\n end\n lTask = Task.new(lTaskName, lPriority, lSizing, {lResource => lSizing}, [])\n lTasksMap[lTaskName] = lTask\n # Set its final assignment info\n lFinalTaskAssignment = {}\n lIdxDay = 0\n lStrFinalAssignment.each_byte do |iChar|\n if (iChar == 61) # 61 == '='\n lFinalTaskAssignment[lFirstDay + lIdxDay] = {lResource => 1}\n end\n lIdxDay += 1\n end\n lFinalAssignment[lTask] = lFinalTaskAssignment\n end\n # Create the list of tasks\n # list< Task >\n lTasksList = []\n # Now populate the successors\n iSimpleTestData.each do |iSimpleTaskInfo|\n lTaskName, lResourceName, lPriority, lSizing, lSuccessorNamesList, lStrFinalAssignment = iSimpleTaskInfo\n # Retrieve the task\n lTask = lTasksMap[lTaskName]\n # Parse each successor\n lSuccessorsList = []\n lSuccessorNamesList.each do |iSuccessorName|\n # Retrieve the successor, and add it\n lSuccessorsList << lTasksMap[iSuccessorName]\n end\n # Set the successors in the real task\n lTask.Successors = lSuccessorsList\n # Add the task to the list\n lTasksList << lTask\n end\n # Create a standard project (lMaxDays days, starting from january 1st 2000)\n lProject = Project.new(lFirstDay, lFirstDay + lMaxDays)\n # Populate the calendar of each resource\n lMaxDays.times do |iIdx|\n lCalendar[lFirstDay + iIdx] = 1\n end\n # Execute the test\n executeTest(lTasksList, lProject, lFinalAssignment)\n end",
"def perform\n total = options['length'].to_i || 10\n num = 0\n while num < total\n at(num, total, \"At #{num} of #{total}\")\n sleep(1)\n num += 1\n end\n completed\n end",
"def make_json_limit_task(channel)\n json_stamp = \"#{$carddir}/#{channel}/.limit_harvested\"\n file json_stamp => \"#{$carddir}/#{channel}/.limits_computed\" do |t|\n sh \"harvest_limits.py #{$carddir}/#{channel}\"\n sh \"touch #{t.name}\"\n end\n return json_stamp\nend",
"def custom_configure_tasks_for(a=nil)\n []\n end",
"def make_beverages\n beverages.each do |beverage_name, items_needed_quantity|\n error_reason = nil\n # checking availability of all items to make a particular beverage\n if check_all_items_availability?(\n beverage_name: beverage_name,\n items_needed_quantity: items_needed_quantity\n )\n items_needed_quantity.each do |item_name, quantity|\n use_item(item_name: item_name, quantity: quantity)\n end\n log_beverage_success(beverage_name: beverage_name)\n # if at least one item doesn't meet the needed quantity\n # the else block will log failure message\n else\n log_beverage_failure(beverage_name: beverage_name)\n end\n end\n # printing the collected logs\n puts beverage_log\n end",
"def assemble_deck\n cards = (north_south_tricks + east_west_tricks).map(&:cards)\n BeloteDeck.new cards\n end",
"def generateRakeFor_Deliver\n if (!@Context[:RakeSetupFor_Mix])\n generateRakeFor_Mix\n end\n lLstTargets = []\n lDeliverConf = @RecordConf[:Deliver]\n if (lDeliverConf != nil)\n lDeliverablesConf = lDeliverConf[:Deliverables]\n if (lDeliverablesConf != nil)\n # Use this info to generate needed targets\n lDeliverablesConf.keys.sort.each do |iDeliverableName|\n lLstTargets << generateRakeForDeliver(iDeliverableName) if (@Context[:LstDeliverableNames].empty?) or (@Context[:LstDeliverableNames].include?(iDeliverableName))\n end\n end\n end\n\n desc 'Produce all deliverables'\n task :Deliver => lLstTargets\n\n end",
"def functional_group_loop\n segments = []\n batchids.each do |batch_id|\n Output835.log.info \"batch_id : #{batch_id}\"\n segments << functional_group_header\n segments << transactions\n segments << functional_group_trailer(batch_id)\n end\n segments = segments.compact\n segments\n end",
"def fill_aggregator_queue(type)\n case type\n when :chat\n 15.times do |day|\n data_in = {'from' => handle, 'rcpt' => 'sender', 'incoming' => 1, 'program' => 'skype', 'content' => 'test message'}\n evidence_in = Evidence.target(target.id).create!(da: Time.now.to_i + day*86400, aid: agent.id, type: :chat, data: data_in)\n\n data_out = {'from' => 'sender', 'rcpt' => handle, 'incoming' => 0, 'program' => 'skype', 'content' => 'test message'}\n evidence_out = Evidence.target(target.id).create!(da: Time.now.to_i + day*86400, aid: agent.id, type: :chat, data: data_out)\n\n evidence_in.add_to_aggregator_queue\n evidence_out.add_to_aggregator_queue\n end\n when :call\n 15.times do |day|\n data_in = {'from' => handle, 'rcpt' => 'sender', 'incoming' => 1, 'program' => 'skype', 'content' => 'test message'}\n evidence_in = Evidence.target(target.id).create!(da: Time.now.to_i + day*86400, aid: agent.id, type: :call, data: data_in)\n\n evidence_in.add_to_aggregator_queue\n end\n end\n end",
"def mana_curve\n curve = []\n num_cards = packs.map { |pack| pack.number }.sum\n cost = 0\n while curve.sum != num_cards\n packs = packs_with_cmc(cost)\n curve[cost] = packs.map { |pack| pack.number }.sum\n cost += 1\n end\n curve\n end",
"def generate_amendments(congress, data)\n puts \"generating amendments for #{congress.number}...\"\n amendments = Amendment.find(:all, :conditions => { :congress_id => congress.id }, :order => 'amendments.name', :include => :bill )\n @representatives = congress.representatives\n @committees = congress.committees\n @subcommittees = congress.subcommittees\n @sponsoring_committees = @committees.partition {|c| c.amendments.size > 0 }.first\n 0.upto((amendments.size.to_f / 250.0).ceil - 1) do |batch|\n @amendments = amendments.values_at((batch * 250)..((batch + 1) * 250 - 1)).compact\n @bills = @amendments.collect {|a| a.bill }\n data << [ render_to_string(:action => \"amendments\", :layout => false), \"#{congress.number.ordinalize}-amendments-#{batch}\" ] if @amendments.size > 0\n end\n end",
"def create_pirate_tasks\r\n phunts = PirateHunt.where(hunt: hunt).to_a\r\n phunts.each do |phunt|\r\n PirateTask.create(user: phunt.user, hunt: self.hunt, task: self, pirate_hunt: phunt, answer_uploaded: false, completed: false)\r\n end\r\n end",
"def validate_tasks(options)\n tasks = []\n\n instances = base_class.where(:id => options[:ids]).order(\"lower(name)\").to_a\n return instances, tasks unless options[:invoke_by] == :task # jobs will be used instead of tasks for feedback\n\n instances.each do |instance|\n # create a task for each instance\n task = MiqTask.create(:name => \"#{instance.name}: '#{options[:task]}'\", :userid => options[:userid])\n tasks.push(task)\n\n validate_task(task, instance, options)\n end\n return instances, tasks\n end",
"def bulk_generate\n\n end",
"def build_cdm_list\r\n cdm_solo_str = `grep \"^node\" /etc/puppet/manifests/site.pp |grep 'am-'|awk '{print $2}' | sed \"s/\\'//g\" |sed \"s/\\.us\\.gsoa\\.local//g\"`\r\n cdm_cal_str = `grep \"^node\" /etc/puppet/manifests/site.pp |grep 'amc'|awk '{print $2}' | sed \"s/\\'//g\" |sed \"s/\\.us\\.gsoa\\.local//g\"`\r\n cdm_multi_str = `grep \"am-\" /etc/puppet/manifests/site.pp | grep \":\" |grep -v \"#\" | sed 's/\\\"//g'| sed \"s/://g\"`\r\n\r\n cdm_solo_arr = cdm_solo_str.split.sort!\r\n cdm_cal_arr = cdm_cal_str.split.sort!\r\n cdm_multi_arr = cdm_multi_str.split.sort!\r\n\r\n # check if ssh to the host is working\r\n cdm_solo_arr.each do |cdm|\r\n cmd=\"ssh -o 'PreferredAuthentications=publickey' root@\"+cdm + \" hostname >/dev/null 2>&1\"\r\n if !(system(cmd)) then\r\n cdm_solo_arr -= [cdm]\r\n end\r\n end\r\n cdm_cal_arr.each do |cdm|\r\n cmd=\"ssh -o 'PreferredAuthentications=publickey' root@\"+cdm + \" hostname >/dev/null 2>&1\"\r\n if !(system(cmd)) then\r\n cdm_cal_arr -= [cdm]\r\n end\r\n end\r\n\r\n # check if any cdm is a multiT\r\n cdm_solo_arr.each do |cdm|\r\n cmd = \"ssh root@\"+cdm+\" sm_service show >/dev/null 2>&1\"\r\n if (system(cmd)) then\r\n cmd = \"ssh root@\"+cdm+\" sm_service show |grep namespace >/dev/null 2>&1\"\r\n if (system(cmd)) then\r\n cdm_solo_arr -= [cdm]\r\n cdm_multi_arr += [cdm]\r\n end\r\n end\r\n end\r\n\r\n File.open(\"/root/smangam/cdm_solo.txt\",\"w\") do |f|\r\n f.puts cdm_solo_arr\r\n f.close\r\n end\r\n File.open(\"/root/smangam/cdm_cal.txt\",\"w\") do |f|\r\n f.puts cdm_cal_arr\r\n f.close\r\n end\r\n File.open(\"/root/smangam/cdm_multi.txt\",\"w\") do |f|\r\n f.puts cdm_multi_arr\r\n f.close\r\n end\r\nend",
"def custom_configure_tasks_for(a=nil)\n []\n end",
"def create_Ants\n while @food > 0\n create_random_Ant\n create_Ant_Room\n end\n \n end",
"def build_deck\n# This function builds an array of 52 cards made up of 4 copies of fixed nums with values from 1 to 13\n\t@deck = []\n\tfor num in 1..4\n\t\tfor num in 1..13\n\t\t\t@deck.push(num)\n\t\tend\n\tend\nend",
"def cards()\n deck_array = []\n suits = ['C', 'D', 'H', 'S']\n for num in 1..13\n suits.each do |suit|\n case \"#{num}\".to_i\n when 1\n deck_array << \"A#{suit}\"\n @redis.set(\"A#{suit}\", 1)\n when 11\n deck_array << \"J#{suit}\"\n @redis.set(\"J#{suit}\", 10)\n when 12\n deck_array << \"Q#{suit}\"\n @redis.set(\"Q#{suit}\", 10)\n when 13\n deck_array << \"K#{suit}\"\n @redis.set(\"K#{suit}\", 10)\n else\n deck_array << \"#{num}#{suit}\"\n @redis.set(\"#{num}#{suit}\", \"#{num}\")\n end\n end\n end\n deck_array\nend",
"def task(name, &block)\r\n if name.kind_of?(Hash)\r\n name.each do |alias_name, task_name|\r\n raise(\"Undefined task `#{task_name}'\") unless @@tasks[task_name.to_s]\r\n @@tasks[alias_name.to_s] = @@tasks[task_name.to_s]\r\n @@descriptions[alias_name.to_s] = @@last_description\r\n end\r\n else\r\n raise(\"Task `#{name}' is defined more than once\") if @@tasks[name.to_s]\r\n @@tasks[name.to_s] = block\r\n @@descriptions[name.to_s] = @@last_description\r\n end\r\n\r\n @@last_description = nil\r\n end",
"def run_topic(key)\n output = []\n tasks = 0\n if topics[key] =~ /(@(include|run|copy|open|url)\\((.*?)\\)|`{3,}run)/i\n directives = topics[key].scan(/@(include|run|copy|open|url)\\((.*?)\\)/i)\n tasks += directives.length\n directives.each do |c|\n cmd = c[0]\n obj = c[1]\n case cmd\n when /include/i\n matches = match_topic(obj)\n if matches.empty?\n warn \"No topic match for @include(#{search})\"\n else\n warn \"\\e[1;33mIncluding tasks from \\e[3;37m#{matches[0]}\\e[0m\"\n process_topic(matches[0], true)\n warn \"\\e[1;33mEnd include \\e[3;37m#{matches[0]}\\e[0m\"\n end\n when /run/i\n warn \"\\e[1;32mRunning \\e[3;37m#{obj}\\e[0m\"\n system(obj)\n when /copy/i\n warn \"\\e[1;32mCopied \\e[3;37m#{obj}\\e[1;32m to clipboard\\e[0m\"\n `echo #{Shellwords.escape(obj)}'\\\\c'|pbcopy`\n when /open|url/i\n os_open(obj)\n end\n end\n\n blocks = topics[key].scan(/(`{3,})run(?: +([^\\n]+))?(.*?)\\1/mi)\n tasks += blocks.length\n blocks.each do |c|\n title = c[1] ? c[1].strip : ''\n warn \"\\e[1;32mRunning block \\e[3;37m#{title}\\e[0m\"\n block = c[2].strip\n script = Tempfile.new('howzit_script')\n begin\n script.write(block)\n script.close\n File.chmod(0777, script.path)\n system(%(/bin/sh -c \"#{script.path}\"))\n ensure\n script.close\n script.unlink\n end\n end\n else\n warn \"\\e[0;31m--run: No \\e[1;31m@directive\\e[0;31;40m found in \\e[1;37m#{key}\\e[0m\"\n end\n output.push(\"Ran #{tasks} #{tasks == 1 ? 'task' : 'tasks'}\")\n end",
"def make_complaints\n puts \"Making Complaints\"\n days = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]\n 40.times do\n studnets = Student.all(limit: 40 , order: \"RANDOM()\" )\n description = Faker::Lorem.paragraphs(rand(2..8)).join('')\n reason_of_delay = Faker::Lorem.paragraphs(rand(2..8)).join('')\n expectations = Faker::Lorem.paragraphs(rand(2..8)).join('')\n date_of_alleged_event = Time.now - 10.days\n category = [1,2,3,4]\n studnets.each do |student|\n subjects = student.subjects.all(limit: 4) if student.subjects\n subjects.each do |subject|\n priority = [1,2,3]\n time = (Time.now - 4.days) + days.sample.days\n Ticket.create!(created_at: time, description: description, student_id: student.id, subject_id: subject.id, priority_id: priority.sample, date_of_alleged_event: date_of_alleged_event,\n expectations: expectations, reason_of_delay: reason_of_delay, category_id: category.sample)\n ticket = Ticket.last\n if ticket.priority.priority_name == 'high'\n due = ticket.created_at.to_date + 2.days\n ticket.update_attributes(due: due)\n elsif ticket.priority.priority_name == 'normal'\n due = ticket.created_at.to_date + 7.days\n ticket.update_attributes(due: due)\n elsif ticket.priority.priority_name == 'low'\n due = ticket.created_at.to_date + 10.days\n ticket.update_attributes(due: due)\n end\n subject_id = ticket.subject_id\n subject_staff = SubjectStaff.where(subject_id: subject_id)\n advisor_id = subject_staff.first.advisor_id\n ticket_id = ticket.id\n status = [1,2,3,4,5]\n TicketStatus.create!(status_id: status.sample,ticket_id: ticket_id, advisor_id: advisor_id )\n end\n end\n end\nend",
"def query_long_running_tasks\n Kernel.sleep(0.01)\n target_tasks = []\n 100.times.each do\n target_tasks = @tasks.get[\"nodes\"]\n .map { |k, v| v[\"tasks\"] }\n .flatten.map { |ts| ts.select { |k, v| /bulk/ =~ v[\"action\"] } }\n .flatten.reject { |t| t.empty? }\n break if target_tasks.size > 0\n end\n\n target_tasks\nend",
"def prepare_plan(options)\n\t options = validate_options options,\n\t\tmissions: 0, add: 0, discover: 0, tasks: 0,\n\t\tpermanent: 0,\n\t\tmodel: Roby::Task, plan: plan\n\n\t missions, permanent, added, tasks = [], [], [], []\n\t (1..options[:missions]).each do |i|\n\t\toptions[:plan].add_mission_task(t = options[:model].new(id: \"mission-#{i}\"))\n\t\tmissions << t\n\t end\n\t (1..options[:permanent]).each do |i|\n\t\toptions[:plan].add_permanent_task(t = options[:model].new(id: \"perm-#{i}\"))\n\t\tpermanent << t\n\t end\n\t (1..(options[:discover] + options[:add])).each do |i|\n\t\toptions[:plan].add(t = options[:model].new(id: \"discover-#{i}\"))\n\t\tadded << t\n\t end\n\t (1..options[:tasks]).each do |i|\n\t\ttasks << options[:model].new(id: \"task-#{i}\")\n\t end\n\n\t result = []\n\t [missions, permanent, added, tasks].each do |set|\n\t\tunless set.empty?\n\t\t result << set\n\t\tend\n\t end\n\n result = result.map do |set|\n if set.size == 1 then set.first\n else set\n end\n end\n\n if result.size == 1\n return result.first\n end\n return *result\n\tend",
"def create_job(change_set)\n # all room types id in this change set\n room_type_ids = change_set.room_type_ids\n pool = change_set.pool\n\n room_type_ids.each do |rt_id|\n channel_mapping = RoomTypeChannelMapping.find_by_room_type_id_and_channel_id(rt_id, self.channel.id)\n # if room type relate the channel then run the xml push\n if !channel_mapping.blank?\n cs = ChannelStopSellChangeSetChannel.create(:change_set_id => change_set.id, :channel_id => self.channel.id)\n cs.delay.run\n return\n end\n end\n \n end",
"def create_job(change_set)\n # all room types id in this change set\n room_type_ids = change_set.room_type_ids\n pool = change_set.pool\n\n room_type_ids.each do |rt_id|\n channel_mapping = RoomTypeChannelMapping.find_by_room_type_id_and_channel_id(rt_id, self.channel.id)\n # if room type relate the channel then run the xml push\n if !channel_mapping.blank?\n cs = ChannelStopSellChangeSetChannel.create(:change_set_id => change_set.id, :channel_id => self.channel.id)\n cs.delay.run\n return\n end\n end\n \n end",
"def create_job(change_set)\n # all room types id in this change set\n room_type_ids = change_set.room_type_ids\n pool = change_set.pool\n\n room_type_ids.each do |rt_id|\n channel_mapping = RoomTypeChannelMapping.find_by_room_type_id_and_channel_id(rt_id, self.channel.id)\n # if room type relate the channel then run the xml push\n if !channel_mapping.blank?\n cs = ChannelStopSellChangeSetChannel.create(:change_set_id => change_set.id, :channel_id => self.channel.id)\n cs.delay.run\n return\n end\n end\n \n end",
"def create_deck\n # Your code goes here\n cards = []\n ranks = %w{2 3 4 5 6 7 8 9 10 J Q K A}\n suits = %w{h d c s}\n\n # inner loop joins suit and rank together through Interpolation\n suits.each do |suit|\n ranks.each do |rank|\n # cards << i.to_s + suit\n cards.push(\"#{rank}#{suit}\") # better to interpolate, no need to convert rank to String\n end\n end \n\n return cards \nend",
"def validate_tasks(options)\n tasks = []\n\n instances = base_class.where(:id => options[:ids]).order(Arel.sql(\"lower(name)\")).to_a\n return instances, tasks unless options[:invoke_by] == :task # jobs will be used instead of tasks for feedback\n\n instances.each do |instance|\n # create a task for each instance\n task = MiqTask.create(:name => \"#{instance.name}: '#{options[:task]}'\", :userid => options[:userid])\n tasks.push(task)\n\n validate_task(task, instance, options)\n end\n return instances, tasks\n end",
"def actions(rental)\n # Main :\n tot_com = price(rental) * 30 / 100\n start_date = DateTime.parse(rental[\"start_date\"])\n end_date = DateTime.parse(rental[\"end_date\"])\n duration = (end_date - start_date).to_i + 1\n insurance_fee = tot_com / 2 .to_i\n assistance_fee = duration * 100\n drivy_fee = tot_com - insurance_fee - assistance_fee\n\n # Options :\n gps = 0\n if options(rental).include?(\"gps\") then gps += 500 * duration end\n baby_seat = 0\n if options(rental).include?(\"baby_seat\") then baby_seat += 200 * duration end\n additional_insurance = 0\n if options(rental).include?(\"additional_insurance\") then additional_insurance += 1000 * duration end\n\n debit_driver = {\"who\": \"driver\", \"type\": \"debit\", \"amount\": price(rental) + gps + baby_seat + additional_insurance}\n credit_owner = {\"who\": \"owner\", \"type\": \"credit\", \"amount\": price(rental) - tot_com + gps + baby_seat}\n credit_insurance = {\"who\": \"insurance\", \"type\": \"credit\", \"amount\": insurance_fee}\n credit_assistance = {\"who\": \"assistance\", \"type\": \"credit\", \"amount\": assistance_fee}\n credit_drivy = {\"who\": \"drivy\", \"type\": \"credit\", \"amount\": drivy_fee + additional_insurance}\n\n actions = [debit_driver, credit_owner, credit_insurance, credit_assistance, credit_drivy]\nend",
"def prepare_deck\n (1..104).each do |i|\n v = [1, 2, 3, 5, 7]\n if i == 55\n @deck[i] = v[4]\n elsif (i % 11 == 0.0) && i != 55\n @deck[i] = v[3]\n elsif (i % 10 == 0.0) && i != 55\n @deck[i] = v[2]\n elsif (i % 5 == 0.0) && i != 55\n @deck[i] = v[1]\n else\n @deck[i] = v[0]\n end\n end\n end",
"def CreateTasksForDefect (aDefect, tasks)\n\n\trally = RallyRestAPI.new(:base_url => @base_url, :username => @user_name, :password => @password)\n\n query_result = rally.find(:defect) {equal :formatted_i_d, aDefect}\n\n defect = query_result.results.first\n\n tasks.each { |task|\n\n fields = {\n :work_product => defect,\n :name => task,\n :state => \"Defined\",\n :estimate => 1,\n :to_do => 1\n }\n\n rally.create(:task, fields)\n\n print aDefect + \":\" + task + \" - OK\\n\"\n }\nend",
"def deploy_lots_of_dummys(number = 10)\n (1..number.to_i).each { |x| deploy_dummy(x) }\n end",
"def process(files, parallel, test, output_path)\n\n summaries = []\n files.each do |file|\n\n mediainfo = mediainfo(file)\n\n results = []\n tx_files = duplicate(file, output_path, parallel - 1)\n tx_files << file\n\n start_time = Time.now\n tx(tx_files, results, test, mediainfo, output_path)\n wait_for_completion\n end_time = Time.now\n\n summary = TestSummary.new(File.basename(file), results, start_time, end_time, mediainfo[:duration])\n summaries << summary\n end\n\n summaries\nend",
"def get_tasks\n\n\ttasks = Task.all.shuffle\n\n\treturned_tasks = []\n\trand(10..18).times do\n\t\treturned_tasks << tasks.pop\n\tend\n\n\treturned_tasks\nend",
"def populate_deck\n # self.initial_size.times do\n # new_card_class = Card.library.values.sample\n # new_card = new_card_class.new\n # self.cards << new_card\n # end\n 40.times do\n new_card_type = Card.library.values.sample\n new_card = new_card_type.create\n self.cards << new_card\n end\n end",
"def doitem\n @item = Item.find(params[:id])\n @task = Task.find(params[:task_id])\n #breakpoint\n #(5 - @task.items.length).times { @task.items.build }\n (@item.count - @item.assets.count).times { @item.assets.build }\n #breakpoint\n \n end",
"def userFill(holder)\n holder.each do | x |\n a_user = User.create!(x)\n recipeMaker(3, a_user)\n end\n # call recipeMaker like 3 times here, which will call subcategories\nend",
"def perform_beginning_tasks(element, attrs)\n if element == \"Batch\"\n meta_data_from_batch = Hash[*attrs.flatten(1)]\n @job = Job.find(meta_data_from_batch[\"DocID\"])\n @batch = @job.batch\n @facility = @batch.facility\n @check_information = @job.check_informations.first\n micr_info = @check_information.micr_line_information\n @payer = micr_info.payer if micr_info\n if [\"PROCESSING\", \"NEW\", \"COMPLETED\", \"INCOMPLETED\"].include? @job.job_status\n RevremitMailer.notify_late_ocr_xml_arrival(@check_information.check_number, @batch.id, @batch.batchid).deliver\n abort(\"The job is already allocated for the processing...Details are mailed to #{$RR_REFERENCES['email']['late_ocr_xml_arrival']['notification']}\")\n end\n @job.update_attributes(:is_ocr => true, :ocr_status => \"OCR PROCESSING\", :job_status => \"OCR PROCESSING\")\n end\n\n if element == \"Grid\"\n attr_top_element_hash = Hash[*attrs.flatten(1)]\n @remark_code_grid_identifier = attr_top_element_hash[\"Name\"] == \"REMARKS\" ? true : false\n end\n\n if element == \"RemarkCode\" or element == \"RemarkCodeDescription\"\n @remark_code_identifier = true\n end\n\n if @remark_code_identifier\n if element == \"DataValue\"\n @data_value_identifier = true\n end\n if element == \"TEXTSTRING\" and @data_value_identifier and @remark_code_grid_identifier\n attr_hash = Hash[*attrs.flatten(1)]\n @remark_codes_with_desc << attr_hash[\"WORD\"]\n elsif element == \"TEXTSTRING\" and @data_value_identifier\n attr_hash = Hash[*attrs.flatten(1)]\n unless attr_hash[\"WORD\"].blank?\n @remark_codes << attr_hash[\"WORD\"] unless @remark_codes.include? attr_hash[\"WORD\"]\n end\n end\n end\n construct_the_data_structures(element, attrs)\n end"
] |
[
"0.65122205",
"0.57840717",
"0.5569774",
"0.55144083",
"0.54795414",
"0.54754573",
"0.5371252",
"0.53610396",
"0.52705884",
"0.5234533",
"0.51880157",
"0.51639295",
"0.5133813",
"0.5116906",
"0.5099535",
"0.5091702",
"0.5090558",
"0.5079809",
"0.5051377",
"0.5040625",
"0.5037032",
"0.5036602",
"0.5027324",
"0.5011164",
"0.5005812",
"0.49942294",
"0.49889117",
"0.49885863",
"0.49864802",
"0.49576393",
"0.494686",
"0.4944953",
"0.49384728",
"0.49242806",
"0.49197453",
"0.49129775",
"0.49052826",
"0.4903519",
"0.49033472",
"0.49033198",
"0.49018064",
"0.49004838",
"0.4900305",
"0.4897659",
"0.48925528",
"0.48920125",
"0.48706165",
"0.48588344",
"0.4853636",
"0.48518845",
"0.48412246",
"0.48219696",
"0.4820626",
"0.48183778",
"0.48128822",
"0.48121458",
"0.48083794",
"0.4805256",
"0.480469",
"0.48025793",
"0.4798363",
"0.47961962",
"0.47880706",
"0.47834173",
"0.4778003",
"0.47768837",
"0.47725675",
"0.47680473",
"0.47636512",
"0.4759845",
"0.47576925",
"0.47574228",
"0.475585",
"0.47476864",
"0.47447386",
"0.47444987",
"0.47416142",
"0.47415456",
"0.47414908",
"0.47379512",
"0.4736653",
"0.4733424",
"0.47247204",
"0.47200188",
"0.47198543",
"0.47167444",
"0.47167444",
"0.47167444",
"0.4714222",
"0.471104",
"0.47092274",
"0.4708085",
"0.4708068",
"0.47051767",
"0.47019863",
"0.46998054",
"0.46984398",
"0.46955943",
"0.46899647",
"0.46868113"
] |
0.52829516
|
8
|
Recipes to harvest limits targets: harvest_limit_mmt harvest_limit_emt harvest_limit_eet harvest_limit_llt harvest_limits
|
def make_json_limit_task(channel)
samples_map = Hash['mmt' => 'data_DoubleMu',
'eet' => 'data_DoubleElectron',
'emt' => 'data_MuEG',
'llt' => 'data_DoubleMu',
]
carddir = $carddir #makes a copy so that if $cardir changes this does not
json_stamp = "#{$carddir}/#{channel}/.limit_harvested"
file json_stamp => "#{$carddir}/#{channel}/.limits_computed" do |t|
sh "harvest_limits.py #{carddir}/#{channel}"
sh "touch #{t.name}"
sh "add_tag_to_json.py #{carddir}/#{channel}/*.json -l jobid -t #{$jobid}"
sh "add_tag_to_json.py #{carddir}/#{channel}/*.json -l lumi -t #{get_lumi(samples_map[channel], $jobid)}"
end
return json_stamp
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def miter_limit(limit)\n end",
"def limits(limit,bust)\n @limit = limit\n @bust = bust\n end",
"def planted_bombs_limit(action = :increment)\n @bomb_manager.planted_bombs_limit action\n end",
"def limit_rubies\n @limits = [[1, 1], [2, 2], [1, 1], [0, 3], [3, 0], [2, 2], [2, 2]]\n end",
"def limit(action, value)\n limits = config.limits(action.to_sym)\n TrafficJam::Limit.new(action, value, **limits)\n end",
"def set_limit(opts)\n opts = check_params(opts,[:limits])\n super(opts)\n end",
"def snippet_task_limit\n ENV['LIMIT'] ? ENV['LIMIT'].to_i : DEFAULT_LIMIT\n end",
"def set_maximum_requests(opts)\n opts = check_params(opts,[:maximum_requests])\n super(opts)\n end",
"def set_request_limit\n @limit = Limit.uniq.pluck(:classification)\n end",
"def limit(limit); end",
"def limit; @opts['limit']; end",
"def set_limit\n @limit = 250\n end",
"def calc_tb_limits\n skils = skills \n \n skils.push($data_skills[@basic_atk_id_tb]) if @basic_atk_id_tb\n max, min = 0, 1<<31\n maxF, minF = 0, 1<<31\n maxE, minE = 0, 1<<31\n \n @max_s, @min_s = nil, nil \n @max_sf, @min_sf = nil, nil #friendly skills\n @max_se, @min_se = nil, nil #aggressive skills\n r_maxF = r_minF = r_maxE = r_minE = nil\n \n skils.each do |s| \n r_max = s.tb_range_max\n r_min = s.tb_range_min\n \n r_maxF = s.tb_range_max if s.friendly_target?\n r_minF = s.tb_range_min if s.friendly_target?\n \n r_maxE = s.tb_range_max if s.hostile_target?\n r_minE = s.tb_range_min if s.hostile_target?\n \n (@max_s = s; max = r_max) if r_max && r_max > max\n (@min_s = s; min = r_min) if r_min && r_min < min\n \n (@max_sf = s; maxF = r_maxF) if r_maxF && r_maxF > maxF\n (@min_sf = s; minF = r_minF) if r_minF && r_minF < minF\n \n (@max_se = s; maxE = r_maxE) if r_maxE && r_maxE > maxE\n (@min_se = s; minE = r_minE) if r_minE && r_minE < minE\n end\n end",
"def get_limits\n # code\n end",
"def exploit\n # Is the selected target a brute force target?\n if (target.bruteforce?)\n # The step direction is automatically calculated\n direction = {}\n\n bf = target.bruteforce\n\n # Get the start and stop address hashes\n start = bf.start_addresses ? bf.start_addresses.dup : {}\n stop = bf.stop_addresses ? bf.stop_addresses.dup : {}\n step = bf.step_size\n delay = bf.delay\n\n # Enumerate each start address and try to figure out the direction\n start.each_pair { |name, addr|\n # If there's a stop address, figure out if it's above or below\n # the start address\n if (stop[name])\n if (stop[name] < addr)\n direction[name] = -1\n else\n direction[name] = 1\n end\n # If there's no stop address, infer the direction based on\n # the default\n else\n direction[name] = bf.default_direction\n end\n }\n\n # Import start/stop address overrides from the datastore\n import_from_datastore(start, 'Start')\n import_from_datastore(stop, 'Stop')\n\n # User-defined brute wait?\n if self.datastore['BruteWait'] and self.datastore['BruteWait'] > 0\n delay = self.datastore['BruteWait'].to_i\n end\n\n # User-defined brute step?\n if self.datastore['BruteStep'] and self.datastore['BruteStep'] > 0\n step = self.datastore['BruteStep'].to_i\n end\n\n # Sane defaults\n delay = 1 if delay.nil? or delay == 0\n\n # Okay, we've got all this crap out of the way, let's actually brute\n # force\n stopped = []\n curr = start.dup\n\n # Automatically determine the step size based off the nop sled length\n if step == 0\n step = payload.nop_sled_size\n\n if step == 0\n raise OptionValidateError.new(['BruteStep - The step size for this exploit is invalid'])\n end\n end\n\n # Keep going until we run out of options\n while (curr.length != stopped.length)\n\n # Stop brute forcing once a session is found\n break if session_created?\n\n # Fire off an exploit attempt with the supplied addresses\n brute_exploit(curr)\n\n # Give it time before we try again\n brute_wait(delay)\n\n # Scan each current key, increasing it or decreasing it by the\n # step size according to its direction\n curr.each_key { |k|\n\n # Has movement been stopped on this address? If so, skip it.\n next if (stopped.include?(k))\n\n # Calculate the next address before we move it to see if\n # we're going to go over\n next_addr = step * direction[k]\n\n # If this item has hit a stop address, add it to the stopped\n # hash and move it no further\n if (stop[k])\n if ((direction[k] == 1 and curr[k] + next_addr >= stop[k]) or\n (direction[k] == -1 and curr[k] + next_addr < stop[k]))\n stopped << k\n next\n end\n end\n\n # If it's not time to stop, move it\n curr[k] += next_addr\n }\n end\n else\n single_exploit\n end\n end",
"def limit=(x); @opts['limit'] = x; end",
"def item_limit\n 100\n end",
"def build_pet_with_limit\n return false if pets_limit_reached?\n\n pets.build\n end",
"def reputation_threshold_action\n :offer_reward\n end",
"def skl_p_limit(battler)\n return 5000\n end",
"def def\n apply_param_limiter(super + party_gift(:def) + spirit_defense)\n end",
"def default_limit\n 10\n end",
"def limit; end",
"def limit; end",
"def limit; end",
"def resource_limits; end",
"def resource_limits; end",
"def specific_allowed_targets=(value)\n @specific_allowed_targets = value\n end",
"def limit(value = 20)\n clone.tap { |crit| crit.options[:limit] = value.to_i }\n end",
"def build_limit(limit)\n if limit\n Arelastic::Searches::Size.new(limit)\n end\n end",
"def set_limits(config)\n \n limits = {hosts: nil, sites: nil}\n \n if config.core.has_key?(:limit)\n limits[:hosts] = config.core[:limit]['hosts']\n end\n \n options = config.ARGV\n \n if options && options.count > 0\n limits[:hosts] = options.first.split(',') \n limits[:sites] = options.last.split(',') if limits[:hosts].count == 1 && options.count == 2\n end\n \n limits\nend",
"def collect_multiples(limit)\n 1.upto(limit-1).find_all do |i| #limit-1 so it takes range from 1 upto limit, excluding limit (so if limit is 10, range will be 1-9)\n (i % 5 == 0) || (i % 3 == 0)\n end #end loop\nend",
"def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") unless library.include?(item_to_make)\n\n serving_size = library[item_to_make]\n\n remaining_ingredients = num_of_ingredients % serving_size\n\n puts \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n\n case\n when remaining_ingredients >= 7\n puts \"You can also make a pie.\"\n when (remaining_ingredients >= 5) && (remaining_ingredients < 7)\n puts \"You can also make a cake.\"\n when (remaining_ingredients >= 1) && (remaining_ingredients < 5)\n puts \"You can also make a cookie.\"\n end\nend",
"def collect_multiples\n (1..@limit).select{|num| num%3 == 0 || num%5 == 0}\n end",
"def limit(limit = nil)\n set_option(:limit, limit)\n end",
"def lower_power_limits!(percent_threshold: 0.8)\n # percent_threshold value should be between 0 and 1\n power_limit = current_power_limit\n new_power_limit = (power_limit * percent_threshold).to_i\n message_helper(\n \"Setting power limits from #{power_limit} to #{new_power_limit}\"\n )\n `sudo nvidia-smi -i #{i} -pl #{new_power_limits}`\n end",
"def candidate_limit(uuid); end",
"def make_limit_task(channel)\n limit_timestamp = \"#{$carddir}/#{channel}/.limits_computed\"\n carddir = $carddir #makes a copy so that if $cardir changes this does not\n file limit_timestamp => \"#{$carddir}/#{channel}/.creation_timestamp\" do |t|\n chdir(\"#{carddir}/#{channel}\") do\n sh \"ls -d [0-9]* | xargs -n 1 -P 10 -I {} compute_significance.sh {} #{$blind}\"\n end\n sh \"compute_limits.sh #{carddir}/#{channel} 10 #{$blind}\"\n end\n return limit_timestamp\nend",
"def specific_allowed_targets\n return @specific_allowed_targets\n end",
"def LimitsController(params, vmid, host = nil)\n onblock(:vm, vmid) do | vm |\n key = IONe::Settings['VCENTER_CPU_LIMIT_FREQ_PER_CORE'][host.name!].nil? ? 'default' : host.name!\n\n lim_res = vm.setResourcesAllocationLimits(\n cpu: params['cpu'] * IONe::Settings['VCENTER_CPU_LIMIT_FREQ_PER_CORE'][key],\n ram: params['ram'] * (params['units'] == 'GB' ? 1024 : 1), iops: params['iops']\n )\n unless lim_res.nil? then\n err, back = lim_res.split(\"<|>\")\n LOG_ERROR \"Limits was not set, error: #{err}\"\n LOG_DEBUG \"Limits was not set, error: #{err}\\n#{back}\"\n end\n end if ClusterType(host.id) == 'vcenter'\n end",
"def describe\n case @limit\n when 0\n \".never\"\n when 1\n \".once\"\n when 2\n \".twice\"\n else\n \".times(#{@limit})\"\n end\n end",
"def limited_tests\n strong_memoize(:limited_tests) do\n # rubocop: disable CodeReuse/ActiveRecord\n TestSummary.new(\n new_failures: new_failures.take(max_tests),\n existing_failures: existing_failures.take(max_tests(new_failures)),\n resolved_failures: resolved_failures.take(max_tests(new_failures, existing_failures)),\n new_errors: new_errors.take(max_tests),\n existing_errors: existing_errors.take(max_tests(new_errors)),\n resolved_errors: resolved_errors.take(max_tests(new_errors, existing_errors))\n )\n # rubocop: enable CodeReuse/ActiveRecord\n end\n end",
"def apply_limit amount\n\t\tif @limit.is_a? Integer\n\t\t\tlimit = @limit\n\t\telsif @limit.is_a? Hash\n\t\t\tlimit = @limit[$character.character_class.to_s]\n\t\telse\n\t\t\tlimit = 0\n\t\tend\n\n\t\tif limit <= 0\n\t\t\treturn amount\n\t\tend\n\t\tif limit < amount\n\t\t\treturn limit\n\t\tend\n\t\treturn amount\n\tend",
"def maximum_limit\n 100\n end",
"def rate_limit_by_ip(delay,*tags)\n key = \"limit:\"+tags.join(\".\")\n return true if $r.exists(key)\n $r.setex(key,delay,1)\n return false\nend",
"def calc_def_mod_deep_sea_scale(user, target)\n target.db_symbol == :clamperl ? 2 : 1\n end",
"def inspect_limit\n @inspect_limit || 500\n end",
"def targeting_items(types, tmp=false, accounts = :all)\n context_weight = (types.include?(:context) ? 1 : 0)\n behavior_weight = (types & [:behavior, :bool_behavior]).count > 0 ? 1 : 0 #SnapshotCluster.related_accounts(self).count : 0\n behavior_weight += (types & [:bool_behavior_new]).count > 0 ? 1 : 0 # change the weight of new behavioral targeting here\n tot_weight = context_weight + behavior_weight\n sc = types.map do |t|\n if (accounts == :all && t != :bool_behavior_new) || t == :context # don't recompute for context, we always use master only\n [t, self.get_scores(t, tmp)]\n elsif accounts == :all && t == :bool_behavior_new\n [t, self.get_scores(t, tmp)]\n elsif accounts != :all && t == :bool_behavior_new\n [t, self.compute_scores_bool_behavior_new(tmp, accounts)]\n else\n [t, self.compute_scores(t, tmp, accounts)]\n end\n end.reduce(Hash.new(0)) do |glbl, s|\n weight = s.first == :context ? context_weight : behavior_weight\n s = s.last\n s.keys.each do |k|\n score = weight * s[k].to_f / tot_weight\n glbl[k] += score.nan? ? 0 : score\n end\n glbl\n end\n\n # void_score = sc.delete('')\n max_sc = sc.values.select { |n| !n.to_f.nan? }.max\n cands = sc.select do |id, score|\n !score.to_f.nan? && score >= max_sc * 0.9 && id != \"\" && id && id != \"garbage\"\n end\n\n return [] if cands.count > 2 # || void_score > 2 * max_sc\n cands.keys\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def make_limit_task(channel)\n limit_timestamp = \"#{$carddir}/#{channel}/.limits_computed\"\n file limit_timestamp => \"#{$carddir}/#{channel}/.creation_timestamp\" do |t|\n sh \"compute_limits.sh #{$carddir}/#{channel} 10 #{$blind}\"\n end\n return limit_timestamp\nend",
"def limits\n c = get_connection\n result = c.limits[:absolute]\n {:max_instances => result[:maxTotalInstances],\n :max_cpus => result[:maxTotalCores],\n :max_ram => result[:maxTotalRAMSize],\n :used_instances => result[:totalInstancesUsed],\n :used_cpus => result[:totalCoresUsed],\n :used_ram => result[:totalRAMUsed]}\n end",
"def limits\n c = get_connection\n result = c.limits[:absolute]\n {:max_instances => result[:maxTotalInstances],\n :max_cpus => result[:maxTotalCores],\n :max_ram => result[:maxTotalRAMSize],\n :used_instances => result[:totalInstancesUsed],\n :used_cpus => result[:totalCoresUsed],\n :used_ram => result[:totalRAMUsed]}\n end",
"def retirement_range\n #large simulation\n (1..30)\n end",
"def is_pokemon_strong_against(launcher, target)\n useless = true\n max_mod = 0\n # Useless check\n launcher.skills_set.each do |skill|\n if !skill.status?\n if (mod = BattleEngine::_type_modifier_calculation(target, skill)) > 0\n useless = false\n max_mod = mod if mod > max_mod\n end\n end\n end\n return nil if useless\n return true if max_mod >= 2\n return false\n end",
"def limit\n meta.fetch('limit', nil)\n end",
"def set_resource_limits(app, search_cluster, memory, disk, address_space, reporter_noise_level = nil)\n if @block_feed_in_distributor\n set_proton_limits(search_cluster, 1.0, 1.0, 1.0)\n set_cluster_controller_limits(app, search_cluster, memory, disk, address_space)\n else\n set_proton_limits(search_cluster, memory, disk, address_space)\n set_cluster_controller_limits(app, search_cluster, 1.0, 1.0, 1.0)\n end\n if reporter_noise_level != nil\n search_cluster.config(get_filestor_config(reporter_noise_level))\n end\n end",
"def limit\n @options[:limit]\n end",
"def print_recommended_targets\n find_target_sample = self.recommended_targets.sample(5)\n\n puts \"Recommended Targets\".bold.underline\n puts \"Your Attack Power: #{self.power}\".italic.blue\n find_target_sample.each_with_index do |target , i|\n\n #display the target's name and relevant stats\n puts \"***********************\".bold.red\n puts \"#{i+1}. #{target.name}\".bold.blue.on_light_yellow\n puts \" ID: #{target.id}\".bold\n puts \" Attack Power:#{target.power}\"\n puts \" HP: #{target.hp}\"\n end\n puts \"***********************\".bold.red\n\n #return the target sample objects\n find_target_sample\n\n end",
"def req_limit_check block=nil\n\t\t\tif @reqs[:cnt] >= @req_limit && Time.now <= @reqs[:next_check]\n\t\t\t # limit reached, execute the optional block and sleep until next_check\n\t\t\t\tsecs = (@reqs[:next_check] - Time.now + 1).to_i\n\t\t\t\tlog? && GLogg.log_d2? && GLogg.log_d2(sprintf( #_\n\t\t\t\t\t\t'Curburger::Request#req_limit_check: Request limit ' + #_\n\t\t\t\t\t\t\"(%u per %usecs) reached.\\n Sleeping %u seconds.\", #_\n\t\t\t\t\t\t@req_limit, @req_time_range, secs)) #_\n\t\t\t\tif block\n\t\t\t\t\tblock.call\n\t\t\t\t\tsecs = (@reqs[:next_check] - Time.now + 1).to_i # recompute\n\t\t\t\t\tlog? && GLogg.log_d3? && GLogg.log_d3(sprintf( #_\n\t\t\t\t\t\t\t'Curburger::Request#req_limit_check: ' + #_\n\t\t\t\t\t\t\t'Block executed, sleeping %usecs.', secs > 0 ? secs : 0)) #_\n\t\t\t\tend\n\t\t\t\tsleep secs if secs > 0\n\t\t\tend\n\t\t\tif Time.now > @reqs[:next_check] # reset the counter\n\t\t\t\tlog? && GLogg.log_d3? && GLogg.log_d3(sprintf( #_\n\t\t\t\t\t\t'Curburger::Request#req_limit_check: Resetting counter ' + #_\n\t\t\t\t\t\t'(%u/%u requests done).', @reqs[:cnt], @req_limit)) #_\n\t\t\t\t@reqs[:cnt], @reqs[:next_check] = 0, Time.now + @req_time_range\n\t\t\tend\n\t\tend",
"def limit\n @request.params[:limit] || 10\n end",
"def collect_multiples(limit)\n multiples = []\n\n for i in 1...limit do\n if (i % 5 == 0 || i % 3 == 0)\n multiples << i\n end\n end\n\n return multiples\n\nend",
"def set_search_time_limit(opts)\n opts = check_params(opts,[:time_limits])\n super(opts)\n end",
"def set_limit(amount)\r\n fail \"no valid limit\" if !amount.nil? && amount<0\r\n\r\n self.limit=amount\r\n end",
"def optimize_start_get_answerers *args\n sleep(5)\n \n # A solution for when nelder mead reaches a negative number\n args.each do |a|\n if a < 0\n return 999999999999\n end\n end\n \n mlt_parsed_partial_config = {\n 'mlt.mindf' => args[0].to_i,\n 'mlt.minwl' => args[1].to_i,\n 'mlt.maxqt' => args[2].to_i,\n 'titleBoost' => args[3],\n 'tagsBoost' => args[4]\n }\n \n # Use this to optimize get questions\n body_query_answerer_parsed_partial_config = {\n #'mindf' => args[5].to_i,\n #'bodyboost' => args[6]\n }\n \n # Use this to optimize get answerers\n body_query_question_parsed_partial_config = {\n 'mindf' => args[5].to_i,\n 'bodyboost' => args[6]\n }\n \n update_engine_config mlt_parsed_partial_config, body_query_answerer_parsed_partial_config, body_query_question_parsed_partial_config\n (number_of_good_questions, number_of_bad_questions) = start_get_answerers(@questions)\n number_of_questions = number_of_good_questions + number_of_bad_questions\n puts\n puts \"##############################################\"\n puts\n puts \"#{Time.now} Result for config #{mlt_parsed_partial_config} AND #{body_query_answerer_parsed_partial_config} AND #{body_query_question_parsed_partial_config} is: #{number_of_bad_questions} / #{number_of_questions}\"\n puts\n puts \"##############################################\"\n puts\n \n open('results.txt', 'a') { |f|\n f << \"#{Time.now} Result for config #{mlt_parsed_partial_config} AND #{body_query_answerer_parsed_partial_config} AND #{body_query_question_parsed_partial_config} is: #{number_of_bad_questions} / #{number_of_questions} \\n\"\n }\n \n return number_of_bad_questions\n end",
"def calc_def_mod_marvel_scale(user, target)\n return 1.5 if target.paralyzed? || target.poisoned? || target.toxic? || target.burn? || target.asleep? ||\n target.frozen?\n return 1\n end",
"def limit(val)\n @params[:retmax] = val\n self\n end",
"def timelimit\n 15.minutes\n end",
"def ms_uniform(item_id, limit=1)\n return limit\nend",
"def limit\r\n if @organisation.is_admin?(@user) || @organisation.limit.nil?\r\n nil\r\n else\r\n resources = @organisation.limit - @spend\r\n resources < 0 ? 0 : resources\r\n end\r\n end",
"def atk\n apply_param_limiter(super + party_gift(:atk) + spirit_attack)\n end",
"def rate_limit_by_ip(delay,*tags)\n key = \"limit:\"+tags.join(\".\")\n return true if $r.exists(key)\n $r.setex(key,delay,1)\n return false\n end",
"def test_it_can_find_golden_items_from_threshold\n threshold = 605_1\n assert_equal 5, @sa.find_golden_items(@se.items.all, threshold).count\n end"
] |
[
"0.5931172",
"0.5904957",
"0.5888078",
"0.5715984",
"0.5539332",
"0.5521522",
"0.5501443",
"0.54668885",
"0.53805864",
"0.5379604",
"0.53373045",
"0.53369284",
"0.5294135",
"0.527094",
"0.5233742",
"0.52039456",
"0.52034837",
"0.51781416",
"0.51719743",
"0.5101237",
"0.5095548",
"0.5095418",
"0.50928104",
"0.50928104",
"0.50928104",
"0.5091294",
"0.5091294",
"0.5087934",
"0.50636214",
"0.50586295",
"0.50249004",
"0.5010876",
"0.5006065",
"0.49874997",
"0.4976074",
"0.49725032",
"0.49704942",
"0.49644545",
"0.49629945",
"0.4953096",
"0.49420002",
"0.49135998",
"0.49044755",
"0.4894053",
"0.48886493",
"0.48879048",
"0.4885597",
"0.48744825",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48714757",
"0.48619586",
"0.485939",
"0.485939",
"0.48555785",
"0.4849924",
"0.48498902",
"0.48478568",
"0.484261",
"0.48359862",
"0.48339587",
"0.48339245",
"0.48332193",
"0.4832199",
"0.48299053",
"0.48266777",
"0.48230413",
"0.48214537",
"0.48176873",
"0.48148403",
"0.4812882",
"0.48060948",
"0.48021063",
"0.47959208"
] |
0.5111062
|
19
|
Backgroundonly f3 postfit plots, to convince yourself and the others (but mostly the others) that the background estimation is fine
|
def make_f3_postfit_shapes_task(channel)
shape_file = "results/#{$jobid}/plots/#{channel}/f3/postfit/#{channel}_f3_postfit_shapes.root"
carddir = $carddir #makes a copy so that if $cardir changes this does not
file shape_file => "#{$carddir}/#{channel}/.pulls_computed" do |t|
sh "mkdir -p `dirname #{t.name}`"
sh "cp #{carddir}/#{channel}/shapes.root #{t.name}" #FIXME this may create to rake some problems if next command fails!
sh "#{ENV['CMSSW_BASE']}/src/HiggsAnalysis/HiggsToTauTau/test/postfit.py #{t.name} #{$carddir}/#{channel}/120/vhtt_#{channel}.txt --verbose --bins #{$categories_map[channel].join(' ')} --fitresults #{$carddir}/#{channel}/120/out/mlfit.txt"
end
return shape_file
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def setup\n \n size 640, 360, P3D\n \n no_stroke\n color_mode RGB, 1\n fill 0.4\n \nend",
"def setup\n \n size 640, 360, P3D\n \n no_stroke\n fill 204\n \nend",
"def isDarkBackground(background,rect=nil)\n return true if !background || background.disposed?\n rect=background.rect if !rect\n return true if rect.width<=0 || rect.height<=0\n xSeg=(rect.width/16)\n xLoop=(xSeg==0) ? 1 : 16\n xStart=(xSeg==0) ? rect.x+(rect.width/2) : rect.x+xSeg/2\n ySeg=(rect.height/16)\n yLoop=(ySeg==0) ? 1 : 16\n yStart=(ySeg==0) ? rect.y+(rect.height/2) : rect.y+ySeg/2\n count=0\n y=yStart\n r=0; g=0; b=0\n yLoop.times {\n x=xStart\n xLoop.times {\n clr=background.get_pixel(x,y)\n if clr.alpha!=0\n r+=clr.red; g+=clr.green; b+=clr.blue\n count+=1\n end\n x+=xSeg\n }\n y+=ySeg\n }\n return true if count==0\n r/=count\n g/=count\n b/=count\n return (r*0.299+g*0.587+b*0.114)<128\nend",
"def setup \n size 640, 360, P3D \n @r_size = width / 6.0\n @a = 0.0 \n no_stroke\n fill 204, 204 \nend",
"def setup\n size 640, 360, P3D\n no_stroke\nend",
"def create_background\n add_disposable @background = UI::BlurScreenshot.new(@__last_scene)\n @background.opacity -= 255 / ENTERING_ANIMATION_DURATION * ENTERING_ANIMATION_DURATION\n end",
"def setup\n size 640, 360, P3D\n @img = load_image 'berlin-1.jpg'\n no_stroke\nend",
"def update_background\n @background.x, @background.y, @background.z = 0,0,self.z - 1 #self.x, self.y, self.z - 1\n end",
"def flamegraph_mode; end",
"def setup\n size 640, 360, P3D\n no_stroke \n @box_size = 40\n @margin = @box_size * 2\n @depth = 400\nend",
"def background; end",
"def axes3d(*)\n super\n end",
"def setscalefactors3d(*)\n super\n end",
"def paint_background(options = HashWithIndifferentAccess.new)\n options.reverse_merge! theme[:background] if theme[:background]\n if options\n if image = options[:image]\n image = Textures::Texture.new(engine.find_file(image)).send(:image)#engine.image(options[:image]).image_list\n if options[:mode] == :tile or options[:mode].nil?\n graphics_context.composite_tiled!(image, OverCompositeOp)#AtopCompositeOp)\n else #scale\n image.resize!(width, height)\n graphics_context.composite!(image, 0, 0, OverCompositeOp)#AtopCompositeOp)\n end\n end\n if arr = options[:effect] || options[:effects]\n paint_effects! graphics_context, arr\n end\n end\n end",
"def test_has_transparent_foreground_on_bright_green_background\n Waveform.generate(fixture_asset(\"sample.wav\"), output(\"background_color-#00ff00+color-transparent.png\"), :background_color => \"#00ff00\", :color => :transparent)\n\n image = open_png(output(\"background_color-#00ff00+color-transparent.png\"))\n\n assert_equal ChunkyPNG::Color.from_hex(\"#00ff00\"), image[0, 0]\n assert_equal ChunkyPNG::Color::TRANSPARENT, image[60, 120]\n end",
"def reset_fogs(new_fog_data)\n @fogs.each { |fog| fog.opacity = 0; fog.dispose }\n setup_fogs(new_fog_data)\n end",
"def compose_precise(fg, bg)\n return fg if opaque?(fg) || fully_transparent?(bg)\n return bg if fully_transparent?(fg)\n \n fg_a = a(fg).to_f / MAX\n bg_a = a(bg).to_f / MAX\n a_com = (1.0 - fg_a) * bg_a\n\n new_r = (fg_a * r(fg) + a_com * r(bg)).round\n new_g = (fg_a * g(fg) + a_com * g(bg)).round\n new_b = (fg_a * b(fg) + a_com * b(bg)).round\n new_a = ((fg_a + a_com) * MAX).round\n rgba(new_r, new_g, new_b, new_a)\n end",
"def compose_precise(fg, bg)\n return fg if opaque?(fg) || fully_transparent?(bg)\n return bg if fully_transparent?(fg)\n\n fg_a = a(fg).to_f / MAX\n bg_a = a(bg).to_f / MAX\n a_com = (1.0 - fg_a) * bg_a\n\n new_r = (fg_a * r(fg) + a_com * r(bg)).round\n new_g = (fg_a * g(fg) + a_com * g(bg)).round\n new_b = (fg_a * b(fg) + a_com * b(bg)).round\n new_a = ((fg_a + a_com) * MAX).round\n rgba(new_r, new_g, new_b, new_a)\n end",
"def has_background?\n !@background.nil?\n end",
"def setup\n size(640, 360)\n background(102)\nend",
"def draw_background(options={})\n settings = {z: -1, fixed: true}.merge(options)\n show_shape(:background, settings)\n end",
"def inqwindow3d\n inquiry([:double] * 6) do |*pts|\n super(*pts)\n end\n end",
"def inqwindow3d\n inquiry([:double] * 6) do |*pts|\n super(*pts)\n end\n end",
"def render_background\n render_unvisited\n render_grid_lines\n end",
"def create_backgrounds\n create_over\n create_hud_bg\n create_under\n create_flow\n end",
"def visit_background(background)\n tc_before_background(background)\n super\n tc_after_background(background)\n end",
"def draw_background\n @background.draw\n end",
"def render_background\n render_unvisited\n render_grid_lines\n render_labels\n end",
"def mode3d\n begin_mode3d\n begin\n yield\n ensure\n self.class.end_mode3d\n end\n end",
"def use_axes?\n end",
"def transparency_mode\n super\n end",
"def flamegraph_mode=(_arg0); end",
"def apply_post_processing?\n if self.has_default_image?\n return false\n else\n return true\n end\n end",
"def no_scale_mask?\n end",
"def has_custom_background?\n !self.background_image_file_name.blank? || !self.background_color.blank?\n end",
"def update!(**args)\n @background_attachment = args[:background_attachment] if args.key?(:background_attachment)\n @background_color_argb = args[:background_color_argb] if args.key?(:background_color_argb)\n @background_gradient_color_stop_argb = args[:background_gradient_color_stop_argb] if args.key?(:background_gradient_color_stop_argb)\n @background_gradient_repeat = args[:background_gradient_repeat] if args.key?(:background_gradient_repeat)\n @background_gradient_type = args[:background_gradient_type] if args.key?(:background_gradient_type)\n @background_image_repeat = args[:background_image_repeat] if args.key?(:background_image_repeat)\n @background_image_url = args[:background_image_url] if args.key?(:background_image_url)\n @background_image_x_pos = args[:background_image_x_pos] if args.key?(:background_image_x_pos)\n @background_image_y_pos = args[:background_image_y_pos] if args.key?(:background_image_y_pos)\n @background_size = args[:background_size] if args.key?(:background_size)\n @background_size_height = args[:background_size_height] if args.key?(:background_size_height)\n @background_size_width = args[:background_size_width] if args.key?(:background_size_width)\n @border_color_argb_bottom = args[:border_color_argb_bottom] if args.key?(:border_color_argb_bottom)\n @border_color_argb_left = args[:border_color_argb_left] if args.key?(:border_color_argb_left)\n @border_color_argb_right = args[:border_color_argb_right] if args.key?(:border_color_argb_right)\n @border_color_argb_top = args[:border_color_argb_top] if args.key?(:border_color_argb_top)\n @border_pixel_width_bottom = args[:border_pixel_width_bottom] if args.key?(:border_pixel_width_bottom)\n @border_pixel_width_left = args[:border_pixel_width_left] if args.key?(:border_pixel_width_left)\n @border_pixel_width_right = args[:border_pixel_width_right] if args.key?(:border_pixel_width_right)\n @border_pixel_width_top = args[:border_pixel_width_top] if args.key?(:border_pixel_width_top)\n @border_style_bottom = args[:border_style_bottom] if args.key?(:border_style_bottom)\n @border_style_left = args[:border_style_left] if args.key?(:border_style_left)\n @border_style_right = args[:border_style_right] if args.key?(:border_style_right)\n @border_style_top = args[:border_style_top] if args.key?(:border_style_top)\n @clip = args[:clip] if args.key?(:clip)\n @direction = args[:direction] if args.key?(:direction)\n @display_prop = args[:display_prop] if args.key?(:display_prop)\n @font_family = args[:font_family] if args.key?(:font_family)\n @font_size = args[:font_size] if args.key?(:font_size)\n @font_style = args[:font_style] if args.key?(:font_style)\n @font_weight = args[:font_weight] if args.key?(:font_weight)\n @foreground_color_argb = args[:foreground_color_argb] if args.key?(:foreground_color_argb)\n @has_background = args[:has_background] if args.key?(:has_background)\n @list_style_image_url = args[:list_style_image_url] if args.key?(:list_style_image_url)\n @list_style_type = args[:list_style_type] if args.key?(:list_style_type)\n @margin_bottom = args[:margin_bottom] if args.key?(:margin_bottom)\n @margin_left = args[:margin_left] if args.key?(:margin_left)\n @margin_right = args[:margin_right] if args.key?(:margin_right)\n @margin_top = args[:margin_top] if args.key?(:margin_top)\n @opacity = args[:opacity] if args.key?(:opacity)\n @overflow_x = args[:overflow_x] if args.key?(:overflow_x)\n @overflow_y = args[:overflow_y] if args.key?(:overflow_y)\n @padding_bottom = args[:padding_bottom] if args.key?(:padding_bottom)\n @padding_left = args[:padding_left] if args.key?(:padding_left)\n @padding_right = args[:padding_right] if args.key?(:padding_right)\n @padding_top = args[:padding_top] if args.key?(:padding_top)\n @position = args[:position] if args.key?(:position)\n @referenced_resource_index = args[:referenced_resource_index] if args.key?(:referenced_resource_index)\n @text_align = args[:text_align] if args.key?(:text_align)\n @text_decoration = args[:text_decoration] if args.key?(:text_decoration)\n @text_shadow_color_argb = args[:text_shadow_color_argb] if args.key?(:text_shadow_color_argb)\n @visibility = args[:visibility] if args.key?(:visibility)\n @z_index = args[:z_index] if args.key?(:z_index)\n end",
"def setup\n size 640, 300, P3D\n @lens_d = 160\n @lens_list = []\n @xx, @yy, @dx, @dy = 0, 0, 3, 3\n \n # Create buffered image for lens effect.\n @lens_effect = create_graphics(width, height, P2D)\n \n # Load background image.\n @lens_effect.begin_draw\n @lens_effect.image(load_image('red_smoke.jpg'), 0, 0, width, height)\n @lens_effect.end_draw\n image(@lens_effect, 0, 0, width, height)\n \n # Create buffered image for warping.\n @lens_image = create_graphics(@lens_d, @lens_d, P2D)\n @lens_image2 = create_graphics(@lens_d, @lens_d, P2D)\n \n compute_lens_transformation\nend",
"def setwindow3d(*)\n super\n end",
"def pbBGMFade(x=0.0); pbBGMStop(x);end",
"def initial_fill alpha\n alpha_top.wmes.each do |wme|\n alpha.activate wme if wme =~ alpha.template\n end\n end",
"def fit_graphics(*args)\n @p.fit_graphics(self, *args)\n end",
"def begin_figure\n # do nothing\n end",
"def setup_backdrop_transition\n hash_setup = BACKDROP_TRANS_DEFAULT.merge(@acts[1])\n $game_temp.backdrop.trans_setup(hash_setup)\n end",
"def background?\n !@background.nil?\n end",
"def setup\n size(750, 200)\n background(255)\n smooth\n\n @r = 0\n @theta = 0\nend",
"def inqscalefactors3d\n inquiry %i[double double double] do |*opts|\n super(*opts)\n end\n end",
"def inqscalefactors3d\n inquiry %i[double double double] do |*opts|\n super(*opts)\n end\n end",
"def patches\n # Fix conflict when OpenEXR is installed. See:\n # http://tech.groups.yahoo.com/group/OpenCV/message/83201\n DATA\n end",
"def setup_triangles(background)\n gc = Magick::Draw.new\n gc.stroke_width(2)\n gc.stroke(\"red\")\n gc.fill(\"blue\")\n # all the triangles are part of the same body\n body = CP::Body.new(Float::MAX, Float::MAX)\n base = 15\n height = 10\n shape_vertices = [CP::Vec2.new(-base, base), CP::Vec2.new(base, base), CP::Vec2.new(0, -height)]\n # make shapes and images\n 8.times do |i|\n 8.times do |j|\n stagger = (j % 2) * 40\n x = i * 80 + stagger\n y = j * 70 + 80\n shape = CP::Shape::Poly.new(body, shape_vertices, CP::Vec2.new(x, y))\n shape.e = 1\n shape.u = 1\n @space.add_static_shape(shape)\n gc.polygon(x - base + 1, y + base - 1, x + base - 1, y + base - 1, x, y - height + 1)\n end\n end\n # do the drawing\n gc.draw(background)\n end",
"def detect_transparent_form(form)\n xobject = form.xobject\n group = deref(xobject.hash[:Group])\n stype = deref(group[:S]) if group\n\n if stype == :Transparency\n bbox = xobject.hash[:BBox] || @page.attributes[:MediaBox]\n bbox = translate_to_device_space(bbox)\n @issues << Issue.new(1, \"pdfview\", \"Arquivo com transparência:\", self, :page => @page.number,\n :top_left => bbox[:tl],\n :bottom_left => bbox[:bl],\n :bottom_right => bbox[:br],\n :top_right => bbox[:tr])\n end\n end",
"def cleanup image\n m_begin \"cleanup\"\n img = get_image(image)\n img = img.gaussian_blur(8)\n img = img.threshold((QuantumRange * 0.999).to_int)\n img = img.gaussian_blur(14)\n img = img.threshold(0)\n m_end \"cleanup\"\n set_variable(image, img)\n end",
"def background?\n @background\n end",
"def apply_post_processing?\n if self.is_video?\n return true\n elsif self.is_image?\n if self.is_seed\n return true\n end \n else \n return false \n end\n end",
"def background(background)\n @background = YARD::CodeObjects::Lucid::Scenario.new(@feature,\"background\") do |b|\n b.comments = background[:comments] ? background[:comments].map{|comment| comment.value}.join(\"\\n\") : ''\n b.description = background[:description] || ''\n b.keyword = background[:keyword]\n b.value = background[:name]\n b.add_file(@file,background[:location][:line])\n end\n\n @feature.background = @background\n @background.feature = @feature\n @step_container = @background\n background[:steps].each { |s| step(s) }\n end",
"def fit; end",
"def translucent_alpha\n return 160\n end",
"def final_effect(_effects); end",
"def bg(*values); end",
"def bg(*values); end",
"def mask(image, before, after, bg = WHITE, tolerance = 0.5)\n new_image = ChunkyPNG::Image.new(image.width, image.height, TRANSPARENT)\n image.width.times{ |x|\n image.height.times{ |y|\n score = euclidean_distance_rgba(image[x,y], before).to_f / MAX_EUCLIDEAN_DISTANCE_RGBA\n if score < tolerance then new_image[x,y] = ChunkyPNG::Color.compose(after, bg) end\n }\n }\n new_image\nend",
"def efg\n return 0.0 if fg.zero? || fga.zero?\n\n ((fg.to_f + 0.5 * three_p.to_f)/fga).round(3)\n end",
"def draw_effect\n end",
"def FT_HAS_FIXED_SIZES(face)\n face.face_flags & FaceFlag[:FIXED_SIZES]\n end",
"def generate_perlin(window,seed)\n borders(window)\n w_y = []\n w_x = []\n Ncurses.getmaxyx(window,w_x,w_y)\n random_seed = seed\n n3d = Perlin::Noise.new 3, :interval => 100, :seed => random_seed\n contrast = Perlin::Curve.contrast(Perlin::Curve::CUBIC, 3)\n Ncurses.init_pair(1, 8, 15)\n Ncurses.wattron(window,Ncurses.COLOR_PAIR(1))\n 1.step(w_x[0] - 2, 1.0) do |x| # x == whole integer, which will always give .5\n 1.step(w_y[0] - 2, 1.0) do |y|\n \n i = (x / w_x[0]) * 10 # (0.01..1.00) * 10 == (.1..9.9)\n j = (y / w_y[0]) * 10 # (0.01..1.00) * 10 == (.1..9.9)\n\n n = n3d[i,j,0.8]\n #n = contrast.call n\n if n > 0.4 and n < 0.7\n Ncurses.mvwaddstr(window, x, y, \"~\")\n else\n Ncurses.mvwaddstr(window, x, y, \"#\")\n end\n end\n end\n Ncurses.wattroff(window,Ncurses.COLOR_PAIR(1))\nend",
"def bgsave; end",
"def bgsave; end",
"def transparent!\n @transparency = 1.0\n self\n end",
"def flush_figures\n # TODO: I want to allow users to turn on/off automatic figure closing.\n show_figures(true)\n end",
"def render_transparent_background(columns, rows)\n Magick::Image.new(columns, rows) do |img|\n img.background_color = 'transparent'\n end\n end",
"def setup\n size 640, 360 \n @bar_width = 20\n @hue = Array.new( (width/@bar_width), 0 ) \n color_mode HSB, height\n no_stroke\n background 0\nend",
"def make_plots(pars,cov_matrix)\n PWA::Dataset.each{|dataset|\n\tnext unless dataset.type == :evt\n\tcind = @canvases.length\n @canvases.push ::TCanvas.new(\"dsigma_canvas_#{cind}\",'',25 + 50*cind,\n 25,500,500)\n\t@canvases.last.cd\n\tgPad.SetLogy if @log\n\tname = \"#{dataset.name}_#{@kv}\"\n\t#\n\t# data histo\n\t#\n\ttitle,num_bins,min,max,bins,bin_errors = dataset.histo_bins([@kv],pars,\n\t\t\t\t\t\t\t\t :unwtd,\n\t\t\t\t\t\t\t\t :data)\n\th_data = TH1F.new(\"h_#{name}_data\",name,num_bins,min,max)\n\th_data.Sumw2\n\tbins.each_index{|b| \n\t h_data.SetBinContent(b+1,bins[b])\n\t h_data.SetBinError(b+1,bin_errors[b])\n\t}\n\th_data.GetXaxis.SetTitle title\n\th_dsigma = TH1F.new(\"h_#{name}_dsigma\",name,num_bins,min,max)\n\th_dsigma.Sumw2\n\tbins.each_index{|b| \n\t h_dsigma.SetBinContent(b+1,bins[b])\n\t h_dsigma.SetBinError(b+1,bin_errors[b])\n\t}\n\th_dsigma.GetXaxis.SetTitle title\n\t#\n\t# acc histo\n\t#\n\tdataset.read_in_amps(PWA::ParIDs.max_id,:acc)\n\tdataset.read_in_norm(:acc)\n\tacc_yield = dataset.calc_yield(pars,'.',:acc)\n\ttitle,num_bins,min,max,bins,bin_errors = dataset.histo_bins([@kv],pars,'.',:acc)\n\th_acc = TH1F.new(\"h_#{name}_acc\",name,num_bins,min,max)\n\th_acc.Sumw2\n\tbins.each_index{|b| \n\t h_acc.SetBinContent(b+1,bins[b])\n\t h_acc.SetBinError(b+1,bin_errors[b])\n\t}\n\th_acc.GetXaxis.SetTitle title\n\tintegral = h_acc.Integral\n\th_acc.Scale(acc_yield/integral) if(integral > 0)\n\t#\n\t# raw histo\n\t#\n\tdataset.read_in_amps(PWA::ParIDs.max_id,:raw)\n\tdataset.read_in_norm(:raw)\n\traw_yield = dataset.calc_yield(pars,'.',:raw)\n\ttitle,num_bins,min,max,bins,bin_errors = dataset.histo_bins([@kv],pars,'.',:raw)\n\th_raw = TH1F.new(\"h_#{name}_raw\",name,num_bins,min,max)\n\th_raw.Sumw2\n\tbins.each_index{|b| \n\t h_raw.SetBinContent(b+1,bins[b])\n\t h_raw.SetBinError(b+1,bin_errors[b])\n\t}\n\th_raw.GetXaxis.SetTitle title\n\tintegral = h_raw.Integral\n\th_raw.Scale(raw_yield/integral) if(integral > 0)\n @histos.push h_acc\n @histos.push h_raw\n #\n\t# get dsigma\n\t#\n\th_dsigma.Divide(h_acc) \n\th_dsigma.Multiply(h_raw)\n\trange = max - min\n\th_dsigma.Scale(num_bins/range)\n #\n # get normalization error\n #\n rel_err_norm = dataset.get_norm_rel_err\n\t#\n\t# make the graph\n\t#\n\tx,y,xerr,yerr = [],[],[],[]\n\tnum_bins = h_dsigma.GetNbinsX\n\tnum_pts = num_bins\n\tnum_pts = @num_pts unless @num_pts.nil?\n\tnum_pts.times{|p|\n\t dsigma,error2,non_zero_bins,centroid = 0,0,0,0\n\t (num_bins/num_pts).times{|b|\n\t bin = (num_bins/num_pts)*p + b + 1\n\t bin_content = h_dsigma.GetBinContent(bin)\n\t bin_error = h_dsigma.GetBinError(bin)\n\t next unless bin_content > 0\n\t non_zero_bins += 1\n\t dsigma += bin_content\n\t error2 += bin_error**2\n\t centroid += h_dsigma.GetBinCenter(bin)\n\t }\n\t next if(non_zero_bins == 0)\n\t x.push centroid/non_zero_bins.to_f\n\t xerr.push 0.5*non_zero_bins*(range/num_bins.to_f)\n\t y.push dsigma/non_zero_bins.to_f\n err2 = error2 + (rel_err_norm*dsigma)**2\n\t yerr.push Math.sqrt(err2)/non_zero_bins.to_f\t \n\t}\n\tgr_sigma = TGraphErrors.new(x.length,x,y,xerr,yerr)\n\twbin = *(dataset.name.match(/Wbin\\d+-\\d+/))\n\tgr_sigma.SetName \"gr_#{name}_#{wbin}\"\n\ttitle = wbin\n\tgr_sigma.SetTitle title\n\tgr_sigma.SetMarkerStyle 20\n\tgr_sigma.Draw 'ap'\n\t@graphs.push gr_sigma\n\tgPad.Update\n }\n end",
"def use_hidden_layers?\n end",
"def setup\n size 200, 200 \n no_stroke\n background 0 \n c = load_image \"cait.jpg\" \n xoff, yoff = 0, 0\n p = 2\n pix = p * 3 \n (c.width * c.height).times do |i| \n pixel = c.pixels[i] \n fill red( pixel ), 0, 0\n rect xoff, yoff, p, pix \n fill 0, green( pixel ), 0\n rect xoff+p, yoff, p, pix \n fill 0, 0, blue( pixel )\n rect xoff+p*2, yoff, p, pix \n xoff += pix\n if xoff >= (width-pix)\n xoff = 0\n yoff += pix\n end\n end \nend",
"def setup\n size 640, 360\n color_mode HSB, 360\n no_stroke \n @bar_width = 20\n @saturation = Array.new( width/@bar_width, 0 ) \nend",
"def addBackgroundPlane(sprites,planename,background,viewport=nil)\n sprites[planename]=AnimatedPlane.new(viewport)\n bitmapName=pbResolveBitmap(\"Graphics/Pictures/#{background}\")\n if bitmapName==nil\n # Plane should exist in any case\n sprites[planename].bitmap=nil\n sprites[planename].visible=false\n else\n sprites[planename].setBitmap(bitmapName)\n for spr in sprites.values\n if spr.is_a?(Window)\n spr.windowskin=nil\n end\n end\n end\nend",
"def initialize(p, opts, x, y, width, height, padLeft, padRight, padTop, padBottom, app)\n \n @parentApp = app #Stores the parent app for the initialization of image data later in the code.\n \n @drawColor = FXRGB(255, 0, 0) #variable that stores the active draw color\n @mouseDown = false #checks if mouse is depressed\n #@dirty = false #Checks if canvas has data in it\n @brushSize = 1 #stores the active brush size\n @parent = p #stores the parent app for object initialization\n @canvasWidth = width #stores the current canvas width\n @canvasHeight = height #stores the current canvas height\n \n @layerArray = Array.new #stores hide/show state of each layer.\n @imageArray = Array.new #stores the image data of each layer.\n @dirtyArray = Array.new #stores the dirty status of each layer.\n @activeIndex = 0\n \n @saved = false #Checks if the image has been saved.\n @savePath = \"\" #Stores the image save path\n\n #The horitzontal frame that stores the verticle frame. \n @parentFrame = FXHorizontalFrame.new(p, opts, x, y, width, height, \n padLeft, padRight, padTop, padBottom)\n \n #Canvas Frame is the vertical frame that stores the canvas.\n @canvas_frame = FXVerticalFrame.new(@parentFrame,FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_LEFT, \n 0, 0, 0, 0, 0, 0, 0, 0) \n \n #exportImage stores the image data that is saved.\n @exportImage = FXPNGImage.new(app, nil, @canvasWidth, @canvasHeight)\n \n @exportImage.create #initializes the image object.\n @exportImage.resize(@canvasWidth, @canvasHeight) #Sizes the image to match canvas width and height\n \n #Stores the image that is in the active layer.\n createImage() #Calls the createImage method. \n @activeImage = @imageArray[@activeIndex] #Sets the active image to the image stored in the first index of the imageArray\n \n \n #canvas stores the canvas object that is draw on.\n @canvas = FXCanvas.new(@canvas_frame, nil, 0, LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT|LAYOUT_TOP|LAYOUT_LEFT, 0, 0, width, height) \n \n #On creation, connect to the SEL_Paint handler. Every time the canvas changes, the canvas is repainted.\n @canvas.connect(SEL_PAINT, method(:onCanvasRepaint))\n \n @canvas.resize(@canvasWidth, @canvasHeight) #Sets the canvas to the default width and height.\n \n #Event handler that checks for left mouse button depression. \n @canvas.connect(SEL_LEFTBUTTONPRESS) do |sender, sel, event|\n \n @canvas.grab #grabs the canvas. Windows stores mouse data when mouse is inside canvas.\n @mouseDown = true #The mouse is depressed. Set mouseDown to true.\n \n #Get device context for the canvas\n dc = FXDCWindow.new(@activeImage)\n\n # Set the foreground color for drawing\n dc.foreground = @drawColor\n #dc.fillRectangle(event.win_x, event.win_y, 2, 2)\n \n #Defines draw alogrithms for a single click or \"Point edit\" on the canvas. \n if @mouseDown #make sure mouse is down.\n if @brushSize == 1 || @brushSize == 2 || @brushSize == 3 #If any of the square draw brushes \n dc.drawLine(event.last_x, event.last_y, event.win_x, event.win_y) #draw a line from the x,y coordinate of mouse depression to latest x,y coordinate.\n end\n if @brushSize == 2 #If brush two...\n \n i=0\n while i < 10 #Draw a series of lines within a 10X10 pixel square onto canvas.\n dc.drawLine(event.last_x+i, event.last_y, event.win_x+i, event.win_y)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x, event.win_y)\n dc.drawLine(event.last_x, event.last_y, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y, event.win_x, event.win_y+i)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x+i, event.win_y)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x+i, event.win_y)\n i += 1\n end\n end\n \n if @brushSize == 3 || @brushSize == 5 #Draw a series of lines within a 30X30 pixel square onto canvas.\n i=0\n while i < 30\n dc.drawLine(event.last_x+i, event.last_y, event.win_x+i, event.win_y)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x, event.win_y)\n dc.drawLine(event.last_x, event.last_y, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y, event.win_x, event.win_y+i)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x+i, event.win_y)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x+i, event.win_y)\n i += 1\n end\n end\n if @brushSize == 4 #Paint bucket fills the entire canvas with current draw color.\n dc.foreground = @drawColor\n dc.fillRectangle(event.rect.x, event.rect.y, event.rect.w + @canvas.width, event.rect.h + @canvas.height)\n end\n if @brushSize == 6 #Draws a white line of size 10X10 over any draw data.(Eraser handler)\n i=0\n while i < 10\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x+i, event.win_y+i)\n i += 1\n end\n end\n\n \n @dirtyArray[@activeIndex] = true # Since there is draw data in the active image, set the image's dirty value to true.\n @canvas.update #Redraw the canvas to display the image data changes onto the canvas.\n # Release the DC immediately\n dc.end\n end\n end\n \n @canvas.connect(SEL_MOTION) do |sender, sel, event| #On mouse motion.\n if @mouseDown\n # Get device context for the canvas\n dc = FXDCWindow.new(@activeImage)\n\n # Set the foreground color for drawing\n dc.foreground = @drawColor\n \n \n #While there is mouse motion, continue to repeat the same draw algorithms as for single points\n if @brushSize == 1 || @brushSize == 2 || @brushSize == 3\n dc.drawLine(event.last_x, event.last_y, event.win_x, event.win_y)\n end\n if @brushSize == 2\n \n i=0\n while i < 10\n dc.drawLine(event.last_x+i, event.last_y, event.win_x+i, event.win_y)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x, event.win_y)\n dc.drawLine(event.last_x, event.last_y, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y, event.win_x, event.win_y+i)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x+i, event.win_y)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x+i, event.win_y)\n i += 1\n end\n end\n if @brushSize == 3 || @brushSize == 5\n i=0\n while i < 30\n dc.drawLine(event.last_x+i, event.last_y, event.win_x+i, event.win_y)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x, event.win_y)\n dc.drawLine(event.last_x, event.last_y, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y, event.win_x, event.win_y+i)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x+i, event.win_y)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x+i, event.win_y)\n i += 1\n end\n end\n if @brushSize == 4\n dc.foreground = @drawColor\n dc.fillRectangle(event.rect.x, event.rect.y, event.rect.w + @canvas.width, event.rect.h + @canvas.height)\n end\n if @brushSize == 6\n i=0\n while i < 10\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x+i, event.win_y+i)\n i += 1\n end\n end\n\n # We have drawn something, so now the canvas is dirty\n @dirtyArray[@activeIndex] = true\n @canvas.update\n # Release the DC immediately\n dc.end\n end\n end\n \n @canvas.connect(SEL_LEFTBUTTONRELEASE) do |sender, sel, event| #On left mouse release\n @canvas.ungrab #Remove canvas device draw context\n @mouseDown = false #Set mouse down to false\n @canvas.update #Redraw the canvas to reflect changes in image data\n end\n end",
"def setMultipageBackground(background)\n if (!(File.file?(background) && !File.zero?(background)))\n raise Error.new(Pdfcrowd.create_invalid_value_message(background, \"setMultipageBackground\", \"image-to-pdf\", \"The file must exist and not be empty.\", \"set_multipage_background\"), 470);\n end\n \n @files['multipage_background'] = background\n self\n end",
"def plot_pheno_avg?\n make_plot = false\n @groups.each do |g|\n if g.has_pheno_avg?\n make_plot = true\n break\n end\n end\n return make_plot\n end",
"def pbMEFade(x=0.0); pbMEStop(x);end",
"def setup_backdrop\n $game_temp.backdrop.name_1 = @acts[1] if @acts[1]\n $game_temp.backdrop.name_2 = @acts[2] if @acts[2]\n get_spriteset.update_backdrops\n end",
"def paint_effects(effects = Array.new)\n effects.concat(theme[:effect] ? [theme[:effect]] : [])\n effects.concat((theme[:effects].kind_of? Array) ? theme[:effects] : [theme[:effects]]) if theme[:effects]\n paint_effects! graphics_context, *effects\n end",
"def plot3dGeneric_old(title, label, index, baseName)\n index += 1;\n pathBase = \"#{@resultBaseDir}/#{baseName}\" ;\n begin\n gplot = Gnuplot.new(:gplot, pathBase) ;\n gplot.setTitle(title) ;\n gplot.setXYLabel(\"# of Savs (log)\", \"frequency (log)\") ;\n gplot.command(\"set ylabel rotate parallel\") ;\n gplot.command(\"set dgrid3d 100,100 spline\") ;\n gplot.command(\"set pm3d at b\") ;\n gplot.command(\"set cblabel \\\"#{label}\\\" offset -10\") ;\n gplot.command(\"set logscale xy\") ;\n gplot.command(\"set contour\") ;\n gplot.command(\"unset ztics\") ;\n gplot.command(\"set view 0,359.9999\") ; # to show y label at left.\n\n gplot.command(\"$MyData << EOD\") ;\n to_a.each{|analyzer|\n gplot.command(analyzer.genCsvRowSummary().join(\" \")) ;\n }\n gplot.command(\"EOD\") ;\n\n# gplot.command(\"splot $MyData u 1:2:#{index} w lines palette notitle\") ;\n gplot.command(\"splot $MyData u 1:2:#{index} w pm3d t '#{label}'\") ;\n\n gplot.close() ;\n\n #gplot = Gnuplot.new(\"qt\") ;\n gplot = Gnuplot.new(\"wxt\") ;\n gplot.command(\"load \\\"#{pathBase}.gpl\\\"\") ;\n gplot.setTerm(:tgif, \"#{pathBase}\") ;\n gplot.command(\"replot\") ;\n\n ensure\n gplot.close() ;\n end\n end",
"def pbBGSFade(x=0.0); pbBGSStop(x);end",
"def receives_shadows?\n end",
"def paint_effects!(image, *effects)\n effects.flatten.each { |effect| effect.apply_to(image) }\n end",
"def setBackground\r\n r = g = b = a = 0.0\r\n case $background\r\n when 0\r\n r = g = b = 0.0\r\n when 1\r\n r = g = b = 1.0\r\n when 2\r\n r = 0.1\r\n g = 0.3\r\n b = 0.6\r\n when 3\r\n r = g = b = 0.5\r\n else\r\n r = g = b = 0.0\r\n end\r\n a = 1.0\r\n glClearColor(r,g,b,a)\r\nend",
"def background\n return @background if defined?(@background)\n @background = true\n end",
"def setMultipageBackground(background)\n if (!(File.file?(background) && !File.zero?(background)))\n raise Error.new(Pdfcrowd.create_invalid_value_message(background, \"setMultipageBackground\", \"pdf-to-pdf\", \"The file must exist and not be empty.\", \"set_multipage_background\"), 470);\n end\n \n @files['multipage_background'] = background\n self\n end",
"def smoothing; end",
"def inv_3d\n format_3d(inv_dims_3d) if targets_3d.present?\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",
"def recompute_prototypes node, image, fore_ground, back_ground\n foreground_sum = background_sum = background_counter = foreground_counter = 0\n raise \"image must not be null\" unless image\n\n mask = node.mask\n\n for i in (0..node.height-1)\n for j in (0..node.width-1)\n byte = mask[i][j]\n if byte == 0 #foreground\n foreground_sum = foreground_sum + image.raster[node.offset_x+i][node.offset_y+j]\n foreground_counter = foreground_counter + 1\n else\n background_sum = background_sum + image.raster[node.offset_x+i][node.offset_y+j]\n background_counter = background_counter + 1\n end\n end\n end\n foreground_counter = (foreground_counter == 0) ? 1 : foreground_counter\n background_counter = (background_counter == 0) ? 1 : background_counter\n return (foreground_sum/foreground_counter), (background_sum/background_counter)\n end",
"def filter_old_images\n @rendered_images.each do |i| \n img = i[:image]\n case @mode\n when 'ERODE'\n img.filter(ERODE)\n when 'DILATE'\n img.filter(DILATE)\n else\n img.filter(BLUR,4)\n end\n image(img, i[:x], i[:y])\n i[:counter] += 1\n fade_image(i) if i[:counter] > FADE_THRESHOLD\n end\n end",
"def setup\n super\n @background_colour = @colour\n @foreground_colour = Palette.white\n @axis = :y\n end",
"def fill_setup(gc)\n if @obj.fill\n gc.set_background @obj.fill\n gc.set_alpha @obj.fill_alpha\n true\n end\n end",
"def snapshot_for_background\n $game_temp.background_bitmap.dispose\n $game_temp.background_bitmap = Graphics.snap_to_bitmap\n $game_temp.background_bitmap.blur\n end",
"def FT_IS_VARIATION(face)\n face.face_flags & FaceFlag[:VARIATION]\n end",
"def setup\n size(640, 360)\n color_mode(RGB, 255, 255, 255, 100)\n @w = width + 16\n @xspacing = 8\n @maxwaves = 5\n @theta = 0.0\n @amplitudes = Array.new(@maxwaves) { random(10, 30) }\n @dx = Array.new(@maxwaves) do |i|\n period = random(100, 300)\n (TWO_PI / period) * @xspacing\n end\n\n @yvalues = Array.new(@w/@xspacing)\nend",
"def bg_prob\n @bg_prob ||= 1.0 / @size\n end",
"def draw_pvalue_plot(params)\n jitter = params[:jitter]\n no_triangles = params[:no_triangles]\n grouplist = params[:grouplist]\n snp_list = params[:snp_list]\n x_start = params[:x_start]\n y_start = params[:y_start]\n stat_max = params[:stat_max]\n stat_min = params[:stat_min]\n original_min = params[:original_min]\n first_plot = params[:first_plot]\n prefix_title = params[:prefix_title] || ''\n rotate = params[:rotate] || false\n clean_axis = params[:clean_axis] || false\n\t\tinteraction_shapes = params[:interaction_shapes] || false\n\t\t \n x = @box_size\n xmin = x\n ymin = 0\n ymax = @box_size*9\n y_interval = ymax-ymin\n\n check_max = false\n\n stat_max = get_neg_log(stat_min)\n top_max = get_neg_log(stat_min)\n\n # check to see if there is a cut-off imposed for the pvalue plot\n if stat_min.to_f > original_min.to_f\n check_max = true\n box_mult=1.8\n # calculate size of triangle (or circle) and adjust the p value plot max size\n y_vertical = @box_size*box_mult * Math.sqrt(2) *0.35\n y_fraction = 1- y_vertical / y_interval\n\n # adjust stat_max to be the value needed for a triangle to just touch top\n stat_max = top_max / y_fraction\n # if no cut-off imposed check for the use of a cleaner axis\n elsif clean_axis\n increment, stat_min, stat_max = calculate_increments(0, stat_max.to_f)\n end\n\n stat_min = 0\n\n # set stat_min to be zero\n if !check_max and stat_max - stat_max.floor > 0\n stat_max = stat_max.floor + 1\n end\n\t\t\n # store for later use based when adding features\n @functional_max = stat_max\n\n stat_interval = stat_max - stat_min\n value_x = xmin * 0.7 + (@box_size * Math.sqrt(2)*0.25)/2\n\t\t\n # draw box (change to triangle) with correct color\n snp_list.included_snps.each do |snp_index|\n snp = snp_list.snps[snp_index]\n draw_separation(x_start, y_start, 0, ymax, value_x)\n\n # store points here for outputting\n points = Array.new\n\n grouplist.groups.each do |group|\n if snp.results.has_key?(group.name)\n over_max = false\n box_mult=1\n result = snp.results[group.name]\n pvalue = get_neg_log(result.values['pvalue'].to_f)\n if pvalue > top_max\n over_max = true\n pvalue = top_max\n box_mult=1.8\n end\n\n box_y_start = ((stat_max-pvalue) / stat_interval) * y_interval\n\t if (!no_triangles and group.has_beta? and !interaction_shapes)\n\t if over_max and result.values['beta'].to_f <= 0\n \t box_y_start = 0\n\t end\n\n box_y_start = y_interval - box_y_start if rotate\n\n if (result.values['beta'].to_f > 0 and !rotate) or (result.values['beta'].to_f <= 0 and rotate)\n up_triangle = true\n else\n up_triangle = false\n end\n\n points << create_triangle(box_y_start, value_x, up_triangle, box_mult, group.colorstr)\n\t\t\t\t\telsif(interaction_shapes)\n\t\t\t\t\t\tbox_y_start = @box_size * box_mult * Math.sqrt(2)*0.125/2 if over_max\n\t\t\t\t\t\tbox_y_start = y_interval - box_y_start if rotate\n\t\t\t\t\t\tif(group.has_beta?)\n\t\t\t\t\t\t\tif(result.values['beta'].to_i==1)\n\t\t\t\t\t\t\t\t\tpoints << create_square(box_y_start, value_x, box_mult*0.4, group.colorstr)\n\t\t\t\t\t\t\telsif(result.values['beta'].to_i==2)\n\t\t\t\t\t\t\t\t\tpoints << create_triangle(box_y_start, value_x, true, box_mult*0.8, group.colorstr)\n\t\t\t\t\t\t\telsif(result.values['beta'].to_i==3)\n\t\t\t\t\t\t\t\t\tpoints << create_diamond(box_y_start, value_x, box_mult*0.5, group.colorstr,\n\t\t\t\t\t\t\t\t\t\t:on_side=>true)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t#circle\n\t\t\t\t\t\t\t\t\tpoints << Circle.new(value_x, box_y_start, @box_size * box_mult * Math.sqrt(2)*0.125, group.colorstr)\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tbox_y_start = @box_size * box_mult * Math.sqrt(2)*0.125/2 if over_max\n\t\t\t\t\t\t\tbox_y_start = y_interval - box_y_start if rotate\n\t\t\t\t\t\t\tpoints << Circle.new(value_x, box_y_start, @box_size * box_mult * Math.sqrt(2)*0.125, group.colorstr)\n\t\t\t\t\t\tend\n \t elsif !group.highlighted\n \t box_y_start = @box_size * box_mult * Math.sqrt(2)*0.125/2 if over_max\n box_y_start = y_interval - box_y_start if rotate\n \t points << Circle.new(value_x, box_y_start, @box_size * box_mult * Math.sqrt(2)*0.125, group.colorstr)\n \t else\n \t #draw diamond for highlighted group\n \t if over_max\n \t box_y_start = 0\n\t end\n\t if rotate\n box_y_start = y_interval - box_y_start\n end\n points << create_diamond(box_y_start, value_x, box_mult, group.colorstr)\n\t end\n end\n\n end\n\n # sort by y-midpoint\n points.sort! {|x,y| y.ymidpoint <=> x.ymidpoint}\n\n # when jitter selected check for overlap and offset horizontally\n # those points that overlap significantly\n if jitter\n adjust_horizontal(points, y_interval)\n end\n\n\t # iterate through points and draw all of them\n\t points.each do |point|\n \t @canvas.g.translate(x_start,y_start) do |check|\n check.styles(:stroke_width=>1, :fill_opacity=>0.9)\n \t point.draw(check)\n \t end\n \t end\n value_x = label_step(value_x)\n end\n\n # write labels on left side of stat box\n if first_plot\n if rotate\n x_label_start = value_x + x_start+ @box_size * 0.4\n else\n x_label_start = x_start\n end\n\n label_precision = 1\n\n write_plot_labels(x_label_start, y_start, ymax, stat_max, stat_min, y_interval, 0,\n prefix_title + '-log10(p value)', false, label_precision, rotate)\n end\n end"
] |
[
"0.4743561",
"0.47419527",
"0.47257483",
"0.46603736",
"0.46493506",
"0.4614793",
"0.46024135",
"0.4591362",
"0.4574945",
"0.45665178",
"0.45201406",
"0.4444853",
"0.44337168",
"0.4412197",
"0.44014347",
"0.43813077",
"0.43722656",
"0.4347139",
"0.432628",
"0.42809024",
"0.42597595",
"0.42562255",
"0.42562255",
"0.42517167",
"0.42340255",
"0.42241165",
"0.41984326",
"0.4184397",
"0.41803068",
"0.41679794",
"0.41607153",
"0.41530764",
"0.41486928",
"0.41335875",
"0.4128833",
"0.41212723",
"0.41114834",
"0.41030905",
"0.40934503",
"0.40839455",
"0.40698603",
"0.40595657",
"0.40570366",
"0.40565762",
"0.4048824",
"0.40483952",
"0.40483952",
"0.4045834",
"0.4041628",
"0.40370452",
"0.4025884",
"0.40221414",
"0.4020942",
"0.40087244",
"0.39917594",
"0.39899775",
"0.39810216",
"0.3970903",
"0.3970903",
"0.39693448",
"0.39664394",
"0.39653817",
"0.39523748",
"0.39492363",
"0.39292368",
"0.39292368",
"0.3929026",
"0.3920104",
"0.39165455",
"0.39163578",
"0.3916058",
"0.39058703",
"0.39023763",
"0.3898631",
"0.3896231",
"0.38878742",
"0.38845786",
"0.38842034",
"0.38780648",
"0.38724598",
"0.3871383",
"0.38624805",
"0.38622427",
"0.38601694",
"0.3851197",
"0.38502702",
"0.3849666",
"0.38481373",
"0.38463998",
"0.38301027",
"0.3814106",
"0.3813973",
"0.3809747",
"0.38005358",
"0.37974444",
"0.37974232",
"0.3796002",
"0.37947878",
"0.37876156",
"0.37873122"
] |
0.43629375
|
17
|
GET /user_groups/1 GET /user_groups/1.json
|
def show
@user_group = UserGroup.find(params[:id])
@tweets=Tweet.find_by_sql(['select * from tweets where user_id in
(select user_id from user_group_follows where user_group_id=?);',params[:id]]);
respond_to do |format|
format.js { render :json => @tweets}
format.html # show.html.erb
format.json { render json: @user_group}
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def groups\n \n \n @groups = @current_user.groups\n render 'groups.json.jbuilder', status: :ok\n end",
"def index\n @groups = current_user.groups\n render json: @groups\n end",
"def groups\n UserGroups.new(:id => id).get.items\n end",
"def show\n @user_group = UserGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_group }\n end\n end",
"def list_groups\n if @user.permission_level.value == PermissionLevel.order(\"value DESC\").first.value\n render :json => Group.find(:all).map{|g| g}\n else\n render :json => @user.groups.map{|g| g}\n end\n end",
"def GetGroups params = {}\n\n params = params.merge(path: 'groups.json')\n APICall(params)\n\n end",
"def show\n #@group = Group.find(params[:id])\n \n @users = @group.users\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"def index\n render json: current_user.membered_groups\n end",
"def list_groups()\n response = HTTParty.get(\"https://graph.microsoft.com/v1.0/groups\", { \n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Host\" => 'graph.microsoft.com' \n }\n })\n return JSON.parse response.read_body\n end",
"def GetGroup id\n\n APICall(path: \"groups/#{id}.json\")\n\n end",
"def new\n @user = User.find(params[:user_id])\n @groups = @user.groups.new\n\n #@group = Group.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def show\n @group_user = GroupUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group_user }\n end\n end",
"def list_users\n group_id_param = params[:group_id]\n\n if group_id_param.nil? || group_id_param.blank?\n render json: { error: 'group_id not specified.' }, status: :bad_request\n return\n end\n\n group = CanvasSpaces.GroupCategory.groups.find_by_id(group_id_param)\n if group.nil?\n render json: { error: 'No such group found.' }, status: :bad_request\n else\n if @current_user.account.site_admin? || group.leader_id == @current_user.id\n render json: { size: group.users.count, users: group.users.map { |user| user.as_json(only: [:id, :name], include_root: false) } }, status: :ok\n else\n # doesn't have access to the group\n render json: { error: \"Can't list users. Not owner.\" }, status: :forbidden\n end\n end\n end",
"def index\n @user = User.find(current_user.id)\n @groups = @user.groups.all\n end",
"def index\n @groups = Group.display_for_user(current_user)\n end",
"def index\n @group = current_user.groups.find_by(id: params[:group_id]) || @groups.first\n end",
"def index\n @groups = current_user.groups\n end",
"def get_groups\n users = User.where('is_group =? and institution_id=? and center_id=? and edutorid like ?',true,params[:institution_id],params[:center_id],\"%SG-%\").select(:id)\n list = Profile.find_all_by_user_id(users).map {|u| Hash[value: u.user_id, name: u.firstname]}\n render json: list\n end",
"def index\n @groups_all = current_user.groups.paginate(page: params[:page]).order('name ASC')\n\n @owner = current_user\n @users = User.where(\"owner_id = ?\", current_user).order('lastname ASC')\n\n respond_to do |format|\n format.html { render @groups }\n format.json { render json: @groups }\n end\n end",
"def index\n @groups_user = GroupsUser.find(params[:id])\n @groups_users = GroupsUser.all\n end",
"def new\n @user_group = UserGroup.new\n @users = User.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_group }\n end\n end",
"def get_groups\n @course = Course.find(params[:course_id])\n render json: @course.groups\n end",
"def index\n @usergroups = Usergroup.all\n end",
"def index\n @group_users = GroupUser.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @group_users }\n end\n end",
"def index\n @students = current_user.groups[0].students\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @students }\n end\n end",
"def index\n @groups = Group.where(:user_id => current_user)\n end",
"def index\n @user_groups = current_user.users_groups.page(params[:page]).per(20)\n end",
"def index\n @user_groups = UserGroup.accessible_by(current_ability)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_groups }\n end\n end",
"def index\n @groups = Group.all.includes(:user)\n end",
"def show\n @group_members = GroupMember.where(group_id:params[:id])\n @users_in_group=[]\n @group_members.each do |f|\n @user = User.find(f[:user_id])\n @users_in_group.push(@user)\n end\n render json: @users_in_group\n end",
"def index\n\t\t@groups = current_user.groups\n\tend",
"def group_info\n group_id_param = params[:group_id]\n\n if group_id_param.nil? || group_id_param.blank?\n render json: { error: 'group_id not specified.' }, status: :bad_request\n return\n end\n\n group = CanvasSpaces.GroupCategory\n .groups\n .where('groups.id = ?', group_id_param)\n .eager_load(:users)\n .first\n if group.nil?\n render json: { error: 'No such group found.' }, status: :not_found\n else\n maillist = get_maillist_for_space(group.id)\n render json: { id: group.id,\n name: group.name,\n description: group.description,\n maillist: maillist,\n leader_id: group.leader_id,\n created_at: group.created_at,\n join_type: display_join_type(group.join_level),\n size: group.users.count\n },\n status: :ok\n end\n end",
"def index\n authorize UserGroup\n @user_groups = UserGroup.all\n end",
"def list_groups_for_user(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'ListGroupsForUser'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :user_name\n\t\t\targs[:query]['UserName'] = optional[:user_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def list_groups\n groups = CanvasSpaces.GroupCategory.groups.active.order(:name)\n # filter out non-public groups for non-admins\n groups = groups.where(join_level: 'parent_context_auto_join') unless @current_user.account.site_admin?\n groups_json = Api.paginate(groups, self, api_v1_canvas_spaces_groups_url).map do |g|\n include = @current_user.account.site_admin? || @current_user.id == g.leader_id ? ['users'] : []\n group_formatter(g, { include: include })\n end\n render :json => groups_json\n end",
"def show\n #logger.info \"GroupsController Get Parameters: #{params}\"\n if @group\n render json: @group.to_json(:include => {:memberships => {:only => [:admin], :include => {:user => {:only => [:id, :first_name, :last_name, :email]}}}})\n else\n render json: {error: \"YOU MUST BE MEMBER OF THIS GROUP TO SEE IT\"}, status: :unprocessable_entity\n end\n end",
"def show\n @add_group_to_user = AddGroupToUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @add_group_to_user }\n end\n end",
"def index\n @groups = query(GROUP, :name)\n\n # restrict the groups to the groups of the current user\n # unless the current user is allowed to create groups\n # and need to see all\n unless allowed(:create)\n allowed_group_ids = current_user.groups.collect {|g| g.id }\n @groups.delete_if do |g|\n ! allowed_group_ids.member?(g.id)\n end\n end\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @groups }\n end\n end",
"def get_group_by_id(id)\n get(\"/groups/#{id}\")\n end",
"def index\n @groups = Group.all\n\n respond_to do |format|\n format.html\n format.json { render json: @groups }\n end\n end",
"def get_group\n send_request(FUNCTION_GET_GROUP, [], '', 4, 'k4')\n end",
"def groups_user(login, options = {})\n get('/api/users/groups', query: { login: login }.merge!(options))\n end",
"def show\n @group = current_user.groups.includes(:group_users).find params[:id]\n end",
"def index\n groupname = params[:groupname]\n @groups = Group.all\n @users = User.all\n end",
"def index\n if user_signed_in?\n @groups = current_user.groups\n else\n redirect_to new_user_session_path\n end\n end",
"def getUserBy_groupid( group_id)\n params = Hash.new\n params['group_id'] = group_id\n return doCurl(\"get\",\"/user/by_groupid\",params)\n end",
"def index\n if request.xhr?\n organization_id = params[\"organization_id\"]\n per_page = params[:iDisplayLength] || Settings.per_page\n page = params[:iDisplayStart] ? ((params[:iDisplayStart].to_i/per_page.to_i) + 1) : 1\n params[:iSortCol_0] = 1 if params[:iSortCol_0].blank?\n sort_field = SORT_GROUP_MAP[params[:iSortCol_0].to_i]\n @user_groups = UserGroup.get_all_user_groups(page, per_page, params[:sSearch], sort_field + \" \" + params[:sSortDir_0],organization_id)\n render :json => @user_groups\n return\n end\n end",
"def user_groups(user_id, params = {})\n get(\"/v1/users/#{user_id}/groups\", params)\n end",
"def groups\n Group.groups(user_name)\n end",
"def show_by_user\n @groups = Group.where(user_id: current_user.id)\n \n end",
"def new\n @user_group = UserGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_group }\n end\n end",
"def index\n\t\t@user = User.find(session[:id])\n\t\t@groups = Group.all\n\tend",
"def my_groups\n @tasks_groups = current_user.tasks_groups.where(removed: false)\n respond_to do |format|\n format.html\n format.json do\n render json: {type: @tasks_groups.class.to_s, value: @tasks_groups}\n end\n end\n end",
"def show_group\n\t\t@student = Student.find(params[:student_id])\n\t\trender json: @student.groups.find_by(course_id: params[:course_id])\n\tend",
"def show_group(id)\n get(\"groups/#{id}\")\n end",
"def get_user_groups username_for, options = {}\n do_request 'get_user_groups', options.merge(username_for: username_for)\n end",
"def index\n authorize Group\n render :json => @group.group_memberships\n end",
"def show_group\n group_name = params[:name]\n @group = $iam.groups[group_name]\n @users = @group.users\n @policies = @group.policies\n end",
"def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"def index\n @groups = Group.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"def show\n @group = Group.find(params[:id])\n\n render json: @group.to_json(:include => {:memberships => {:only => [:admin], :include => {:user => {:only => [:id, :first_name, :last_name, :email]}}}})\n end",
"def index\n id = -1 \n if params[:id] \n id = params[:id]\n else \n id = current_user.id \n end \n\n @user = User.find(id)\n @group = UserGroup.find_by(user_id: id, name: params[:group])\n\n if !@group.nil?\n @group_members = get_members(@user, @group)\n end \n\n end",
"def groups(options = {})\n params = { :limit => 200 }.update(options)\n response = get(PATH['groups_full'], params)\n parse_groups response_body(response)\n end",
"def index\n unless user_signed_in?\n redirect_to new_user_session_path\n else\n @group_id = UserDefaultGroup.find_by_user_id(current_user.id)\n @group_id = @group_id.group_id unless @group_id.nil?\n #@users = User.all\n @users = User.joins(\"Left Join (select user_id, group_id From group_memberships) fm ON fm.user_id = users.id\").where(\"fm.group_id = ?\", @group_id)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end\n end",
"def groups(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Groups\", params: params)\n end",
"def index\n @group = Group.find(params[:id])\n @members = GroupUser.where(:group_id => params[:id])\n end",
"def show\n @group = GROUP.first_or_get!(params[:id])\n\n # restrict the groups to the groups of the current user\n # unless the current user is allowed to create groups\n # and need to see all\n unless allowed(:create)\n allowed_groups = current_user.groups\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def show\n @user = User.get!(params[:id])\n @groups = Group.all(:order => [:name.desc])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def index\n @groups = []\n for member in current_user.members\n @groups << member.group\n end\n end",
"def index\n @groups = current_user.groups\n @groups = @groups.where('name LIKE ?', \"%#{params[:q]}%\") if params[:q].present?\n @groups = current_user.groups_sorted_by_admin_state_and_name(@groups)\n @groups_pictures = Group.group_images_hash_for_groups @groups\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @groups }\n end\n end",
"def show\n @groupc_user = GroupcUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @groupc_user }\n end\n end",
"def get_user_groups\n user_groups.keys\n end",
"def get_groups(params)\n send_get \"get_groups\", params\n end",
"def index_users\n authorize Group, :index?\n render :json => @group.users\n end",
"def show\n group = Group.find(params[:id])\n\n render json: group\n end",
"def show_current\n respond_to do |format|\n format.json { render json: @user.group, status: 200 }\n end\n end",
"def index\n @member_groups = @user.groups_where_member\n @admin_groups = @user.groups_where_admin\n end",
"def showgrp\n @grp = params[:id].to_s\n @groups=Group.where(\"kls_parent=\"+@grp).order(\"name asc\")\n render json: @groups\n end",
"def get_user_group_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersAndGroupsApi.get_user_group ...'\n end\n # resource path\n local_var_path = '/v3/groups'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n return_type = opts[:return_type] \n\n auth_names = opts[:auth_names] || []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type)\n\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersAndGroupsApi#get_user_group\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def my_groups\n groups = Group.joins(:group_users).where(:group_users => {user_id: params[:user_id]})\n\n paginate json: groups\n end",
"def getGroups\n groups = $gm.get(\"/groups\", @token, \"per_page=100\")\n group_ids = Array.new\n\n groups['response'].each do |group|\n group_ids.push({\n 'name' => group['name'],\n 'group_id' => group['id'],\n 'image' => group['image_url']})\n end\n\n return group_ids\n end",
"def group_list(user_id, sort = \"my_activity\")\n data = request(\"/group/list\", id: user_id, sort: sort)\n Hashie::Mash.new(data[\"groups\"][\"list\"])\n end",
"def get_a_user_group_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: IamUserGroupsApi.get_a_user_group ...'\n end\n # unbox the parameters from the hash\n user_group_id = opts[:'user_group_id']\n # verify the required parameter 'user_group_id' is set\n if @api_client.config.client_side_validation && user_group_id.nil?\n fail ArgumentError, \"Missing the required parameter 'user_group_id' when calling IamUserGroupsApi.get_a_user_group\"\n end\n # resource path\n local_var_path = '/user-groups/{user_group_id}'.sub('{' + 'user_group_id' + '}', CGI.escape(user_group_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Object'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"IamUserGroupsApi.get_a_user_group\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IamUserGroupsApi#get_a_user_group\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def new\n @group = Group.new\n # @group_user = @current_user.join_group(@group)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_user }\n end\n end",
"def index\n @users = @group.users\n end",
"def index\n @user_session = UserSession.find\n if @user_session.nil?\n render :json => nil\n else\n @user = current_user\n @groups = @user.groups.order('groups.name')\n render 'user_sessions/index.json.rabl'\n end\n end",
"def mygroups\n @user = User.find_by(email: user_params[:email])\n\n @usergroups = @user.studygroups_users\n @mygroups = []\n\n @usergroups.each { |group|\n @studygroup = Studygroup.find_by(id: group.studygroup_id)\n @mygroups.push(@studygroup)\n\n }\n render json: @mygroups\n end",
"def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"def getGroup( group_id)\n params = Hash.new\n params['group_id'] = group_id\n return doCurl(\"get\",\"/group\",params)\n end",
"def read (group_id = nil)\n\n url = @app_url + \"/api/groups\"\n url = url << \"/#{group_id}\" unless group_id == nil\n\n response = RestClient.get url, {\"X-Token\" => @api_token, :accept => :json}\n\n json_obj = nil\n\n if response.code == 200\n json_obj = JSON.parse(response.body.to_s)\n else\n raise RuntimeError.new(\"Invalid response: #{response.code.to_s}\")\n end\n\n json_obj\n end",
"def group(group_id)\n get(\"/v1/groups/#{group_id}\")\n end",
"def show\n @user_group = UserGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_group }\n end\n end",
"def index\n # @groups = Group.all\n if current_user\n @groups = Group.where(user_id: current_user.id)\n else\n redirect_to '/users/sign_in'\n end\n end",
"def show\n @group = Group.find(params[:id])\n @members = Member.find(:all, :conditions => [\"group_id = ? and deleted = 0\", params[:id]])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"def index\n @title = \"Группы характеристик\"\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"def index\n @groups = Group.all\n render_json_serializer(@groups)\n end",
"def group_members(id)\n get(\"/groups/#{id}/members\")\n end",
"def index\n @usernetworkgroups = Usernetworkgroup.all\n end",
"def show\n save_navi_state(['groups_title', 'browse_groups'])\n begin\n @group = Group.find(params[:id])\n @members = @group.members(session[:cookie]).paginate :page => params[:page], :per_page => per_page\n rescue RestClient::ResourceNotFound => e\n flash[:error] = :group_not_found\n redirect_to groups_path\n rescue ActiveRecord::RecordNotFound => e\n flash[:error] = :group_not_found\n redirect_to groups_path\n end\n end"
] |
[
"0.80773",
"0.77169454",
"0.7606095",
"0.7559645",
"0.75594455",
"0.7309739",
"0.72886956",
"0.7267894",
"0.72248393",
"0.7154069",
"0.7127444",
"0.7122355",
"0.7102212",
"0.70825654",
"0.70650345",
"0.7024051",
"0.7005877",
"0.7002135",
"0.69946086",
"0.699059",
"0.6974067",
"0.6961791",
"0.69453627",
"0.6944704",
"0.6942736",
"0.69329894",
"0.6925382",
"0.69240415",
"0.6911923",
"0.68847394",
"0.6880437",
"0.68783295",
"0.6869964",
"0.6856033",
"0.68559664",
"0.68346065",
"0.682043",
"0.68188417",
"0.6815015",
"0.67997897",
"0.6793697",
"0.6792356",
"0.67795247",
"0.6771594",
"0.67676234",
"0.67563576",
"0.67534435",
"0.6743432",
"0.67315656",
"0.6728061",
"0.6723603",
"0.6720044",
"0.67196625",
"0.67150176",
"0.67143136",
"0.67127293",
"0.6708776",
"0.6706594",
"0.66892964",
"0.66892964",
"0.6671476",
"0.6657136",
"0.66565186",
"0.6632178",
"0.6629473",
"0.6628536",
"0.6617351",
"0.6613675",
"0.6612823",
"0.6608807",
"0.66080296",
"0.6603513",
"0.65992033",
"0.6584287",
"0.6578784",
"0.6576847",
"0.65558213",
"0.6541107",
"0.6526235",
"0.65179086",
"0.65105784",
"0.65042084",
"0.6499152",
"0.6484897",
"0.6480834",
"0.6479845",
"0.6479781",
"0.647561",
"0.646402",
"0.646402",
"0.6462747",
"0.6455544",
"0.64539003",
"0.6446841",
"0.64388746",
"0.64376044",
"0.64339584",
"0.6428706",
"0.64234483",
"0.6417526",
"0.6416944"
] |
0.0
|
-1
|
GET /user_groups/new GET /user_groups/new.json
|
def new
@user_group = UserGroup.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @user_group }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @user = User.find(params[:user_id])\n @groups = @user.groups.new\n\n #@group = Group.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @user_group = UserGroup.new\n @users = User.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_group }\n end\n end",
"def new\n @add_group_to_user = AddGroupToUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @add_group_to_user }\n end\n end",
"def new\n @group = current_user.created_groups.new\n end",
"def new\n @group = Group.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n # @group_user = @current_user.join_group(@group)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_user }\n end\n end",
"def new\n @group = Group.new\n render json: @group\n end",
"def new\n @group = Group.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end",
"def new\n @group = current_user.groups.new\n end",
"def new\n @group = Group.new\n\n render json: @group\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end",
"def new\n @group = current_user.groups.build\n\n respond_to :html\n end",
"def new\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.new\n\t @groups = current_user.get_unique_group_branches.map {|g| g.get_self_and_children?}.flatten\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @groupaddrobj = Groupaddrobj.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @groupaddrobj }\n end\n end",
"def new\n @group = Group.new(:owner => current_user)\n authorize @group, :new?\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @title = \"Добавление группы характеристик\"\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def create\n @group = @current_user.create_group(params[:group])\n # @group = @current_user.groups.build(params[:group])\n # @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.valid?\n format.html { redirect_to circle_groups_path, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @user = User.new\n @groups = Group.all(:order => [:name.desc])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def create\n @user_group = UserGroup.new(params[:user_group])\n\n respond_to do |format|\n if @user_group.save\n format.html { redirect_to @user_group, notice: 'User group was successfully created.' }\n format.json { render json: @user_group, status: :created, location: @user_group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_group = UserGroup.new(params[:user_group])\n\n respond_to do |format|\n if @user_group.save\n format.html { redirect_to @user_group, notice: 'User group was successfully created.' }\n format.json { render json: @user_group, status: :created, location: @user_group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration], owner: current_user)\n if @group.save\n @group.memberships.create!(user: current_user, admin: true)\n if params[:group][:users]\n params[:group][:users].each do |u|\n @group.memberships.create!(user: User.where(\"id = ? OR email = ?\", u[:id], u[:email]).first, admin:u[:admin])\n end\n end\n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def new\n @user_group = UserGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_group }\n end\n end",
"def new\n @users = User.all\n @groups = Group.all\n @message = Message.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @group_user_rel = GroupUserRel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_user_rel }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n format.xml { render xml: @group }\n end\n end",
"def new\n @group_request = GroupRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group_request }\n end\n end",
"def new\n @roles = current_user.pass_on_roles.to_a || [] # logged-in user can give his own roles to new user\n @user = User.new\n \n params[:id] = current_user.center if params[:id] == \"0\"\n \n if !params[:id].nil? # create new user for specific center/team\n @groups = Group.this_or_parent(params[:id])\n @group = Group.find(params[:id])\n @user.groups += @groups\n else\n @groups = if current_user.has_role?(:centeradmin)\n \tGroup.where(:center_id => current_user.center_id)\n \telse\t\n \t current_user.center_and_teams\n\t end\n end\n\n if current_user.has_role?(:superadmin) # superadmin can create users in all groups\n @groups = (Center.all + current_user.center.teams).sort_by { |c| c.title }\n end\n\n end",
"def new\n @group = Group.new\n respond_to do |format|\n #format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n\t\t@group = Group.new\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @group }\n\t\t\tformat.json { render :json => @group }\n\t\tend\n\tend",
"def new\n\t\t@group = Group.new\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @group }\n\t\t\tformat.json { render :json => @group }\n\t\tend\n\tend",
"def new\n @user_group = UserGroup.new\n\t\t@all_permissions = Lockdown::System.permissions_assignable_for_user(current_user)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_group }\n end\n end",
"def new #:nodoc:\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.haml\n # format.xml { render :xml => @group }\n end\n end",
"def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration])\n if @group.save\n params[:group][:users].each do |u|\n Membership.create(group: @group, user: User.where(\"id = ? OR email = ?\", u[:id], u[:email]).first, admin:u[:admin])\n end\n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def new\n @groupc_user = GroupcUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @groupc_user }\n end\n end",
"def new\n @group_member = GroupMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_member }\n end\n end",
"def create\n #should expire groups page cache\n \n # expire the cache of the grouplist of this user\n Rails.cache.delete(Person.groups_cache_key(@current_user.id, session[:cookie]))\n \n @group = Group.new\n begin\n @group = Group.create(params[\"group\"], session[:cookie])\n flash[:notice] = :group_created_successfully\n redirect_to group_path(@group) and return\n rescue RestClient::RequestFailed => e\n @group.add_errors_from(e)\n @group.form_title = params[:group][:title]\n @group.form_description = params[:group][:description]\n render :action => :new and return\n rescue RestClient::Unauthorized => e\n @group.add_errors_from(e)\n @group.form_title = params[:group][:title]\n @group.form_description = params[:group][:description]\n render :action => :new and return \n end\n end",
"def create\n @usergroup = Usergroup.new(usergroup_params)\n\n respond_to do |format|\n if @usergroup.save\n format.html { redirect_to @usergroup, notice: 'User group was successfully created.' }\n format.json { render :show, status: :created, location: @usergroup }\n else\n format.html { render :new }\n format.json { render json: @usergroup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n format.json { render :json => @group }\n end\n end",
"def new\n @user_group = UserGroup.new\n @permissions = {}\n @group_permissions = Permission.get_group_permissions\n @group_permissions.each do |g|\n @permissions[g.group_permission_name] = Permission.get_permission_in_group_permission(g.group_permission_name)\n end\n end",
"def create\n @group = Group.new(group_params)\n @group.owner = current_user\n\n if @group.save\n @group.add!(current_user)\n \n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def new\n save_navi_state(['groups_title', 'new_group'])\n @group = Group.new\n end",
"def new\n @group = SuperSimpleCms::Group.new\n\n respond_to do |format|\n format.html {render :template=>'admin/groups/new'}\n format.js {render :template=>'admin/groups/new', :layout=>false}\n format.xml { render :xml => @group }\n end\n end",
"def new\n @groupon = Groupon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @groupon }\n end\n end",
"def create\n @usergroup = Usergroup.new(usergroup_params)\n\n respond_to do |format|\n if @usergroup.save\n format.html { redirect_to @usergroup, notice: 'Usergroup was successfully created.' }\n format.json { render :show, status: :created, location: @usergroup }\n else\n format.html { render :new }\n format.json { render json: @usergroup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @register_group = RegisterGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @register_group }\n end\n end",
"def new\n @title = t('view.customers_groups.new_title')\n @customers_group = CustomersGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customers_group }\n end\n end",
"def new\n @title = t('view.customers_groups.new_title')\n @customers_group = CustomersGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customers_group }\n end\n end",
"def new\n add_breadcrumb \"Social\", social_path()\n add_breadcrumb \"Create group\"\n \n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @pgroup = Pgroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pgroup }\n end\n end",
"def new\n @pgroup = Pgroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pgroup }\n end\n end",
"def new\n\t\t#\tget business rules for each account type\n\t #if this new user is assigned to an existing group it should be in the params.\n\t\t@group = params[:group].blank? ? Group.new() : Group.find_by_id(params[:group][:id])\n @group.name ||= \"MyGroup\"\n\t\t@user = User.new()\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @group_record = GroupRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_record }\n end\n end",
"def new\n @group_stat = GroupStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_stat }\n end\n end",
"def create\n @group = current_user.groups.new(group_params)\n\n if (@group.save)\n flash[:success] = \"Found a new group!\"\n else\n flash[:warning] = \"Could not create group\"\n end\n\n redirect_to @group\n end",
"def new\n @grupo = Grupo.new\n authorize! :create, @grupo\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @grupo }\n end\n end",
"def create\n new_group = Group.new(name: params[:name])\n\n if new_group.save\n render json: { \"notice\"=>\"new group #{params[:name]} successfully created\" }\n else\n render json: { \"alert\"=>\"group creation failed. check params.\" }\n end\n end",
"def new_nodegroup(nodegroup_json)\n nodemgr_rest_call(\"POST\", \"classifier\", \"groups\", $credentials, id=\"\", nodegroup_json)\nend",
"def create\n @group = Group.new(group_params)\n if current_user\n @group.user_id = current_user.id\n end\n \n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n group = Group.new(group_params)\n if group.save\n render json: group\n else\n render json: group.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.haml\n format.js # new.js.rjs\n format.xml { render :xml => @group }\n format.json { render :json => @group }\n end\n end",
"def create\n authorize! :create, Group\n @group = Group.new(group_params)\n @group.creator = current_user\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @group = GROUP.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, :notice => 'Group was successfully created.' }\n format.json { render :json => @group, :status => :created, :location => @group}\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @group = Group.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def create\n @group = Group.new(new_group_params)\n if @group.save\n redirect_to groups_url\n else\n render :template => \"groups/new\"\n end\n end",
"def new\n @item_group = ItemGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_group }\n end\n end",
"def create\n group_ids = params[\"user_groups\"]\n org_id = params[:organization_id]\n @user = User.new(params[:user])\n @user.user_group_ids = group_ids\n @user.organization_id = org_id\n\n if @user.save\n redirect_to organization_users_path(org_id)\n else\n flash[:error] = t('users.new.exist')\n @user_groups = UserGroup.all\n render :new\n end\n end",
"def create\n group_ids = params[\"user_groups\"]\n org_id = params[:organization_id]\n @user = User.new(params[:user])\n @user.user_group_ids = group_ids\n @user.organization_id = org_id\n\n if @user.save\n redirect_to organization_users_path(org_id)\n else\n flash[:error] = t('users.new.exist')\n @user_groups = UserGroup.all\n render :new\n end\n end",
"def create\n @group = Group.new(params[:group])\n\t\t@group.user_id = session[:user_id]\n\n respond_to do |format|\n if @group.save\n\n\t\t\t\t@page = Page.create(:owner => @group.id, :category => 'group')\n\t\t\t\t@group_member = GroupMember.create(:group_id => @group.id, :user_id => session[:user_id], :moderator => true)\n format.html { redirect_to groups_url, :notice => 'Group was successfully created.' }\n format.json { render :json => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n respond_to do |format|\n if @group.save\n @group.users.push(current_user)\n UserGroup.set_is_admin(@group.id, current_user.id, true)\n invite_members\n format.html { redirect_to @group, notice: t('flash.notice.groups.successfully_created') }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @group.parent_id = params[:group_id]\n \n add_breadcrumb 'Your hubs', :hubs_path\n add_breadcrumb @hub.name, hub_path(@hub)\n unless params[:group_id]\n add_breadcrumb 'New group', new_hub_group_path(@hub)\n else\n add_breadcrumb 'New sub group', hub_group_subgroup_path(@hub, @group.parent)\n end\n \n append_title 'New group'\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end",
"def new\n \n @mostkhdmeen_user = User.new \n @groups = Group.all\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mostkhdmeen_user }\n end\n end",
"def create\n @user.create_group!(new_group_params[:group_user_ids], {name: new_group_params[:name]})\n end",
"def add_new_groups(params = {})\n post(\"/groups\", params)\n end",
"def new\n @user = User.new\n @user_groups = UserGroup.get_all_user_groups_in_org(params[:organization_id])\n end",
"def new\n @user = User.new\n @user_groups = UserGroup.get_all_user_groups_in_org(params[:organization_id])\n end",
"def new\n @user = User.new\n @user_groups = UserGroup.get_all_user_groups_in_org(params[:organization_id])\n end",
"def create\n \n @group = Group.new(group_params)\n @group.owner_id = current_user.id\n @group.users << current_user\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_group = UserGroup.new(params[:user_group])\n\n respond_to do |format|\n if @user_group.save\n flash[:notice] = \"User group <em>#{@user_group.name}</em> created.\"\n format.html { redirect_to(@user_group) }\n format.xml { render :xml => @user_group, :status => :created, :location => @user_group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@group = current_user.groups.create(group_params)\n\t\tif params[:users].present?\n\t\t\tparams[:users].each do |user_id|\n\t\t\t\t@group.user_groups.create(user_id: user_id)\n\t\t\tend\n\t\tend\n\t\tredirect_to :groups, notice: 'Group created successfully'\n\tend",
"def new\n authorize UserGroup\n if params.dig(:user_group, :institution_id).blank?\n render plain: \"Missing institution ID\", status: :bad_request\n return\n end\n render partial: \"user_groups/form\",\n locals: { user_group: UserGroup.new(user_group_params) }\n end",
"def new\n @access_group = AccessGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @access_group }\n end\n end",
"def new\n @group = Group.new \n end",
"def new\n @title = \"Добавление возрастной группы\"\n @age_group = AgeGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @age_group }\n end\n end",
"def create\n @group = Group.new(group_params)\n respond_to do |format|\n if @group.save\n @group.memberships.create(user_id: current_user.id, state: \"owner\")\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.8310889",
"0.81497216",
"0.8142499",
"0.7712325",
"0.77065724",
"0.7702905",
"0.7702905",
"0.7702905",
"0.7702905",
"0.7702905",
"0.7702905",
"0.7702905",
"0.7702905",
"0.7655521",
"0.7640157",
"0.7623279",
"0.7622778",
"0.7622778",
"0.75998354",
"0.7594935",
"0.758957",
"0.75561714",
"0.75008017",
"0.7454918",
"0.74144083",
"0.74084324",
"0.7405139",
"0.7385118",
"0.7378687",
"0.7378687",
"0.73623264",
"0.73351985",
"0.7323789",
"0.7302913",
"0.7302349",
"0.7293744",
"0.7278806",
"0.72701085",
"0.72403175",
"0.72403175",
"0.72401565",
"0.7232362",
"0.7223392",
"0.72173625",
"0.72169036",
"0.7215266",
"0.7169984",
"0.71679133",
"0.71677744",
"0.71446705",
"0.7129003",
"0.7128671",
"0.7126292",
"0.71197957",
"0.7103452",
"0.7096912",
"0.7096912",
"0.70877844",
"0.70865697",
"0.70865697",
"0.70732063",
"0.7060169",
"0.7056713",
"0.7047175",
"0.7046939",
"0.7042433",
"0.70415205",
"0.7040782",
"0.7034345",
"0.70285857",
"0.70137876",
"0.7012847",
"0.7009047",
"0.7004371",
"0.7003517",
"0.699769",
"0.6997055",
"0.6997055",
"0.69840944",
"0.6975592",
"0.6965392",
"0.6962122",
"0.69615066",
"0.6942528",
"0.69384795",
"0.69384795",
"0.69384795",
"0.6937045",
"0.69348335",
"0.69313806",
"0.6923368",
"0.6919043",
"0.69133765",
"0.69121295",
"0.69118655",
"0.69040215",
"0.69040215",
"0.69040215",
"0.69040215",
"0.69040215"
] |
0.8208239
|
1
|
POST /user_groups POST /user_groups.json
|
def create
@user_group = UserGroup.new(params[:user_group])
respond_to do |format|
if @user_group.save
format.html { redirect_to @user_group, notice: 'User group was successfully created.' }
format.json { render json: @user_group, status: :created, location: @user_group }
else
format.html { render action: "new" }
format.json { render json: @user_group.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration], owner: current_user)\n if @group.save\n @group.memberships.create!(user: current_user, admin: true)\n if params[:group][:users]\n params[:group][:users].each do |u|\n @group.memberships.create!(user: User.where(\"id = ? OR email = ?\", u[:id], u[:email]).first, admin:u[:admin])\n end\n end\n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration])\n if @group.save\n params[:group][:users].each do |u|\n Membership.create(group: @group, user: User.where(\"id = ? OR email = ?\", u[:id], u[:email]).first, admin:u[:admin])\n end\n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user.create_group!(new_group_params[:group_user_ids], {name: new_group_params[:name]})\n end",
"def create\n\t\t@group = current_user.groups.create(group_params)\n\t\tif params[:users].present?\n\t\t\tparams[:users].each do |user_id|\n\t\t\t\t@group.user_groups.create(user_id: user_id)\n\t\t\tend\n\t\tend\n\t\tredirect_to :groups, notice: 'Group created successfully'\n\tend",
"def create\n @usergroup = Usergroup.new(usergroup_params)\n\n respond_to do |format|\n if @usergroup.save\n format.html { redirect_to @usergroup, notice: 'User group was successfully created.' }\n format.json { render :show, status: :created, location: @usergroup }\n else\n format.html { render :new }\n format.json { render json: @usergroup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n group_ids = params[\"user_groups\"]\n org_id = params[:organization_id]\n @user = User.new(params[:user])\n @user.user_group_ids = group_ids\n @user.organization_id = org_id\n\n if @user.save\n redirect_to organization_users_path(org_id)\n else\n flash[:error] = t('users.new.exist')\n @user_groups = UserGroup.all\n render :new\n end\n end",
"def create\n group_ids = params[\"user_groups\"]\n org_id = params[:organization_id]\n @user = User.new(params[:user])\n @user.user_group_ids = group_ids\n @user.organization_id = org_id\n\n if @user.save\n redirect_to organization_users_path(org_id)\n else\n flash[:error] = t('users.new.exist')\n @user_groups = UserGroup.all\n render :new\n end\n end",
"def create\n @group = Group.new(group_params)\n respond_to do |format|\n if @group.save\n @group.users.push(current_user)\n UserGroup.set_is_admin(@group.id, current_user.id, true)\n invite_members\n format.html { redirect_to @group, notice: t('flash.notice.groups.successfully_created') }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @usergroup = Usergroup.new(usergroup_params)\n\n respond_to do |format|\n if @usergroup.save\n format.html { redirect_to @usergroup, notice: 'Usergroup was successfully created.' }\n format.json { render :show, status: :created, location: @usergroup }\n else\n format.html { render :new }\n format.json { render json: @usergroup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def groups\n \n \n @groups = @current_user.groups\n render 'groups.json.jbuilder', status: :ok\n end",
"def CreateGroup params = {}\n \n APICall(path: 'groups.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n \n @group = Group.new(group_params)\n @group.owner_id = current_user.id\n @group.users << current_user\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n @group.owner = current_user\n\n if @group.save\n @group.add!(current_user)\n \n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def create\n ip = request.location\n @user = current_user\n @group = @user.groups_as_owner.new(params[:group])\n params[:group][:member_ids] = (params[:group][:member_ids] << @group.member_ids).flatten\n @group.school_id = @user.school_id\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = @current_user.create_group(params[:group])\n # @group = @current_user.groups.build(params[:group])\n # @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.valid?\n format.html { redirect_to circle_groups_path, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_to_group\n if request.post?\n @user_id = params[:user_id]\n @group = params[:group_ids]\n @created_g_u= Array.new\n @group.each do |g|\n #g_user = GroupUser.find(:all,:conditions=>[\"user_id=#{@user_id.to_i} and group_id=#{g.to_i}\"])\n group_user = GroupUser.create(:user_id=>@user_id.to_i,:group_id=>g.to_i)# if g_user.blank?\n @created_g_u << group_user if group_user.id\n end\n @notice = \"Successfully added to group.\"\n respond_to do |format|\n format.js\n end\n \n else\n render :partial=>\"add_to_group_form\", :locals=>{:user=>@login_user,:user_id=>params[:id]}, :layout=>false\n end\n end",
"def createGroup(groupName, gid)\r\n uri = sprintf(\"/api/v1/group_categories/%d/groups\", gid) \r\n \r\n dbg(\"POST #{uri}\")\r\n dbg(\"name=#{groupName}\")\r\n newGroup = $canvas.post(uri, {'name' => groupName})\r\n dbg(newGroup)\r\n return newGroup\r\nend",
"def createGroup(groupName, gid)\r\n uri = sprintf(\"/api/v1/group_categories/%d/groups\", gid) \r\n \r\n dbg(\"POST #{uri}\")\r\n dbg(\"name=#{groupName}\")\r\n newGroup = $canvas.post(uri, {'name' => groupName})\r\n dbg(newGroup)\r\n return newGroup\r\nend",
"def add_new_groups(params = {})\n post(\"/groups\", params)\n end",
"def create\n @users = User.where(\"owner_id = ?\", current_user).order('lastname ASC')\n @group = current_user.groups.create(group_params)\n @owner = current_user\n if @group.persisted?\n flash[:green] = \"Group created!\"\n redirect_to groups_path\n else\n render root_path\n end\n end",
"def addUserToGroup(uid, groupId)\r\n uri = sprintf(\"/api/v1/groups/%d/memberships\", groupId)\r\n\t $canvas.post(uri, {'user_id' => uid})\r\nend",
"def addUserToGroup(uid, groupId)\r\n uri = sprintf(\"/api/v1/groups/%d/memberships\", groupId)\r\n\t $canvas.post(uri, {'user_id' => uid})\r\nend",
"def create\n @add_group_to_user = AddGroupToUser.new(params[:add_group_to_user])\n\n respond_to do |format|\n if @add_group_to_user.save\n format.html { redirect_to @add_group_to_user, notice: 'Add group to user was successfully created.' }\n format.json { render json: @add_group_to_user, status: :created, location: @add_group_to_user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @add_group_to_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n token = params[:token]\n\n # use the user login instance and match emails to find current user\n @user_login = UserLogin.where(token: token).take\n @current_user = User.where(email: @user_login.email).take\n\n respond_to do |format|\n if @group.save\n\n # create a new group membership for new group w/ current user as admin\n @new_membership = GroupMembership.create(group_id: @group.id, user_id: @current_user.id, is_admin: true)\n\n # associate new membership with the group and the user\n @group.group_memberships << @new_membership\n @current_user.group_memberships << @new_membership\n\n format.html { redirect_to group_path(:id => @group.id), notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.find(params[:user_id])\n if @user.is_member?(@group)\n render_error(404, request.path, 20100, \"User is already a member.\")\n else\n if @user.join!(@group)\n render json: { result: 1,\n group_id: @group.id,\n group_name: @group.name,\n user_count: @group.users.count }\n else\n render json: {result: 0}\n end\n end\n end",
"def create_a_user_group_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: IamUserGroupsApi.create_a_user_group ...'\n end\n # unbox the parameters from the hash\n # resource path\n local_var_path = '/user-groups'\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 content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'request_body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Object'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"IamUserGroupsApi.create_a_user_group\",\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: IamUserGroupsApi#create_a_user_group\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @group = Group.new(group_params)\n @group.admin_id = current_user.id\n respond_to do |format|\n if @group.save\n\tUserGroup.create(admin: true, user_id: current_user.id, group_id: @group.id)\n\tflash[:success] = \"Group was successfully created!\"\n format.html { redirect_to @group }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @user = User.find(params[:user_id])\n @groups = @user.groups.new\n\n #@group = Group.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def create\n @group = Group.new(group_params)\n @group.user = @user\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = current_user\n @group = Group.new(group_params)\n @group.save\n respond_with(@group)\n end",
"def create_group(path, name)\n puts \"creating #{name} on path #{path}\"\n \n ret = RestClient.post \"#{@url}/groups\", \n { path: path, name: name }, \n { \"Private-Token\": @token } \n json = JSON.parse(ret.body)\n\n json['id']\n end",
"def add_to_group\n ids = params[:ids]\n group = Group.find(params[:group_id])\n if ids.present?\n users = User.where(id: ids)\n users.each do |u|\n GroupUser.create(user: u, group: group, created_by: current_user)\n if current_user != u\n u.notify(\n \"#{current_user.to_s} has added you to user group: #{group.name}\",\n group, \n \"group\"\n )\n else\n group.admin.each do |admin|\n admin.notify(\n \"#{current_user.to_s} has requested to be added to the user group: #{group.name}\",\n group,\n \"group\"\n )\n end\n end\n end\n if users.count === 1 && users.first === current_user\n flash[:notice] = \"Request sent!\"\n else\n flash[:notice] = \"#{\"Invitation\".pluralize(users)} sent!\"\n end\n end\n respond_to do |format|\n format.json { render :json => {}, :status => :ok }\n format.html {\n if users\n flash.now[:success] = \"Group membership pending for #{users.map(&:username).join(', ')}.\"\n end \n redirect_to group_path(group) \n }\n end\n end",
"def add_user\n group_id_param = params[:group_id]\n user_id_param = params[:user_id]\n\n if group_id_param.nil? || group_id_param.blank?\n render json: { error: 'group_id not specified.' }, status: :bad_request\n return\n end\n\n if user_id_param.nil? || user_id_param.blank?\n render json: { error: 'user_id not specified.' }, status: :bad_request\n return\n end\n\n user = User.find_by_id(user_id_param)\n if user.nil?\n render json: { error: \"Can't find user #{user_id_param}.\" }, status: :bad_request\n return\n end\n\n group = CanvasSpaces.GroupCategory.groups.find_by_id(group_id_param)\n if group.nil?\n render json: { error: 'No such group found.' }, status: :bad_request\n else\n if @current_user.account.site_admin? ||\n group.leader_id == @current_user.id ||\n @current_user.id == user.id\n\n group.add_user user\n group.save\n\n render json: { message: 'Successfully added user.' }, status: :ok\n else\n # doesn't have access to the group\n render json: { error: \"Can't add user. Not owner or not adding self.\" }, status: :forbidden\n end\n end\n end",
"def new_nodegroup(nodegroup_json)\n nodemgr_rest_call(\"POST\", \"classifier\", \"groups\", $credentials, id=\"\", nodegroup_json)\nend",
"def create\n @group = Group.new(params[:group])\n @group.users << current_user\n \n respond_to do |format|\n if @group.save\n @group.groups_users.first.update_attribute :level, 2\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n @group.owner = current_user\n\n group_name_exists = false\n current_user.owned_groups.each do |g|\n if g.name == @group.name\n group_name_exists = true\n break\n end\n end\n \n respond_to do |format|\n if group_name_exists\n format.html { redirect_to groups_path, :alert => \"You already have a list by the name '#{@group.name}'.\" }\n format.json { render :json => @group, :status => :created, :location => @group }\n elsif @group.save\n format.html { redirect_to @group, :notice => 'Group was successfully created.' }\n format.json { render :json => @group, :status => :created, :location => @group }\n else\n error_msg = 'Unexpected error while creating group.'\n if @group.errors.messages.count > 0\n error_msg = 'Following error(s) prevented the group from being saved: '\n multiple = false\n @group.errors.full_messages.each do |msg|\n if multiple\n error_msg += ', '\n end\n error_msg += msg\n multiple = true\n end\n end\n format.html { redirect_to groups_path, :action => 'index', :alert => error_msg }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n #should expire groups page cache\n \n # expire the cache of the grouplist of this user\n Rails.cache.delete(Person.groups_cache_key(@current_user.id, session[:cookie]))\n \n @group = Group.new\n begin\n @group = Group.create(params[\"group\"], session[:cookie])\n flash[:notice] = :group_created_successfully\n redirect_to group_path(@group) and return\n rescue RestClient::RequestFailed => e\n @group.add_errors_from(e)\n @group.form_title = params[:group][:title]\n @group.form_description = params[:group][:description]\n render :action => :new and return\n rescue RestClient::Unauthorized => e\n @group.add_errors_from(e)\n @group.form_title = params[:group][:title]\n @group.form_description = params[:group][:description]\n render :action => :new and return \n end\n end",
"def create(data)\n result = @client.api_request(:method => \"usergroup.create\", :params => data)\n result ? result['usrgrpids'][0].to_i : nil\n end",
"def create\n # @group_user = GroupUser.new(params[:group_user])\n @group_user = @current_user.join_group(@group)\n respond_to do |format|\n if @group_user\n format.html { redirect_to @group, notice: 'Group user was successfully created.' }\n format.json { render json: @group_user, status: :created, location: @group_user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = current_user.groups.new(group_params)\n\n if (@group.save)\n flash[:success] = \"Found a new group!\"\n else\n flash[:warning] = \"Could not create group\"\n end\n\n redirect_to @group\n end",
"def new\n @add_group_to_user = AddGroupToUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @add_group_to_user }\n end\n end",
"def create\n @group = Group.new(params[:group])\n\t\t@group.user_id = session[:user_id]\n\n respond_to do |format|\n if @group.save\n\n\t\t\t\t@page = Page.create(:owner => @group.id, :category => 'group')\n\t\t\t\t@group_member = GroupMember.create(:group_id => @group.id, :user_id => session[:user_id], :moderator => true)\n format.html { redirect_to groups_url, :notice => 'Group was successfully created.' }\n format.json { render :json => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(params[:user])\n @user.company_id = current_user.company_id\n\n password = @user.password.nil? ? @user.generate_password : false\n \n if @user.save && params.has_key?(:multiselect_user_grouping_ids)\n @user.update_groupings(params[:user][:grouping_ids])\n @user.notify_account(password) if password\n params.has_key?(:multiselect_user_role_ids) ? @user.update_roles(params[:user][:role_ids]) : @user.add_employee_role\n gflash :success => \"User created.\"\n else\n @user.errors[:base] << \"You must assign the user to one or more groups.\" unless params.has_key?(:user_groupings)\n @assigned_groups = current_user.root_grouping.id\n end\n \n respond_with(@user)\n end",
"def new\n @user_group = UserGroup.new\n @users = User.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_group }\n end\n end",
"def create\n @group = Group.new(group_params)\n if current_user\n @group.user_id = current_user.id\n end\n \n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_group = UserGroup.new(params[:user_group])\n\n respond_to do |format|\n if @user_group.save\n flash[:notice] = \"User group <em>#{@user_group.name}</em> created.\"\n format.html { redirect_to(@user_group) }\n format.xml { render :xml => @user_group, :status => :created, :location => @user_group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @groups_user = GroupsUser.find(params[:id])\n @groups_user = GroupsUser.new(groups_user_params)\n # @groups_user.user_id=1\n # @groups_user.group_id=3\n # respond_to do |format|\n if @groups_user.save\n redirect_to groups_url\n # format.html { redirect_to groups_url, notice: 'Groups user was successfully created.' }\n # format.json { render :show, status: :created, location: @groups_user }\n else\n format.html { render :new }\n format.json { render json: @groups_user.errors, status: :unprocessable_entity }\n end\n # end\n end",
"def create\n @group = Group.new(params[:group])\n @group.users.push @current_user\n \n respond_to do |format|\n if @group.save\n @group.invite params[:invite_emails].split(',')\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n group = Group.new(group_params)\n if group.save\n render json: group\n else\n render json: group.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def create\n @group = Group.new(group_params)\n respond_to do |format|\n if @group.save\n @group.memberships.create(user_id: current_user.id, state: \"owner\")\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reagent_group = ReagentGroup.new(params[:reagent_group])\n unless @reagent_group.users.include? current_user\n @reagent_group.users << current_user\n end\n respond_to do |format|\n if @reagent_group.save\n format.html { redirect_to @reagent_group, notice: 'Reagent group was successfully created.' }\n format.json { render json: @reagent_group, status: :created, location: @reagent_group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reagent_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_group = UserGroup.new(user_group_params)\n authorize @user_group\n begin\n @user_group.save!\n rescue => e\n render partial: \"shared/validation_messages\",\n locals: { object: @user_group.errors.any? ? @user_group : e },\n status: :bad_request\n else\n toast!(title: \"User group created\",\n message: \"The user group \\\"#{@user_group.name}\\\" has been created.\")\n render \"shared/reload\"\n end\n end",
"def create\n @user_accounts_group = UserAccountsGroup.new(user_accounts_group_params)\n\n respond_to do |format|\n if @user_accounts_group.save\n format.html { redirect_to @user_accounts_group, notice: 'User accounts group was successfully created.' }\n format.json { render :show, status: :created, location: @user_accounts_group }\n else\n format.html { render :new }\n format.json { render json: @user_accounts_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_users\n group_name = params[:name]\n @group = $iam.groups[group_name]\n\n respond_to do |format|\n if @group.exists? # check if group already exists, then add user\n @group.users.add($iam.users[\"Ayesha\"])\n @group.users.add($iam.users[\"Fawad\"])\n format.html { redirect_to \"/show_group/#{@group.name}\", notice: 'User is added.' }\n else\n format.html { redirect_to \"/show_group/#{@group.name}\", notice: 'Error' }\n end\n end\n\n end",
"def create\n @user = User.find(current_user.id)\n @group = Group.new(group_params)\n\n @group.title = params[:title]\n @group.description = params[:description]\n @group.groupProfile = params[:groupProfile]\n @group.groupCover = params[:groupCover]\n\n respond_to do |format|\n if @group.save\n @user.groups << @group\n\n GroupCategory.new(group_id: @group.id , category_id: params[:category]).save\n\n format.html { redirect_to user_group_path(current_user.id, @group.id) }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n respond_to do |format|\n if @group.save\n @membership = Membership.create!(group_id: @group.id, user_id: current_user.id, admin: true)\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = current_user.groups.new(group_params)\n\n if @group.save\n redirect_to groups_path, notice: 'Group was successfully created.'\n else\n flash[:alert] = @group.errors.full_messages.first\n redirect_to new_group_path\n end\n end",
"def create\n group_ids = params[\"group_id\"]\n org_id = params[:organization_id]\n @user = User.new(full_name: params[:full_name], password: params[:password], password_confirmation: params[:password], email: params[:email], status: params[:status], staff_number: params[:employee_id], career_path: params[:career_path], team_leader_id: nil)\n @user.user_group_ids = group_ids\n @user.organization_id = org_id\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.messages, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = current_user.groups.build(:name => params[:group][:name])\n @group.set_members(params[:member])\n\n if @group.save\n redirect_to root_path\n else\n render 'new'\n end\n\n end",
"def add_user(data)\n result = @client.api_request(\n :method => \"usergroup.massAdd\", \n :params => {\n :usrgrpids => data[:usrgrpids],\n :userids => data[:userids]\n }\n )\n result ? result['usrgrpids'][0].to_i : nil\n end",
"def create\n @group = Group.new(group_params)\n @group.owner = current_user\n\n respond_to do |format|\n if @group.save && @group.add_user!(current_user, :admin)\n audit(@group, \"create\", @group.name)\n format.html { redirect_to :back, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if(params[:group][:name].nil?) or (params[:group][:name] == \"\")\n flash[:notice] = \"Group must have a name and description\"\n redirect_to new_group_path\n else\n \n #create a new group\n @group = Group.new(group_params)\n user = User.find(session[:user_id]) \n respond_to do |format|\n if @group.save\n #generate a code for the group\n o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten\n new_code = (0...8).map { o[rand(o.length)] }.join\n @group.update(code: new_code)\n #after group is created add creator to group as leader\n Membership.create!(user_id: session[:user_id], group_id: @group.id, member_type: 'leader', username: user.username)\n format.html {redirect_to @group, notice: \"Group was successfully created.\"}\n format.json {render :show, status: :created, location: @group}\n else\n format.html {render :new, status: :unprocessable_entity}\n format.json {render json: @group.errors, status: :unprocessable_entity}\n end\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n @group.owner = current_user\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to group_path(@group), notice: \"Group was successfully created.\" }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def group_params\n params.require(:group).permit(:name, :group_image, user_ids: [])\n end",
"def create_group(attributes)\n post(\"/v1/groups\", attributes)\n end",
"def create\n @tasks_group = TasksGroup.new(tasks_group_params)\n @tasks_group.user = current_user\n\n respond_to do |format|\n if @tasks_group.save\n format.html { redirect_to @tasks_group, notice: 'Tasks group was successfully created.' }\n format.json { render :show, status: :created, location: @tasks_group }\n else\n format.html { render :new }\n format.json { render json: @tasks_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @usernetworkgroup = Usernetworkgroup.new(usernetworkgroup_params)\n\n respond_to do |format|\n if @usernetworkgroup.save\n format.html { redirect_to @usernetworkgroup, notice: 'Usernetworkgroup was successfully created.' }\n format.json { render :show, status: :created, location: @usernetworkgroup }\n else\n format.html { render :new }\n format.json { render json: @usernetworkgroup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n @group.owner = current_user\n @group.users << current_user\n\n respond_to do |format|\n if @group.save\n membership = Membership.find_by_group_id_and_user_id(@group.id, current_user)\n membership.update_attributes :acceptance_status => true\n\n format.html { redirect_to group_path(@group), alert: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def move_users_to_group(group_id, arr_of_user_ids)\n arr_of_user_ids.each { |id|\n populate_group = HTTParty.post(\n \"#{$canvas_url}/api/v1/groups/#{group_id}/memberships\",\n headers: { \"authorization\" => \"Bearer #{$canvas_token}\" },\n body: {\n user_id: id\n } \n )\n }\nend",
"def create\n @group = StudentGroup.new(params[:student_group])\n users = []\n #@group.institution_id = current_user.institution.id if current_user.institution\n #@group.center_id = current_user.center.id if current_user.center\n #@group.role_id = 10 #short_role for SG group\n respond_to do |format|\n if @group.save\n if current_user.is?'ET' or current_user.is? 'EO'\n StudentGroupOwner.create(student_group_id: @group.id, user_id: current_user.id)\n end\n if params[\"users\"].present?\n users = users + params[\"users\"]\n end\n if params[\"teachers\"].present?\n users = users + params[\"teachers\"]\n end\n unless users.empty?\n users.each do |i|\n UserGroup.create(:group_id=>@group.id,:user_id=>i.to_i)\n end\n end\n format.html { redirect_to group_path(@group), notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n new_group = Group.new(name: params[:name])\n\n if new_group.save\n render json: { \"notice\"=>\"new group #{params[:name]} successfully created\" }\n else\n render json: { \"alert\"=>\"group creation failed. check params.\" }\n end\n end",
"def create\n #redirect_to new_grouping_path if params[:grouping][:name] == ''\n #@grouping = Grouping.new(params[:grouping])\n @grouping.company_id = current_user.company_id\n\n if @grouping.save\n gflash :success => 'Group created.' \n else\n @users = []\n @root = false\n end\n \n #redirect_to edit_grouping_path(@grouping)\n respond_with(@grouping)\n end",
"def create\n\n group = Group.create(group_parm.merge(account_id: current_user.id)) #group creater current user will be the admin of group\n if group.save!\n render :json => Base64.encode64(group.id.to_s) and return\n else\t\t \n render :json => group.errors.full_messages.first and return\n end \n end",
"def add_group_member(dept_id, user_id)\n\n user_create = {\n \"@odata.id\" => \"https://graph.microsoft.com/v1.0/directoryObjects/#{user_id}\"\n }\n\n response = HTTParty.post(\"https://graph.microsoft.com/v1.0/groups/#{dept_id}/members/$ref\", { \n \n body: user_create.to_json,\n\n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Host\" => 'graph.microsoft.com',\n \"Content-Type\" => 'application/json', \n\n }\n\n })\n\n case response.code\n when 204\n return response.code\n when 400...600\n return JSON.parse response.read_body\n end\n \n end",
"def create_group\n name_param = params[:name]\n description_param = params[:description]\n members_param = params[:members] || []\n maillists_param = params[:maillists] || []\n leader_id_param = params[:leader_id]\n join_type_param = params[:join_type]\n\n if name_param.nil? || name_param.blank?\n render json: { field: 'name', error: 'You must provide a name for your space' }, status: :bad_request\n return\n end\n\n unless group_name_is_unique? name_param\n render json: { field: 'name', error: \"A Space named \\\"#{name_param}\\\" already exists\" }, status: :bad_request\n return\n end\n\n if description_param.nil? || description_param.blank?\n render json: { field: 'description', error: 'No description specified' }, status: :bad_request\n return\n end\n\n if join_type_param.nil? || join_type_param.blank?\n render json: { field: 'join_type', error: 'No join_type specified' }, status: :bad_request\n return\n end\n\n if (!params[:maillist].empty? && !maillist_is_valid?(params[:maillist]))\n render json: { field: 'maillist', error: \"\\\"#{params[:maillist]}\\\" is not a valid maillist\" }, status: :bad_request\n return\n end\n\n # concat maillist members into the members array so they get added for the initial load\n members_param.concat maillist_members(params[:maillist]) unless params[:maillist].empty?\n\n # filter out non-canvas users\n members = members_param.map do | member |\n pseudonym = Pseudonym.active.by_unique_id member\n pseudonym.first.user unless pseudonym.empty?\n end\n members.compact.uniq!\n\n if @current_user.account.site_admin?\n if leader_id_param && !leader_id_param.blank?\n leader = User.find_by_id(leader_id_param)\n if leader.nil?\n render json: { error: \"Can't find user specified for leader\" }, status: :bad_request\n return\n end\n else\n leader = @current_user\n end\n else\n # if a non-admin is creating the group then\n # the leader is that user and that id is used to determine who \"owns\"\n # the group and can make changes to it\n leader = @current_user\n end\n\n if join_type_param == 'free_to_join'\n join_type = 'parent_context_auto_join'\n elsif join_type_param == 'request'\n join_type = 'parent_context_request'\n elsif join_type_param == 'invite_only'\n join_type = 'invitation_only'\n else\n render json: { field: 'join_type', error: 'Invalid join_type value. Valid: request, free_to_join, invite_only' }, status: :bad_request\n return\n end\n\n group = @domain_root_account.groups.create( name: name_param,\n group_category: CanvasSpaces.GroupCategory,\n leader: leader,\n join_level: join_type,\n description: description_param )\n group.add_user(leader)\n group.save\n members.each { |member| group.add_user(member) } unless members.empty?\n\n add_maillist = set_maillist_for_space(group.id, params[:maillist]) unless params[:maillist].empty?\n\n render json: group.as_json(only: [ :id, :name, :description, :leader_id, :created_at ],\n include_root: false)\n .merge({ size: 0, join_type: join_type_param }), status: :ok\n end",
"def new\n @user_group = UserGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_group }\n end\n end",
"def create\n @user_group = UserGroup.new(params[\"user_group\"])\n permission_ids = params[\"permissions\"]\n org_id = params[:organization_id]\n @user_group.permission_ids = permission_ids\n @user_group.organization_id = org_id\n\n if @user_group.save\n redirect_to organization_user_groups_path\n else\n flash[:error] = t('user_group.exist')\n @permissions = Permission.get_hash_group_permission\n render :new\n end\n\n end",
"def create\n @group = Group.new(group_params)\n member = Member.create\n @group.members << member\n current_user.members << member\n\n @group.owner = member\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n if @group.save\n render_json_message({:success => t('.success')}, 201, {id: @group.id})\n else\n render_json_message({:errors => @group.errors.messages}, 422)\n end\n\n end",
"def to_groups\n message = AssignTasksToGroups.new(params).perform\n json_response({message: message}, :created)\n end",
"def create\n # @group = Group.create(group_params)\n # @group.save\n @group = Group.new\n puts @group\n @group.name = params['name']\n puts params['user_id']\n @group.user_id = params['user_id']\n\n respond_to do |format|\n if @group.save\n # format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n # else\n # format.html { render :new }\n # format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n group_user = GroupUser.create(:group_id => @group.id, :user_id => current_user.id, :role_id => Role.find_by_name('Owner').id)\n group_user.approve!\n flash[:notice] = \"Group has been created!\"\n format.html { redirect_to groups_path }\n format.xml { render :xml => @group.to_xml }\n else\n format.html { render :action => :new }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n group_user = GroupUser.create(:group_id => @group.id, :user_id => current_user.id, :role_id => Role.find_by_name('Owner').id)\n group_user.approve!\n flash[:notice] = \"Group has been created!\"\n format.html { redirect_to groups_path }\n format.xml { render :xml => @group.to_xml }\n else\n format.html { render :action => :new }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n @u = User.create(:login=>@group.name, :password=>@group.psd, :password_confirmation=>@group.psd, :email =>@group.name+'@mail.msiu.ru')\n @u.role=0\n @u.save\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, :notice => 'Группа была создана.' }\n format.json { render :json => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n @group.user_id = current_user.id\n if @group.save\n flash[:notice] = \"Grupo creado exitosamente.\"\n redirect_to groups_path\n else\n render :action => 'new'\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, :notice => 'Group was successfully created.' }\n format.json { render :json => @group, :status => :created, :location => @group}\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_group(groupname)\n current_path = '/api/v1/groups'\n payload = { 'group_name' => groupname }.to_json\n @conn.post(current_path, payload)\n end",
"def new\n @group = current_user.groups.build\n\n respond_to :html\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to groups_path, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def group_params\n params.require(:group).permit(:user_id, :name)\n end",
"def usergroup_params\n params.require(:usergroup).permit(:id, :group_name, :created_at, :created_by)\n end",
"def create\n @group = Group.new(group_params)\n #On vérifie que la liste de droits d'un groupe est effacé\n @group.rights.clear\n\n #On ajoute les droits choisis par un utilisateur\n params[:group][:right_ids] ||= []\n params[:group][:right_ids].each do |right|\n if !(right.blank?)\n @group.add_right(Right.find_by_id(right))\n end\n end\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: t('group.created_msg') }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def insert_group_with_http_info(group, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserApi.insert_group ...'\n end\n # verify the required parameter 'group' is set\n if @api_client.config.client_side_validation && group.nil?\n fail ArgumentError, \"Missing the required parameter 'group' when calling UserApi.insert_group\"\n end\n # resource path\n local_var_path = '/user/groups'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\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; charset=UTF-8'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(group)\n auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']\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 => 'GroupResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#insert_group\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n #TODO validate that the params[:id] is a legal value for user\n @group = Group.find(params[:group_id])\n authorize! :edit, @group\n Hydra::LDAP.add_users_to_group(@group.code, [params[:id]])\n redirect_to edit_group_path(@group), :notice=>\"Added member #{params[:id]}\"\n end",
"def create\n @group = Group.new(group_params)\n @group.group_users.build user_type: 'Group Owner', user_id: @current_user.id\n @group.share_id = Array.new(8){rand(36).to_s(36)}.join\n\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n name = params[:name]\n @group = Group.new(name: name)\n @group.creator_id = @current_user.id\n if @group.save\n @current_user.creator_join!(@group)\n respond_with(@group, only: [:id, :name, :creator_id, :admin_id])\n else\n render_error(404, request.path, 20101, @group.errors.as_json)\n end\n end",
"def create_group\n params[:new_members] = params[:participants]\n params[:new_admins] = params[:admin_ids]\n conversation = current_user.conversations.new(group_params)\n if conversation.save\n render_conversation(conversation)\n else\n render_error_model(conversation)\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.json { render json: @group, status: :created }\n else\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_user(user)\n UserGroup.create(user_id: user.id, group_id: id)\n end"
] |
[
"0.7620012",
"0.7490094",
"0.73576283",
"0.7339031",
"0.7214107",
"0.7198815",
"0.7198815",
"0.7193646",
"0.71699816",
"0.70594156",
"0.70528823",
"0.69945705",
"0.6989121",
"0.6954357",
"0.69419956",
"0.68917257",
"0.68747854",
"0.68747854",
"0.68452394",
"0.6844827",
"0.6836015",
"0.6836015",
"0.68205565",
"0.6790916",
"0.67891276",
"0.6787753",
"0.6779528",
"0.676914",
"0.67494404",
"0.6743473",
"0.67402333",
"0.6735554",
"0.6729936",
"0.67130816",
"0.66953206",
"0.66930896",
"0.66872615",
"0.66857463",
"0.6675674",
"0.66751564",
"0.664757",
"0.66386086",
"0.6622345",
"0.66170955",
"0.66059715",
"0.6604634",
"0.66025543",
"0.6598785",
"0.6578004",
"0.65744746",
"0.6566464",
"0.6534286",
"0.65129316",
"0.6511958",
"0.6507158",
"0.6504399",
"0.6496879",
"0.6479991",
"0.6473457",
"0.64712346",
"0.6451293",
"0.644776",
"0.6446543",
"0.6444385",
"0.64074343",
"0.6406942",
"0.6404358",
"0.6398434",
"0.63966334",
"0.6377891",
"0.63742363",
"0.6367567",
"0.63621765",
"0.6360539",
"0.63578695",
"0.6341088",
"0.63183737",
"0.6317176",
"0.63156474",
"0.63116455",
"0.6311555",
"0.6301724",
"0.6301724",
"0.63011444",
"0.62980145",
"0.62922686",
"0.6290231",
"0.62847525",
"0.6281366",
"0.6281237",
"0.6265171",
"0.62486744",
"0.62370336",
"0.6235872",
"0.62332416",
"0.62329036",
"0.6232159",
"0.62182593",
"0.6206183"
] |
0.71942973
|
8
|
PUT /user_groups/1 PUT /user_groups/1.json
|
def update
@user_group = UserGroup.find(params[:id])
respond_to do |format|
if @user_group.update_attributes(params[:user_group])
format.html { redirect_to @user_group, notice: 'User group was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @user_group.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @user_group = UserGroup.find(params[:id])\n\n respond_to do |format|\n if @user_group.update_attributes(params[:user_group])\n format.html { redirect_to @user_group, notice: 'User group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateGroup params = {}\n \n APICall(path: 'groups.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @user = User.get!(params[:id])\n set_groups(@user, ids_to_groups(params[:groups]))\n \n respond_to do |format|\n if @user.update_attributes(params[:user]) or not @user.dirty?\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(user_url(@user.id)) }\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 @groups_user = GroupsUser.find(params[:id])\n respond_to do |format|\n if @groups_user.update(groups_user_params)\n format.html { redirect_to @groups_user, notice: 'Groups user was successfully updated.' }\n format.json { render :show, status: :ok, location: @groups_user }\n else\n format.html { render :edit }\n format.json { render json: @groups_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n @users = @group.users\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to edit_user_registration_path, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_group = UserGroup.find(params[:id])\n\n respond_to do |format|\n if @user_group.update_attributes(params[:user_group])\n flash[:notice] = \"User group <em>#{@user_group.name}</em> updated.\"\n format.html { redirect_to(@user_group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n logger.info \"Put parameters: #{params.to_json}\"\n @group = Group.find(params[:id])\n\n if @group.update_attributes(params[:group])\n head :no_content\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @usergroup.update(usergroup_params)\n format.html { redirect_to @usergroup, notice: 'User group was successfully updated.' }\n format.json { render :show, status: :ok, location: @usergroup }\n else\n format.html { render :edit }\n format.json { render json: @usergroup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @users = User.where(\"owner_id = ?\", current_user).order('lastname ASC')\n @group = current_user.groups.find(params[:id])\n if @group.update_attributes(group_params)\n flash[:green] = \"Asset was successfully updated.\"\n redirect_to @group\n else\n render :edit\n end\n end",
"def update\n @group_user = GroupUser.find(params[:id])\n\n respond_to do |format|\n if @group_user.update_attributes(params[:group_user])\n format.html { redirect_to @group_user, notice: 'Group user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @add_group_to_user = AddGroupToUser.find(params[:id])\n\n respond_to do |format|\n if @add_group_to_user.update_attributes(params[:add_group_to_user])\n format.html { redirect_to @add_group_to_user, notice: 'Add group to user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @add_group_to_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n group = Group.find(params[:id])\n if group.update(group_params)\n render json: group\n else\n render json: group.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n authorize! :update, @group\n @group.creator = current_user\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:commit] == \"Remove users\"\n @usergroup.users.each do |user|\n @usergroup.users.delete(user) if params[:usergroup][\"user\" + user.id.to_s] == \"1\"\n end\n elsif params[:commit] == \"Add users\"\n User.all.each do |user|\n @usergroup.users << user if params[:usergroup][\"user\" + user.id.to_s] == \"1\"\n end\n else\n @usergroup.update(usergroup_params)\n end\n redirect_to users_path\n end",
"def update\n @user = User.find(params[:id])\n Group.find(:all).each do |group|\n groups = params[:groups].map {|i| i.to_i} rescue []\n membership = Membership.find(:first, :conditions => [\"group_id = ? and user_id = ?\", group.id, @user.id])\n g_checked = groups.include? group.id\n Membership.create(:group => group, :user => @user) if !membership && g_checked\n membership.destroy if membership && !g_checked\n end\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html do\n flash[:notice] = \"User #{@user.full_name} was successfully updated.\"\n redirect_to users_url\n end\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors.to_xml }\n end\n end\n end",
"def set_user_group\n @user_group = UserGroup.find(params[:id])\n end",
"def set_user_group\n @user_group = UserGroup.find(params[:id])\n end",
"def addGroupToServer(group)\n path = \"/user/\" + @@conf[\"username\"] + \"/group/\" + group.strip\n res = HttpRequest.new(:put, path).send(@@host)\n puts res\n puts \"CODE: \" + res.code\n\nend",
"def update\n @group = Group.find(params[:id])\n if !@group.admin.empty?\n @user=User.find(@group.admin)\n puts \"///////group controller update//////////\"+ @user.to_json\n @user.update_attributes(role: '1')\n @user.update_attributes(group_id: @group._id)\n end\n @group.update_attributes(params[:group])\n #format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n #format.json { render json: @group, status: :accepted, location: @group }\n render 'show'\n #format.html { render action: \"edit\" }\n #format.json { render json: @group.errors, status: :unprocessable_entity } \n end",
"def update_nodegroup(nodegroup_json, nodegroup_id)\n nodemgr_rest_call(\"POST\", \"classifier\", \"groups\", $credentials, id=nodegroup_id, nodegroup_json)\nend",
"def set_usergroup\n @usergroup = Usergroup.find(params[:id])\n end",
"def set_usergroup\n @usergroup = Usergroup.find(params[:id])\n end",
"def set_usergroup\n @usergroup = Usergroup.find(params[:id])\n end",
"def set_user_group\n @user_group = UserGroup.find(params[:id])\n end",
"def addUserToGroup(uid, groupId)\r\n uri = sprintf(\"/api/v1/groups/%d/memberships\", groupId)\r\n\t $canvas.post(uri, {'user_id' => uid})\r\nend",
"def addUserToGroup(uid, groupId)\r\n uri = sprintf(\"/api/v1/groups/%d/memberships\", groupId)\r\n\t $canvas.post(uri, {'user_id' => uid})\r\nend",
"def put(obj, which=:groups)\n path = \"/#{which}\"\n path += \"/#{obj['ID']}\" unless obj['ID'].nil? \n resp = self.class.post(path, { :body => obj })\n check_errors resp\n res = resp.parsed_response['Response']['Entry']\n rebuild_groups! res\n res\n end",
"def update\n #logger.info \"Put parameters: #{params.to_json}\"\n\n if @membership.admin \n if @group.update_attributes(params[:group])\n head :no_content\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n else \n render json: {error: \"YOU MUST BE AN ADMINISTRATOR TO COMPLETE THIS ACTION\"}, status: :unprocessable_entity\n end \n end",
"def update\n if @group.update_attributes(params[:group])\n respond_with(@group, only: [:id, :name, :creator_id, :admin_id])\n else\n render_error(404, request.path, 20103, \"Failed to update group info\")\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n if @group.owner != current_user\n respond_to do |format|\n format.html { redirect_to @group, notice: 'User not authorized.' }\n format.json { render json: @group, status: :not_authorized, location: group }\n end\n return\n end\n\n new_group_name = params[:group][:name]\n group_name_exists = false\n\n if new_group_name != @group.name\n current_user.owned_groups.each do |g|\n if g.name == new_group_name\n group_name_exists = true\n end\n end\n end\n \n respond_to do |format|\n if group_name_exists\n format.html { redirect_to @group, :alert => \"You already have a group by the name '#{new_group_name}'.\" }\n format.json { head :no_content }\n elsif new_group_name == @group.name\n format.html { redirect_to @group }\n format.json { head :no_content }\n elsif @group.update_attributes(params[:group])\n format.html { redirect_to @group, :notice => 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n error_msg = 'Unexpected error while updating group.'\n if @group.errors.messages.count > 0\n error_msg = 'Following error(s) prevented the group from being saved: '\n multiple = false\n @group.errors.full_messages.each do |msg|\n if multiple\n error_msg += ', '\n end\n error_msg += msg\n multiple = true\n end\n end\n format.html { redirect_to @group, :alert => error_msg }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_groups(desc, type, groups)\n for id, val in groups\n if group = UserGroup.safe_find(id)\n update_group(desc, type, group, (val == '1'))\n else\n flash_error(:runtime_description_user_not_found.t(:name => id))\n end\n end\n end",
"def update\n user_group_ids = params[\"user_groups\"] || []\n user_group_ids.map! { |g| g.to_i }\n @user = User.find_by_id(params[:id])\n current_group_ids = @user.user_group_ids\n\n if params[\"user\"] && params[\"user\"][\"password\"].blank?\n params[\"user\"].delete(:password)\n params[\"user\"].delete(:password_confirmation)\n end\n\n if @user.update_attributes(params[\"user\"])\n is_logged = !@user.previous_changes.blank?\n if current_group_ids != user_group_ids\n @user.user_group_ids = user_group_ids\n @user.create_activity :edit_info, owner: current_user, params: {:detail => I18n.t('logs.edit_user', user_name: @user.user_full_name)} if !is_logged\n end\n redirect_to organization_users_path(params[:organization_id])\n return\n else\n @user_groups = UserGroup.get_all_user_groups_in_org(params[:organization_id])\n render :edit_temp\n return\n end\n end",
"def update\n user_group_ids = params[\"user_groups\"] || []\n user_group_ids.map! { |g| g.to_i }\n @user = User.find_by_id(params[:id])\n current_group_ids = @user.user_group_ids\n\n if params[\"user\"] && params[\"user\"][\"password\"].blank?\n params[\"user\"].delete(:password)\n params[\"user\"].delete(:password_confirmation)\n end\n\n if @user.update_attributes(params[\"user\"])\n is_logged = !@user.previous_changes.blank?\n if current_group_ids != user_group_ids\n @user.user_group_ids = user_group_ids\n @user.create_activity :edit_info, owner: current_user, params: {:detail => I18n.t('logs.edit_user', user_name: @user.user_full_name)} if !is_logged\n end\n redirect_to organization_users_path(params[:organization_id])\n return\n else\n @user_groups = UserGroup.get_all_user_groups_in_org(params[:organization_id])\n render :edit_temp\n return\n end\n end",
"def update\n @group = StudentGroup.find(params[:id])\n users= []\n respond_to do |format|\n if @group.update_attributes(params[:student_group])\n if params[\"users\"].present?\n users = users+params[\"users\"]\n end\n if params[\"students\"].present?\n users = users+params[\"students\"]\n end\n if params[\"teachers\"].present?\n users = users+params[\"teachers\"]\n end\n unless users.empty?\n UserGroup.where(:group_id=>@group.id).destroy_all\n users.uniq.each do |i|\n UserGroup.create(:group_id=>@group.id,:user_id=>i.to_i)\n end\n end\n # @group.profile.update_attributes(params[:user][:profile_attributes]) if params[:user][:profile_attributes]\n #@group.user_group.update_attributes(params[:user][:user_group_attributes]) if params[:user][:user_group_attributes]\n format.html { redirect_to group_path(@group), notice: 'Group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n group_ids = params[:group_id]\n org_id = params[:organization_id]\n @user = User.find_by_id(params[:user_id])\n current_group_ids = @user.user_group_ids\n\n respond_to do |format|\n if @user.update_attributes(full_name: params[:full_name], abbreviation: params[:abbreviation], email: params[:email], status: params[:status], staff_number: params[:employee_id], career_path: params[:career_path])\n\n is_logged = !@user.previous_changes.blank?\n if current_group_ids != group_ids\n @user.user_group_ids = group_ids\n format.json { render json: @user }\n end\n else\n format.json { render json: @user.errors.messages, status: :unprocessable_entity }\n end\n end\n end",
"def update_group(id, params = {})\n put(\"/groups/#{id}\", params)\n end",
"def update\n if @group.update(group_params)\n group_user = @current_user.user_groups.find_by_group_id(@group.id)\n @user_type = group_user ? group_user.user_type : nil\n @group.save\n render :show\n\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def test_should_update_group_user_via_API_JSON\r\n # lookup user's membership\r\n get \"memberships/find.json?api_key=testapikey&user_id=4&group_id=1\"\r\n membership = JSON.parse(response.body)\r\n membership_id = membership['id']\r\n assert membership_id == 3, 'Incorrect membership id'\r\n assert membership['role_id'] == Role.find_by_rolename('user').id, 'Incorrect role id'\r\n \r\n # promote user to group admin\r\n put \"/memberships/#{membership_id}.xml\", :api_key => 'testapikey',\r\n :membership => {:user_id => 4,\r\n :group_id => 1,\r\n :role_id => Role.find_by_rolename('group_admin') }\r\n assert_response :success\r\n end",
"def update\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to((current_user and current_user.is_site_admin? and current_user != @group.users.owners.first) ? by_user_groups_path(:user_id => @group.users.owners.first.id) : groups_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n #確定編輯後的id一定是編輯者本人\n @group.user = @user\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_group_update.update(api_v1_group_update_params)\n format.html { redirect_to @api_v1_group_update, notice: 'Group update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_group_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_group_update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, :notice => 'Group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n if @group.update(group_params)\n head :no_content\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n invite_members\n format.html { redirect_to @group, notice: t('flash.notice.groups.successfully_updated') }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(current_user.id)\n @group = @user.groups.find(params[:id])\n @group.title = params[:title]\n @group.description = params[:description]\n @group.groupProfile = params[:groupProfile]\n @group.groupCover = params[:groupCover]\n\n @groupcategory = GroupCategory.where(:group_id => params[:id])\n @groupcategory.update(group_id: @group.id , category_id: params[:category])\n\n respond_to do |format|\n if @group.update(title: params[:title], description: params[:description])\n format.html { redirect_to user_group_path(current_user.id, @group.id) }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @group\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to group_path(@group), notice: \"Group was successfully updated.\" }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group.name = params['name']\n @group.save\n respond_to do |format|\n format.json { render :show, status: :ok, location: @group }\n end\n end",
"def update_a_user_group_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: IamUserGroupsApi.update_a_user_group ...'\n end\n # unbox the parameters from the hash\n user_group_id = opts[:'user_group_id']\n # verify the required parameter 'user_group_id' is set\n if @api_client.config.client_side_validation && user_group_id.nil?\n fail ArgumentError, \"Missing the required parameter 'user_group_id' when calling IamUserGroupsApi.update_a_user_group\"\n end\n # resource path\n local_var_path = '/user-groups/{user_group_id}'.sub('{' + 'user_group_id' + '}', CGI.escape(user_group_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'request_body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Object'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"IamUserGroupsApi.update_a_user_group\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IamUserGroupsApi#update_a_user_group\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_group_with_http_info(group, group_oid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserApi.update_group ...'\n end\n # verify the required parameter 'group' is set\n if @api_client.config.client_side_validation && group.nil?\n fail ArgumentError, \"Missing the required parameter 'group' when calling UserApi.update_group\"\n end\n # verify the required parameter 'group_oid' is set\n if @api_client.config.client_side_validation && group_oid.nil?\n fail ArgumentError, \"Missing the required parameter 'group_oid' when calling UserApi.update_group\"\n end\n # resource path\n local_var_path = '/user/groups/{group_oid}'.sub('{' + 'group_oid' + '}', group_oid.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\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; charset=UTF-8'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(group)\n auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']\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 => 'GroupResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#update_group\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, :notice => 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @group.update(group_params)\n render_json_message({success: t('.success')}, 200)\n else\n render_json_message({errors: @group.errors.messages}, 422)\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n @group.name = params[:group][:name]\n @group.set_members(params[:member])\n\n if @group.save\n redirect_to root_path\n else\n render 'edit'\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Le groupe a été modifié.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_group(id, params)\n put(\"groups/#{id}\", group: params)\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Course.groups.new(group_params)\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group.update(group_params)\n respond_with(@group)\n end",
"def update\n redirect_to :action => :index and return unless is_owner?\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_group\n @group = current_user.groups.find(params[:group_id])\n end",
"def update\n respond_to do |format|\n if @user_accounts_group.update(user_accounts_group_params)\n format.html { redirect_to @user_accounts_group, notice: 'User accounts group was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_accounts_group }\n else\n format.html { render :edit }\n format.json { render json: @user_accounts_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n token = params[:token]\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to group_path(:id => @group.id), notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@group = Group.find(params[:id])\n\t\t@group.update_accessor(current_user)\n\t\trespond_to do |format|\n\t\t\tif @group.update_attributes(params[:group])\n\t\t\t\tflash[:notice] = t(:ctrl_object_updated, :typeobj => t(:ctrl_group), :ident => @group.name)\n\t\t\t\tformat.html { redirect_to(@group) }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tflash[:error] = t(:ctrl_object_not_updated, :typeobj => t(:ctrl_group), :ident => @group.name)\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @cta = Cta.find(params[:id])\n params[:users].each do |p|\n @cta.cta_relations.first.users << UserGroup.find(p)\n end\n @user.user_groups.uniq!\n\n respond_to do |format|\n if @cta.update_attributes(params[:cta])\n format.html { redirect_to @cta, notice: 'Cta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_group(group_name, options = {})\n request({\n 'Action' => 'UpdateGroup',\n 'GroupName' => group_name,\n :parser => Fog::Parsers::AWS::IAM::UpdateGroup.new\n }.merge!(options))\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.json { head :no_content }\n else\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_group(group_id, attributes)\n put(\"/v1/groups/#{group_id}\", attributes)\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if !current_user || (!current_user.is_admin && !@group.owners.include?(current_user))\n format.html { redirect_to(@group, :notice => 'No permissions to edit group.')}\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n\n elsif @group.update_attributes(params[:group])\n format.html { redirect_to(@group, :notice => 'Group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n begin\n UserGroup.transaction do\n # Process input from the various edit modals.\n build_ad_groups\n build_users\n build_hosts\n build_departments\n build_email_patterns\n @user_group.update!(user_group_params)\n end\n rescue => e\n render partial: \"shared/validation_messages\",\n locals: { object: @user_group.errors.any? ? @user_group : e },\n status: :bad_request\n else\n toast!(title: \"User group updated\",\n message: \"The user group \\\"#{@user_group.name}\\\" has been updated.\")\n render \"shared/reload\"\n end\n end",
"def update\r\n respond_to do |format|\r\n if @agroup.update(agroup_params)\r\n format.html { redirect_to @agroup, notice: 'Agroup 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: @agroup.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @group = Group.find(params[:id])\n \n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(admin_groups_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to params[:back_to], notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_group_user\n @group_user = group_user.find(params[:id])\n end",
"def set_groups(user, grouplist)\n\t\t\tend",
"def update\n return unless force_group(\"root\")\n @user = User.find(params[:id])\n\n # init always, so non-checked checkboxes will be updated\n params[:user][:fachschaft_ids] ||= []\n params[:user][:referat_ids] ||= []\n # normalize groups field\n params[:user][:groups] = params[:user][:groups].downcase.split(/[^a-z]+/).uniq.sort.join(\" \") if params[:user][:groups]\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to edit_user_path(@user), notice: 'Nutzer erfolgreich aktualisiert.' }\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 create\n @groups_user = GroupsUser.find(params[:id])\n @groups_user = GroupsUser.new(groups_user_params)\n # @groups_user.user_id=1\n # @groups_user.group_id=3\n # respond_to do |format|\n if @groups_user.save\n redirect_to groups_url\n # format.html { redirect_to groups_url, notice: 'Groups user was successfully created.' }\n # format.json { render :show, status: :created, location: @groups_user }\n else\n format.html { render :new }\n format.json { render json: @groups_user.errors, status: :unprocessable_entity }\n end\n # end\n end",
"def update\n group = Group.find(params[:group_id])\n unless @current_user.id == group.user_id\n return render json: { message: \"You are not permitted to perform this operation.\" }, status: :forbidden\n end\n if @space.update(space_params)\n render json: @space, status: :created\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end",
"def update\n @group = Group.find_by_guid(params[:id])\n respond_to do |format|\n if @group.update_attributes(update_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render json: @group }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to(@group, :notice => 'Group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_group(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'UpdateGroup'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :group_name\n\t\t\targs[:query]['GroupName'] = optional[:group_name]\n\t\tend\n\t\tif optional.key? :new_comments\n\t\t\targs[:query]['NewComments'] = optional[:new_comments]\n\t\tend\n\t\tif optional.key? :new_group_name\n\t\t\targs[:query]['NewGroupName'] = optional[:new_group_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def create\n @group = Group.new(params[:group])\n @group.users << current_user\n \n respond_to do |format|\n if @group.save\n @group.groups_users.first.update_attribute :level, 2\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n if @group.update_attributes(params[:group])\n flash[:notice] = \"Grupo actualizado.\"\n redirect_to groups_path\n else\n render :action => 'edit'\n end\n end",
"def update\n respond_to do |format|\n if @group.update(params[:group])\n format.html { redirect_to [@hub, @group], :notice => 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @student.groups = []\n if params[:student][:group_ids]\n params[:student][:group_ids].each { |group_id| \n @student.groups << Group.find(group_id)\n }\n end\n\n respond_to do |format|\n if @student.update(student_params)\n @students = Student.all\n format.html { render action: \"index\", notice: \"Student was successfully updated.\" }\n format.json { render action: \"index\", status: :ok }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n if @student.isAdmin\n @student.groups = []\n @student.save\n end\n end",
"def update\n\t\t@group = Group.find(params[:id])\n\t\t@group.update_accessor(current_user)\n\t\trespond_to do |format|\n\t\t\tif @group.update_attributes(params[:group])\n\t\t\t\tflash[:notice] = t(:ctrl_object_updated, :typeobj => t(:ctrl_group), :ident => @group.name)\n\t\t\t\tshow_\n\t\t\t\tformat.html { render :action => \"show\" }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tflash[:error] = t(:ctrl_object_not_updated, :typeobj => t(:ctrl_group), :ident => @group.name, :error => @group.errors.full_messages)\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend"
] |
[
"0.72298145",
"0.71930164",
"0.702065",
"0.7013743",
"0.70038235",
"0.6998484",
"0.69377214",
"0.6921055",
"0.69135416",
"0.6888388",
"0.6864287",
"0.6783159",
"0.6760395",
"0.67462766",
"0.67376494",
"0.6737197",
"0.6737197",
"0.6723572",
"0.6694551",
"0.6662927",
"0.6653735",
"0.6653735",
"0.6653735",
"0.6629124",
"0.6628998",
"0.6628998",
"0.66250026",
"0.6569638",
"0.656311",
"0.6560735",
"0.65452343",
"0.65428394",
"0.65428394",
"0.6530626",
"0.65244615",
"0.6523569",
"0.65131193",
"0.651044",
"0.6491766",
"0.6488529",
"0.6482069",
"0.64697534",
"0.6468994",
"0.64684385",
"0.64547986",
"0.64472145",
"0.6445367",
"0.64365077",
"0.6427555",
"0.642744",
"0.6415157",
"0.64096534",
"0.64096534",
"0.6402841",
"0.6401562",
"0.639447",
"0.63755333",
"0.63755333",
"0.63755333",
"0.63723683",
"0.6371668",
"0.6350809",
"0.6334556",
"0.6331954",
"0.6328476",
"0.6321604",
"0.6317979",
"0.6315814",
"0.630867",
"0.6305055",
"0.630476",
"0.6301394",
"0.6296044",
"0.62953496",
"0.6293699",
"0.6289912",
"0.62895566",
"0.62859166",
"0.6277575",
"0.6275494",
"0.6272532",
"0.6265584",
"0.6255925",
"0.6255925",
"0.6255925",
"0.6255925",
"0.6255925",
"0.6255925",
"0.6255925",
"0.6255925",
"0.6255925",
"0.6255925",
"0.6255925",
"0.6255925",
"0.62477547",
"0.62440866",
"0.6241573",
"0.6233748",
"0.62316304",
"0.6230833"
] |
0.7262623
|
0
|
DELETE /user_groups/1 DELETE /user_groups/1.json
|
def destroy
@user_group = UserGroup.find(params[:id])
@user_group.destroy
respond_to do |format|
format.html { redirect_to user_groups_url }
format.json { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @user_group = UserGroup.find_by_id(params[:id])\n @user_group.destroy\n render :json=>{:status =>t('users.destroy.success')}\n end",
"def destroy\n @user_group = UserGroup.find(params[:id])\n @user_group.destroy\n\n respond_to do |format|\n format.html { redirect_to user_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @groups = Group.find(params[:id])\n @groups.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @usergroup.destroy\n respond_to do |format|\n format.html { redirect_to usergroups_url, notice: 'User group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_group = UserGroup.find(params[:id])\n @user_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_groups_url) }\n format.xml { head :ok }\n end\n end",
"def deleteGroup( group_id)\n params = Hash.new\n params['group_id'] = group_id\n return doCurl(\"delete\",\"/group\",params)\n end",
"def destroy\n @group = Group.find(params[:id])\n u1 = User.where(:login=>@group.name).select(:id)\n @u2 = User.find(u1)\n @u2.destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @usergroup.destroy\n respond_to do |format|\n format.html { redirect_to usergroups_url, notice: 'Usergroup was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @add_group_to_user = AddGroupToUser.find(params[:id])\n @add_group_to_user.destroy\n\n respond_to do |format|\n format.html { redirect_to add_group_to_users_url }\n format.json { head :no_content }\n end\n end",
"def DeleteGroup id\n \n APICall(path: \"groups/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n @group = Group.find(params[:id])\n @user_id = @group.user_id\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url(:user_id=>@user_id) }\n # format.html { redirect_to groups_sidebartab_url(:user_id=>@user_id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @current_user.quit_group(@group)\n respond_to do |format|\n format.html { redirect_to groups_path }\n format.json { head :no_content }\n end\n end",
"def remove_user_from_group(user_id, group_id)\n @url = \"http://#{$canvas_host}/api/v1/groups/#{group_id}/users/#{user_id}\"\n puts \"@url is #{@url}\"\n\n @deleteResponse = HTTParty.delete(@url, :headers => $header)\n puts(\" DELETE to remove user from group has Response.code #{@deleteResponse.code} and getResponse is #{@deleteResponse}\")\nend",
"def destroy\n group = Group.find(params[:id])\n group.destroy\n render json: {}\n end",
"def destroy\n @group_user.destroy\n respond_to do |format|\n format.html { redirect_to group_users_url, notice: 'group_user was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_group(client, options)\n if options[:directory].nil? or options[:group].nil?\n puts \"Missing arguments\"\n return\n end\n\n groups = client.groups\n group = groups.get options[:group]\n group.delete\n puts \"Group deleted.\"\n return\nend",
"def delete(group_id)\n if expired?(@begin_time)\n @auth = get_auth(@api_key)\n end\n Log.debug(\"#{@base_url}#{@get_post_delete_url}#{group_id}\")\n user_group = RestClient.delete \"#{@base_url}#{@get_post_delete_url}#{group_id}\", header\n end",
"def destroy\n @current_user_group = UserGroup.find_by(id: current_user.id)\n @user_group = UserGroup.find_by(id: params[:id])\n if @user_group.user_id == current_user || (current_user.admin == true && @current_user_group.group_id == @user_group.group_id)\n @user_group.destroy\n render json: {message: \"this user group has been successfully deleted\"}\n else\n render json: {:errors => @user_group.errors.full_messages}, Status: :Unauthorized\n end\n end",
"def destroy\n # @group = @hub.groups.get(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to hub_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end",
"def destroy\n\n @user_group = UserGroup.find(params[:id])\n @user_group.destroy\n\n respond_to do |format|\n format.html do\n if request.env['HTTP_REFERER']\n redirect_to :back\n else\n redirect_to :controller => :user_groups, :action => :index\n end\n end\n format.xml do\n head :ok\n end\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find_by_guid(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :destroy, @group\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @groupc_user = GroupcUser.find(params[:id])\n @groupc_user.destroy\n\n respond_to do |format|\n format.html { redirect_to groupc_users_url }\n format.json { head :ok }\n end\n end",
"def delete_from_group\n @user = User.find(params[:user_id], :select => \"id\")\n @group.delete_from_group(@user)\n\n respond_to do |format|\n format.js\n end\n end",
"def destroy\r\n @agroup.destroy\r\n respond_to do |format|\r\n format.html { redirect_to agroups_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n UserGroup.find_by(user_id: @user.id).destroy if UserGroup.find_by(user_id: @user.id).present?\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: t('flash.notice.users.successfully_destroyed') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_group_update.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_group_updates_url, notice: 'Group update was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n begin\n group = Group.find(params[:id])\n group.destroy\n render json: { \"notice\"=>\"group deleted successfully\" }\n rescue ActiveRecord::RecordNotFound\n render json: { \"alert\"=>\"did not specify a valid id. no record deleted.\" }\n end\n end",
"def destroy\n @request_group.destroy\n respond_to do |format|\n format.html { redirect_to request_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_accounts_group.destroy\n respond_to do |format|\n format.html { redirect_to user_accounts_groups_url, notice: 'User accounts group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group_user_request.destroy\n respond_to do |format|\n format.html { redirect_to group_user_requests_url, notice: 'Group user request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end",
"def destroy\n @group = @authorized_group\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to group_users_path(@group) }\n format.xml { head :ok }\n end\n end",
"def postUserGroup_admin_remove( user_id)\n params = Hash.new\n params['user_id'] = user_id\n return doCurl(\"post\",\"/user/group_admin_remove\",params)\n end",
"def remove_user\n group_id_param = params[:group_id]\n user_id_param = params[:user_id]\n\n if group_id_param.nil? || group_id_param.blank?\n render json: { error: 'group_id not specified.' }, status: :bad_request\n return\n end\n\n if user_id_param.nil? || user_id_param.blank?\n render json: { error: 'user_id not specified.' }, status: :bad_request\n return\n end\n\n user = User.find_by_id(user_id_param)\n if user.nil?\n render json: { error: \"Remove failed. Can't find user #{user_param}.\" }, status: :bad_request\n return\n end\n\n group = CanvasSpaces.GroupCategory.groups.find_by_id(group_id_param)\n if group.nil?\n render json: { error: 'No such group found.' }, status: :bad_request\n else\n if @current_user.account.site_admin? || group.leader_id == @current_user.id || @current_user.id == user.id\n if group.leader_id == user.id\n render json: { error: \"Can't remove user that is the leader of the group.\" }, status: :bad_request\n return\n end\n\n membership = group.group_memberships.where(user_id: user).first\n membership.workflow_state = 'deleted'\n membership.save\n render json: { message: 'Successfully removed user.' }, status: :ok\n else\n # doesn't have access to the group\n render json: { error: \"Can't remove user. Not owner or not adding self.\" }, status: :forbidden\n end\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n users = @group.users \n users.each do |user|\n if user.groups.length == 1\n events = Event.where(:organizer => user.id)\n events.each do |event|\n event.destroy\n end\n user.destroy\n end\n end \n \n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully deleted' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find_by_slug_or_id(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.json { head :ok }\n end\n end",
"def destroy\n @access_group = AccessGroup.find(params[:id])\n @access_group.destroy\n\n respond_to do |format|\n format.html { redirect_to access_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return access_denied unless is_admin?(current_user)\n\n @group = Group.find(params[:id])\n @group.destroy\n redirect_to(groups_url)\n end",
"def destroy\n @group_key.destroy\n respond_to do |format|\n format.html { redirect_to group_keys_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @usernetworkgroup.destroy\n respond_to do |format|\n format.html { redirect_to usernetworkgroups_url, notice: 'Usernetworkgroup was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n\n mbs = Membership.where \"group_id = ?\", @group.id\n\n mbs.each do |m|\n m.destroy\n end\n\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end",
"def destroy\n \t# we can destroy group only if current user is owner or current user is admin\n \tif @group.owner_id = current_user.id || is_admin?(current_user)\n\t @group.destroy\n\t respond_to do |format|\n\t format.html { redirect_back_or mygroups_path }\n\t format.json { head :no_content }\n\t end\n\t end\n end",
"def destroy\n @group_request.destroy\n respond_to do |format|\n format.html { redirect_to group_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_group = ItemGroup.find(params[:id])\n redirect_to root_path unless @item_group.user == request.user\n @item_group.destroy\n\n respond_to do |format|\n format.html { redirect_to item_groups_path }\n format.json { head :ok }\n end\n end",
"def delete_group \n Group.destroy(params[:id])\n\n respond_to do |format|\n format.html {redirect_to dashboard_path}\n end\n end",
"def destroy\n @member_group.destroy\n respond_to do |format|\n format.html { redirect_to member_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group_user_rel = GroupUserRel.find(params[:id])\n @user = @group_user_rel.user\n @group_user_rel.destroy\n\n respond_to do |format|\n format.html { redirect_to edit_user_path(@user) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Le groupe a été supprimé.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_path, notice: 'group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n redirect_to :action => :index and return unless is_owner?\n for member in @group.members\n member.destroy\n end\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @yeargroup = Yeargroup.find(params[:id])\n @yeargroup.destroy\n\n respond_to do |format|\n format.html { redirect_to yeargroups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n head :no_content\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Группа удалена!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: t('flash.notice.groups.successfully_destroyed') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n flash[:success] = \"Group successfully deleted\"\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Group.destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(data)\n result = @client.api_request(:method => \"usergroup.delete\", :params => data)\n result ? result['usrgrpids'][0].to_i : nil\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n flash[:success] = \"Группа успешно удалена.\"\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to admin_groups_url, notice: t('activerecord.models.group') +'删除成功!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reagent_group = ReagentGroup.find(params[:id])\n @reagent_group.destroy\n\n respond_to do |format|\n format.html { redirect_to reagent_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = GROUP.first_or_get(params[:id])\n @group.current_user = current_user\n @group.destroy if @group\n\n respond_to do |format|\n flash[:notice] = 'Group was successfully deleted.'\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n # format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n audit(@group, \"destroy\", @group.name )\n respond_to do |format|\n format.html { redirect_to groups_path, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = @course.groups.find(params[:id])\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @group\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: \"Group was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n if @group.users.length>0\n # format.html { redirect_to @group, notice: 'Group can not be deleted.' }\n render json: \"Group already contains users\", status: 412 \n else\n if @group.destroy\n # format.html { redirect_to groups_url }\n render 'show'\n else\n render json: \"Error\", status: 422 \n end\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n authorize @group, :destroy?\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(browse_groups_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.7891348",
"0.78831",
"0.7809744",
"0.75663036",
"0.75447077",
"0.7542565",
"0.75411755",
"0.75356305",
"0.75271446",
"0.752069",
"0.75115293",
"0.75049376",
"0.7468739",
"0.74383307",
"0.73791003",
"0.7348354",
"0.7343422",
"0.73423296",
"0.7331332",
"0.7329655",
"0.7329655",
"0.7304349",
"0.7304349",
"0.7304349",
"0.7304349",
"0.7304349",
"0.7279976",
"0.7279976",
"0.7277862",
"0.7261941",
"0.7261941",
"0.7261941",
"0.7261941",
"0.7261941",
"0.7261941",
"0.7253646",
"0.72486997",
"0.7221966",
"0.72219294",
"0.7218517",
"0.72003657",
"0.7199132",
"0.7194881",
"0.7190332",
"0.7176461",
"0.7174734",
"0.71725065",
"0.7165833",
"0.7160778",
"0.7159343",
"0.71533155",
"0.7121651",
"0.71004695",
"0.7097413",
"0.70916235",
"0.7086606",
"0.70807856",
"0.707262",
"0.7069005",
"0.7053047",
"0.7050713",
"0.70459783",
"0.7038816",
"0.70349294",
"0.7034521",
"0.7028828",
"0.7021278",
"0.7019145",
"0.7016261",
"0.7012686",
"0.7004908",
"0.6999237",
"0.699793",
"0.6991275",
"0.6990228",
"0.6990228",
"0.6990228",
"0.6990228",
"0.6990228",
"0.6990228",
"0.6990228",
"0.6990228",
"0.6990228",
"0.6990228",
"0.6990228",
"0.6990228",
"0.6990228",
"0.6990228",
"0.6990228",
"0.69898844",
"0.69852823",
"0.6972557",
"0.6959711",
"0.6955889",
"0.6953347",
"0.6952726",
"0.6947747",
"0.69451165",
"0.6943725",
"0.6943068"
] |
0.7893964
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.