text stringlengths 10 2.61M |
|---|
#
# Authors: Jeff Watts(jwatts@redhat.com) and Lucy Kerner(lkerner@redhat.com)
#
#
# Method Code Goes here
#
$evm.log("info", "SCAP Schedule Start")
require 'rubygems'
require 'net/ssh'
require 'rest_client'
require "xmlrpc/client"
require 'time'
def log(level, msg, update_message = false)
$evm.log(level... |
module TalksHelper
def youtube_link?(url)
url.include?("youtube.com") || url.include?("youtu.be")
end
def parse_url_for_embed(url)
if url.include?("watch?v=")
url["watch?v="] = "embed/"
elsif url.include?("youtu.be/")
url["youtu.be/"] = "youtube.com/embed... |
# typed: true
# frozen_string_literal: true
require "ast/node"
module Packwerk
class ParsedConstantDefinitions
def initialize(root_node:)
@local_definitions = {}
collect_local_definitions_from_root(root_node) if root_node
end
def local_reference?(constant_name, location: nil, namespace_pat... |
class AddClinicIdToTeamMembers < ActiveRecord::Migration[6.1]
def change
add_column :team_members, :clinic_id, :integer
end
end
|
require 'open-uri'
require 'json'
class Twitter
def initialize
base_url= "https://api.twitter.com/1/users/lookup.json?"
end
def getUser(username)
query_url = base_url + "screen_name" + username
result_json = open(query_url).read
result = JSON.parse(result_json)
return result
end
end |
require 'spec_helper'
describe "Clients" do
before(:each) do
@employee = Factory(:employee)
visit signin_path
fill_in :email, :with => @employee.email
fill_in :password, :with => @employee.password
click_button
end
describe "add client" do
describe "failure" do
... |
Smartwaiter::Application.routes.draw do
devise_for :users
root 'welcome#index'
get "waiter/index"
get "/waiters/index"
get '/bartenders/index'
get '/homes/index'
get '/chefs/index'
get "/helper/index"
get '/managers/index'
get '/users/sign_up' => 'devise/sessions#new'
get "helper/index"
... |
require 'google_maps_service'
class Trip < ApplicationRecord
validates_presence_of :name
has_many :routes, -> {order "routes.created_at"}, dependent: :destroy
has_many :destinations, through: :routes
belongs_to :user
def directions(origin, destination)
GoogleMapsService::Client.new(key: ENV["gmaps_key"... |
class RemoveIndexFromArticles < ActiveRecord::Migration
def change
remove_column :articles, :category_id, :integer
remove_column :articles, :sub_category_id, :integer
remove_column :articles, :bearing_id, :integer
end
end
|
module Idcbatch
module Ad
class Connection
ATTRS = %w{ company employeeNumber sAMAccountName proxyAddresses givenName sn employeeType extensionAttribute9 }
attr_accessor :person
def initialize args
@persons = {}
@args = self.to_ldap_args(a... |
class Time
def remaining toDate
return 'n/d' if toDate.blank?
intervals = [["d", 1], ["h", 24], ["m", 60]]
elapsed = toDate.to_datetime - self.to_datetime
interval = 1.0
parts = intervals.collect do |name, new_interval|
interval /= new_interval
number, elapsed = elapsed.abs.divmod(inte... |
class Api::V1::FamiliesController < ApplicationController
protect_from_forgery unless: -> { request.format.json? }
before_action :authenticate_user!
def index
render json: User.find(current_user.id).families
end
def show
family = Family.find(params[:id])
if family && Family.find(params[:id]).user... |
require "rails_helper"
RSpec.describe Reports::RegionsController, type: :controller do
let(:jan_2020) { Time.parse("January 1 2020") }
let(:dec_2019_period) { Period.month(Date.parse("December 2019")) }
let(:organization) { FactoryBot.create(:organization) }
let(:cvho) { create(:admin, :manager, :with_access, ... |
require 'ostruct'
# ModifiableStruct is a variation on OpenStruct where and variable get for an
# unset variable will result in a NoMethodError. This allows you to safely add
# and get variables without having to track down nils introduced by bad method
# calls.
class ModifiableStruct < OpenStruct
def method_missin... |
# O módulo LogsController cuida do histírico das movimentações de valores
class LogsController < ApplicationController
before_action :set_log, only: [:show, :edit, :update, :destroy]
before_action {not_admin(root_path)}
before_action only: [:index] do
redirect_to(budgets_path)
end
def initialize
supe... |
# == Schema Information
#
# Table name: notes
#
# id :integer not null, primary key
# title :string(255)
# content :text
# user_id :integer
# category_id :integer
# created_at :datetime
# updated_at :datetime
#
class Note < ActiveRecord::Base
belongs_to :user
belongs_to :cate... |
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'snapshotar/version'
Gem::Specification.new do |spec|
spec.name = "snapshotar"
spec.version = Snapshotar::VERSION
spec.authors = ["Benjamin Müller"]
spec.email ... |
class EmailList
# this version works with Brian Getting's Hominid gem:
# script/plugin install git://github.com/bgetting/hominid.git
cattr_accessor :errors
private
@@hominid = nil
@@list = nil
@@listid = nil
def self.hominid ; @@hominid ; end
def self.segment_id_from_name(name)
self.init_... |
module SitescanCommon
# Product page scanning errors.
#
# type_id: 1 - page error, 2 - name error, 3 - price error, 4 - arhived.
class SearchProductError < ActiveRecord::Base
self.table_name = :search_product_errors
belongs_to :search_result
validates :type_id, uniqueness: { scope: :search_result_... |
class ForumsController < ApplicationController
controls_access_with do
ForumSentinel.new :current_user => current_user, :forum => @forum
end
grants_access_to lambda { stubbed_method }, :denies_with => :redirect_to_index
grants_access_to :denies_with => :sentinel_unauthorized do
stubbed_method_two
en... |
class UsersController < ApplicationController
def index
@user = current_user
end
def show
@user = User.find_by_username(params[:id])
end
def follow
@user = User.find(params[:id])
if current_user
if current_user == @user
flash[:notice] = "You cannot follow yourself."
redirect_back(fa... |
# frozen_string_literal: true
# rubocop:todo all
# Copyright (C) 2014-2020 MongoDB Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... |
class CreateMemberships < ActiveRecord::Migration
def change
create_table :memberships do |t|
t.string :category, null: false
t.integer :year, null: false
t.decimal :price_paid, null: false
t.date :date_paid, null: false
t.boolean :active, default: true, null: false
t.text :not... |
require 'rails_helper'
RSpec.describe User, type: :model do
describe 'Validations' do
it 'should have first_name, last_name, email, password, password_confirmation to be valid' do
user = User.create! first_name: 'yves', last_name: 'lastname', email: 'example@email.com', password: 'password', password_conf... |
module DataMapper::Mongo::Spec
module ResetHelper
def reset_db
DataMapper.repository.adapter.send(:database).collections.each do |collection|
next if collection.name =~ /^system/
collection.drop
end
end
end
end
|
require File.dirname(__FILE__) + '/../spec_helper'
require 'string_utils'
include ApplicationHelper
describe UserHelper do
it 'should create opml item' do
title = 'feed title'
link = 'http://blog.fastladder.com/'
feedlink = 'http://blog.fastladder.com/blog/rss.xml'
feed = mock('feed')
feed.should... |
require_relative 'acceptance_helper'
feature 'User can add list', %q{
In order to place your code,
the Registered User may post it,
Unregistered can only view
}do
given(:user) { create(:user) }
# TODO need to find a solution for testing forms with CodeMirror, fill_in not working
# scenario 'Authenticated u... |
require 'spec_helper'
describe Game do
let (:game) {Game.new(date_played: '5-19-1983', event:'dbc floor tournament', site:'dbc floor', eco_code: 'C07')}
context "#initialize" do
it "creates a Game Object" do
expect(game).to be_an_instance_of Game
end
it "should have a date" do
expect(game... |
class AddGroupRefToMembers < ActiveRecord::Migration[5.1]
def change
add_reference :members, :group, foreign_key: true
end
end
|
Write a method that takes a single String argument and returns a new string that contains the original value of the argument with the first character of every word capitalized and all other letters lowercase.
You may assume that words are any sequence of non-blank characters.
Examples
word_cap('four score and seven'... |
require 'test_helper'
class CommmentsControllerTest < ActionDispatch::IntegrationTest
setup do
@commment = commments(:one)
end
test "should get index" do
get commments_url, as: :json
assert_response :success
end
test "should create commment" do
assert_difference('Commment.count') do
p... |
class UserPresenter < BasePresenter
def first_name
handle_none(user.first_name, '') do
user.first_name
end
end
def last_name
handle_none(user.last_name, '') do
user.last_name
end
end
def full_name
"#{first_name} #{last_name}"
end
def email
handle_none user.e... |
require File.join File.dirname(__FILE__), '../test_common.rb'
class ZabbixPostTest < Test::Unit::TestCase
def test_zabbix_is_running
assert TestCommon::Process.running?('zabbix_server'), 'Zabbix server is not running!'
end
end
|
class CreateLeadershipRoles < ActiveRecord::Migration
def change
create_lookup_table :leadership_roles
end
end
|
require 'rails_helper'
RSpec.describe LikesController, type: :controller do
context 'guest user' do
before do
@user = FactoryGirl.create(:user)
@topic = FactoryGirl.create(:topic)
@bookmark = FactoryGirl.create(:bookmark)
end
describe 'POST create' do
it 'redirects the user to t... |
require 'rails_helper'
RSpec.describe "investigations/new", type: :view do
before(:each) do
assign(:investigation, Investigation.new(
incident: nil,
user: nil,
report_number: "MyString",
department: nil,
status: "MyString",
reportable_to_legal: false
))
end
it "render... |
class SessionsController < ApplicationController
def create
auth =
Authorization.find_from_auth_hash(auth_hash) ||
Authorization.create_from_auth_hash(auth_hash)
authenticate auth.user
redirect_to dashboard_path
end
def auth_hash
request.env['omniauth.auth']
end
private
def a... |
class SearchController < ApplicationController
before_action :authenticate_user!
protect_from_forgery prepend: true
def mk
@base_url = "/search/mk"
render :index
end
def index
if params[:keywords].present?
@keywords = params[:keywords]
@user_id = current_user.id
tool_search_te... |
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
# Add Yarn node_modules ... |
# == Schema Information
#
# Table name: balances
#
# id :integer not null, primary key
# total :integer default(0)
# created_at :datetime not null
# updated_at :datetime not null
# user_id :integer
#
# Indexes
#
# index_balances_on_user_id (user_id)
#
# Read abo... |
class ArtsController < ApplicationController
before_action :authorize, only: [:new]
def index
@arts = Art.all
@art = Art.where("title like ?", "Neueve")
end
def show
@art = Art.find(params[:id])
end
def edit
@art = Art.find(params[:id])
end
def update
@art = Art.find(params[:id])... |
# frozen_string_literal: true
module Ratings
class Create < ActiveInteraction::Base
integer :user_id
integer :photopost_id
def execute
Rating.create!(user_id: user_id, photopost_id: photopost_id)
end
end
end
|
require 'octokit'
class UserFinder
def initialize(opts = {})
@client = opts[:client] || Octokit::Client.new
end
def get_locations_for_usernames(usernames)
usernames.map{ |username| @client.user(username) }.map{ |user| user[:location] }
end
end
|
module WastebitsClient
class User < Base
attr_accessor :id,
:first_name,
:last_name,
:full_name,
:email,
:reset_password_sent_at,
:reset_password_expires_at,
:created_at,
... |
class Category < ApplicationRecord
has_many :categorizes
has_many :ideas, through: :categorizes
end
|
#
# = operators.rb - Operators for the BitString class
#
# Author:: Ken Coar
# Copyright:: Copyright © 2010 Ken Coar
# License:: Apache Licence 2.0
#
# == Description
#
# Operator methods for <i>BitString</i> class (<i>e.g.</i>, those consisting
# of special characters).
#
#--
# Copyright © 2010 Ken Coar
#
# Licen... |
class PeopleController < ApplicationController
def index
@people = Person.all
end
def new
@person = Person.new
end
def show
@person = Person.find(params[:id])
@projects = @person.projects
@no_associated_projects = @person.select_no_associated_projects
end
def create
@person = Pe... |
class MockApp
def initialize
@will_blocks = []
end
def will(&block)
@will_blocks << block
end
attr_accessor :results
def run
@results = []
begin
self.start
@will_blocks.each do |block|
@results << block.call
end
rescue => e
puts e.inspect
... |
Rails.application.routes.draw do
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
devise_for :users,
:path_names => {
:sign_up => 'sign_up',
:sign_in => 'sign_in',
:sign_out => 'sign_out',
:password => 'password',
}, controllers: { sessions: 'user/sessions', :registrations => 'us... |
require 'open-uri'
require 'hpricot'
class CrawlersController < ApplicationController
layout 'index'
# GET /crawlers
def index
@crawlers = Crawler.all
render :layout => !request.xhr?
end
# GET /crawlers/1
def show
@crawler = Crawler.find(params[:id])
@log_entries = @crawler.log_entries.pa... |
require 'rails_helper'
RSpec.describe Proposal, :type => :model do
describe "Create valid review" do
it "should be permitted" do
u = User.create(:email => 'prova1@example.it', :username => 'user1', :password => 'useruser')
r = UserReview.create(:rating => 5, :comment => 'Ciao', :user => u)
expect(r... |
class TechnikGrid < MyGrid
def configure(c)
super
c.model = "Technik"
c.columns= [:name]
end
end
|
ActiveAdmin.register Experience do
permit_params :id, :name, :logo, :photo, :hours, :phone, :address, :body, :caption,
events_attributes: [:id, :name, :date, :time, :location, :body, :_destroy]
config.filters = false
controller do
def find_resource
scoped_collection.friendly.find(params[:id])
... |
# frozen_string_literal: true
module SC::Billing::Subscriptions
class UpdateOperation < ::SC::Billing::Subscriptions::CreateOperation
attr_accessor :subscription
private :subscription
def initialize(subscription:, **args)
self.subscription = subscription
super(args)
end
def c... |
#
# Cookbook Name:: dockworker
# Recipe:: provisioner
#
# Copyright 2012-2014, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICEN... |
class List < ActiveRecord::Base
ACTIVE = ['Y','N']
RESETS = ["0900","1000","1100","1200","1300","1400","1500","1600","1700","1800","1900","2000"]
validates :list_id, presence: true, length: { in: 3..8 }, numericality: { only_integer: true }
validates :list_name, presence: true, length: { in: 2..20 }
validates... |
require 'spec_helper'
describe GithubAuthorizedKeys::CLI do
before do
@config = { 'organization' => 'some-org', 'oauth_token' => 'token' }
subject.stub(:load_config)
subject.stub(:fetch_members => [
{'login'=>'first'},
{'login'=>'second'},
{'login'=>'third'}
])
subject.stub(:fet... |
# Build the HTML tag method
def tag(tag_name, value, attributes = {})
html_attrs = attributes.map do |key, value|
" #{key}='#{value}'"
end
"<#{tag_name}#{html_attrs.join(' ')}>#{value}</#{tag_name}>"
end
puts tag("h1", "Hello world")
# => <h1>Hello world</h1>
puts tag("h1", "Hello world", { class: "bold"... |
# frozen_string_literal: true
Puppet::Util::Log.newdesttype :logging do
match "Logging::Logger"
# Bolt log levels don't match exactly with Puppet log levels, so we use
# an explicit mapping.
def initialize(logger)
@external_logger = logger
@log_level_map = {
debug: :debug,
info: :info,
... |
class LabirintController < ApplicationController
layout false, except: [:index]
def parse
@flights = Parser.parse(params[:date_from], params[:date_to])
end
end
|
require 'rspec'
require 'logic_gates'
describe '#my_and' do
it "matches truth table" do
expect(my_and(false, false)).to be_falsey
expect(my_and(false, true)).to be_falsey
expect(my_and(true, false)).to be_falsey
expect(my_and(true, true)).to be_truthy
end
end
describe '#my_or' do
it "matches tru... |
require 'sinatra'
require 'securerandom'
require 'json'
require 'liquid'
configure { set :server, :puma }
COLUMNS = {
'ergodox_ez' => [7,7,6,7,5,2,1,3,7,7,6,7,5,2,1,3],
'planck' => [12,12,12,11],
'preonic' => [12,12,12,12,12]
}
post '/' do
layout = JSON.load(request.body.read)
type = layout['type']
... |
# frozen_string_literal: true
FactoryGirl.define do
factory :user do
email { Faker::Internet.email }
password { Faker::Internet.password }
profile { |r| r.association :profile }
role { %i[client admin].sample }
end
end
|
# outer scope variables can be accessed by inner scope
a = 1 # outer scope variable
loop do # the block following the invocation of the `loop` method creates an inner scope
puts a # => 1
a = a + 1 # "a" is re-assigned to a new value
break # necessary to prevent infinite loop
end
puts ... |
class Icon < ApplicationRecord
CATEGORIES = ["Music", "Sports", "Business", "Food", "Politics", "Science", "Design", "Writing", "Cinema", "Code"]
has_many :bookings, dependent: :destroy
has_many :reviews, through: :bookings, dependent: :destroy
belongs_to :user
has_one_attached :photo
validates :name, :pric... |
class CreateFlashphotoBanners < ActiveRecord::Migration
def self.up
create_table :flashphoto_banners do |t|
t.integer "article_banner_id"
t.timestamps
end
add_index :flashphoto_banners, [:article_banner_id], :name => 'flashphoto_banners_article_banner_id_index'
end
def self.down
dro... |
# frozen_string_literal: true
require 'ostruct'
RSpec.describe Api::V1::HoursController, type: :controller do
let(:valid_json) do
{ "2016-01-02 00:00:00 -0800": { open: '12:00am',
close: '12:00pm',
string_date: '2016-01-02',
... |
class HomeController < ApplicationController
def index
@states = Game.all
respond_to do |format|
format.html {render :index}
format.json {render json: @states}
end
end
def show
@state = Game.find(params[:id])
render json: @state
end
def save
@state = Game.create(save_pa... |
module PuppetX
module BSD
class Util
def self.normalize_config(config)
# Modify the config object to reject all undef values
raise ArgumentError, "Config object must be a Hash" unless config.is_a? Hash
config.reject!{|k,v| k == :undef or v == :undef }
config.reject!{|k,v| k =... |
require 'spec_helper'
describe 'python::virtualenv' do
let(:title) { '/opt/v' }
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) { facts }
context 'with python3' do
three_versions(facts).each do |three_version|
context "version #{three_version}" do
... |
require "open3"
require "safe_shell/version"
require "safe_shell/mock"
module SafeShell
class << self
def make_context(constants, libraries)
{ :constants => constants, :libraries => [libraries].flatten }
end
def run_test(test, cmd_test, mocks = [])
variables = test[:constants].map{ |name, ... |
require "optparse"
class Sable::Runner
DEFAULT_SAFILE = 'SAFile'
def run(argv)
mode = nil
dry_run = false
options = {
file: DEFAULT_SAFILE
}
output = DEFAULT_SAFILE
opt.on('-a', '--apply') { mode = :apply }
opt.on('', '--dry-run') { dry_run = true }
opt.on('-e', '--export')... |
class ScienceQuestionsController < ApplicationController
def index
@questions = ScienceQuestionsFetchService.new.random_questions_list
rescue
# NOTE: the standard error page will render when any error is raised, regardless of the type of error
# Will need to change this in the future for more nuanced er... |
require_relative './dings'
module AnsiClr
include Dings
OP = 27.chr + '[' # ANSI color control opening symbols
PLAIN = '0'
RESET = "#{OP}m"
# Styles:
BOLD = '1'
DIM = '2'
ULINE = '4'
BLINK = '5'
REVERSE = '7'
HIDDEN = '8'
REBOLD = "2#{BOLD}"
REDIM = "2#{DIM}"
REULINE = "2#{ULINE}"
REBL... |
class Bid < ActiveRecord::Base
belongs_to :sale
belongs_to :user
before_validation :default_to_zero_if_necessary, :on => :create
before_validation :check_if_active, :on => :create
before_validation :check_if_begun, :on => :create
validates :price, uniqueness: {scope: :sale_id}
validate :more_than_min
... |
class UserMailer < ApplicationMailer
def confirmation(user)
@user = user
mail(to: user.email, subject: 'Please confirm your email')
end
def notification(user, message, link)
@user = user
@message = message
# 'root' links to the root_url if they're relative
link = root_url + link[1..link.... |
Rails.application.routes.draw do
resources :authors do
member do
get 'view_books'
end
end
resources :books
root "authors#index"
end
|
class Unit
class DeadError < StandardError
end
attr_reader :attack_power, :health_points
def initialize(health_points, attack_power)
@health_points = health_points
@attack_power = attack_power
end
def attack!(enemy)
can_attack?(enemy)
enemy.damage(@attack_power)
end
def ... |
class Customer
attr_reader :name, :downloads
def initialize name
@name = name
@downloads = []
end
def add_download arg
@downloads << arg
end
def statement
result = "\nDownload Records for #{name}\n"
@downloads.each do |element|
result += "\t" +element.song.title+ " " + element.charge.to_s + "\n... |
require 'nokogiri'
require 'open-uri'
Dir[File.join(Rails.root, 'lib', 'game_modules', '*.rb')].each do |f|
require File.expand_path(f)
end
class Game < ActiveRecord::Base
belongs_to :user
scope :unfinished, where(:ended_at => nil)
scope :others_turn, where(:my_turn => false)
scope :my_turn, where(:my_turn... |
class ProduitApi< ActionWebService::API::Base
api_method :find_all_produits,
:returns => [[:int]]
api_method :find_produit_by_id,
:expects => [:int],
:returns => [Produit]
end
|
require 'RMagick'
module Thumbo
class Proxy
attr_reader :title
def initialize owner, title
@owner, @title = owner, title
@image = nil # please stop warning me @image is not defined
end
# image processing
def image
@image || (self.image = read_image)
end
# check if ima... |
class AddTimestampsToUserDetail < ActiveRecord::Migration[5.0]
def change
add_column :user_details, :created_at, :datetime
add_column :user_details, :updated_at, :datetime
end
end
|
module SageOne
class Client
module LedgerAccounts
# @example Get all ledger accounts
# SageOne.ledger_accounts
def ledger_accounts(options={})
get("ledger_accounts", options)
end
end
end
end
|
class CreateSubsets < ActiveRecord::Migration
def change
create_table :subsets do |t|
t.integer :swimset_id
t.integer :distance
t.integer :stroke_id
t.text :comment
t.timestamps
end
end
end
|
require('minitest/autorun')
require('minitest/rg')
require_relative('../testing_task_2')
class TestCardGame < Minitest::Test
def setup
@card1 = Card.new("Ace", 1)
@card2 = Card.new("King", 13)
@card3 = Card.new("Queen", 12)
@card4 = Card.new("Jack", 11)
@card5 = Card.new("Ten", 10)
@card6 = ... |
class NotifyByDefaultOnBudgets < ActiveRecord::Migration[5.1]
class Budget < ApplicationRecord; end
def change
change_column :budgets, :notify_on_balance_updates, :boolean, :default => true
Budget.all.each do |budget|
budget.update_attributes!(notify_on_balance_updates: true)
end
end
end
|
class Weekend < ApplicationRecord
self.primary_key = :uuid
include HasUuid
STATUS = [
"draft",
"moderation_pending",
"published"
].freeze
belongs_to :front_user, optional: true
validates :city, presence: true
validates :body, length: { in: 20..65_535 }
validates :status, inclusion: { in: ... |
require "test_helper"
class CompletedTransactionPresenterTest < ActiveSupport::TestCase
def subject(content_item)
CompletedTransactionPresenter.new(content_item.deep_stringify_keys!)
end
test "#promotion" do
assert_equal "organ-donation", subject(details: { promotion: "organ-donation" }).promotion
end... |
class RemoveFolderIdColumnFromActiveStorage < ActiveRecord::Migration[6.0]
def change
remove_column :active_storage_attachments, :folder_id, :integer
end
end
|
module Natives
class HostDetection
class PackageProvider
COMMANDS = {
'aix' => 'installp',
'yum' => 'yum',
'packman' => 'packman',
'apt' => 'apt-get',
'feebsd' => 'pkg_add',
'portage' => 'emerge',
'homebrew' => 'brew',
'macports' => 'port',
... |
require 'spec_helper'
module Makeloc
describe DoGenerator do
# loaded once at beginning
let!(:ref_hash_with_root) { YAML.load(File.read(REF_LANG_FP)) }
let!(:ref_hash) { ref_hash_with_root[REF_LANG] }
let!(:incomplete_target_hash_with_root) { YAML.load(File.read(TARGET_INCOMPLETE_ORIGINAL_FP)) }
... |
class SendParticipantToVoicemail
def initialize(participant:, user:)
@participant = participant
@user = user
end
def call
voicemail_call = create_call
ConnectCallToVoicemail.new(incoming_call: voicemail_call).call
end
private
attr_reader :participant, :user
def create_call
Incoming... |
require_relative "DNAsequence.rb"
class DNAhash
attr_reader :hash
#*******************
#Initialization of a DNA hash
#*******************
#3 modes: from a DNA sequence, from a string or from a well-formatted hash
def initialize(intro, k = 1)
if intro.is_a? Hash
@hash = intro
elsif intro.is_a? DNA... |
require_relative './../../spec_helper'
describe ArangoGraph do
context "#new" do
it "create a new Graph instance without global" do
myGraph = ArangoGraph.new graph: "MyGraph", database: "MyDatabase"
expect(myGraph.graph).to eq "MyGraph"
end
it "create a new instance with global" do
myG... |
module Roby
module Queries
# Matcher for CodeError exceptions
#
# In addition to the LocalizedError properties, it allows to match
# properties on the Ruby exception that has been thrown
class CodeErrorMatcher < LocalizedErrorMatcher
attr_reader :ruby_exception_cl... |
def zip(arr1, arr2)
result = []
arr1.size.times do |i|
result << [arr1[i], arr2[i]]
end
result
end
p zip([1, 2, 3], [4, 5, 6]) == [[1, 4], [2, 5], [3, 6]]
# ---- With each_with_object ----
def zipp(arr1, arr2)
arr1.each_with_object([]).with_index do |(_, result), idx|
result << [arr1[idx], arr2[idx... |
require 'station'
describe Station do
subject(:mudchute) {described_class.new(:station, :zone_num)}
it "A station has a name" do
expect(subject.station_name).to eq :station
end
it "A station has a zone" do
expect(subject.zone).to eq :zone_num
end
end
|
class Category < ApplicationRecord
has_many :category_answers
has_many :questions
end
|
# Copyright © 2011-2019 MUSC Foundation for Research Development
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this list... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.