text
stringlengths
10
2.61M
class GuessingGameRound def initialize(round_number = 1) @won = false @answer = rand(1..10) @round_number = round_number @guesses_used = 0 @guesses_allowed = 3 end def play puts "===Round #{@round_number}===" @guesses_allowed.times do make_guess if @won break ...
class ApplicationController < ActionController::API def authenticate_request auth_token = request.headers['Authorization'] if auth_token token = JsonWebToken.decode(auth_token) @employee = Employee.find_by(id: token[:employee_id]) render json: {error: "could not validate the auth token"}, s...
class CreateOuts < ActiveRecord::Migration[5.2] def change create_table :outs do |t| t.integer :slave_id, index: true t.integer :trader_id, index: true t.timestamps end end end
class PasswordValidationValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) if value.blank? record.errors.add(attribute, 'パスワードを入力してください。') elsif value.length < 8 record.errors.add(attribute, 'パスワードは8文字以上で入力してください。') elsif value.length > 128 record.errors.a...
class AddTrialFieldsToUsers < ActiveRecord::Migration[5.2] def change add_column :users, :trial, :boolean add_column :users, :trial_started, :datetime end end
module ThreeScale module Backend class ServiceUserManagementUseCase def initialize(service, username = nil) @service = service @username = username end def add storage.sadd(@service.storage_key("user_set"), @username) end def exists? storage.sismemb...
Gem::Specification.new do |spec| spec.name = "rack-builtwith" spec.version = "1.0.0.alpha" spec.author = "Samuel Cochran" spec.email = "sj26@sj26.com" spec.summary = %q{Remove your site from builtwith.com} spec.homepage = "https://github.com/sj26/rack-builtwith" spec.license = "MIT" spec.metadata["hom...
require 'rails_helper' RSpec.describe Arena, type: :model do describe "validation of uniqueness" do it "is valid if the names differ" do create :arena arena1 = build :arena expect(arena1).to be_valid end it "is not valid if they are the same" do arena = create :arena aren...
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
#encoding: utf-8 class LabTest < ActiveRecord::Base include Dynamisable # Constants # Put here constants for LabTest # Relations belongs_to :work_order belongs_to :test_status belongs_to :test_type belongs_to :test_type_version belongs_to :specimen belongs_to :tested_by, class_name: 'User', fore...
class StatementsPage include PageObject include FooterPanel include HeaderPanel include DataMagic include ValidationHelper include Canada_FooterPanel include WaitingMethods PAGE_HEADING = "Statements & Documents" page_url FigNewton.cos_url_prefix + '/accounts/statements' select_list(:cardsdropdow...
class Notice < ActiveRecord::Base has_many :documents has_many :attachments belongs_to :project accepts_nested_attributes_for :attachments end
class CampRegistration < ActiveRecord::Base validates_presence_of :name, :if => :name_in_form? validates_presence_of :email, :if => :email_in_form? validates_presence_of :age, :if => :age_in_form? validates_presence_of :position, :if => :position_in_form? validates_presence_of :school, :if => :school_in_form?...
module Currency CURRENCY_MAPPING = {'PHP' => 1, 'US$' => 40} LOCAL_CURRENCY = 'PHP' def self.all CURRENCY_MAPPING.keys end end
class SerializeChunkedUploadTask def initialize(chunked_upload_task) @chunked_upload_task = chunked_upload_task end def call { id: @chunked_upload_task.id, large_file: serialize_large_file } end private def serialize_large_file large_file = @chunked_upload_task.large_file ...
class CreateReminderService < ApplicationService def initialize(params) @params = params end def call reminder = Reminder.create!( title: @params[:title], note: @params[:note], due_date: @params[:due_date], remind_interval: @params[:remind_interval], reminderable: @params[:remind...
require 'rails_helper' RSpec.describe Song, type: :model do it 'has a title' do c1 = create(:category) song = build(:song) expect(song.title).to be_a(String) song.title = nil expect(song).to_not be_valid end it 'should have a category' do song = build(:song, categories: []) expe...
class ReviewsController < ApplicationController helper_method :average_rating def index restaurant_name = params[:review][:restaurant] num_entries = params[:review][:num_entries].to_i scraper = ReviewScraper.new @reviews = scraper.search(restaurant_name, num_entries) respond_to do |format| ...
# coding: utf-8 require 'spec_helper' describe Locomotive::ThemeAsset do describe 'attaching a file' do before(:each) do Locomotive::ThemeAsset.any_instance.stubs(:site_id).returns('test') @asset = FactoryGirl.build(:theme_asset) end describe 'file is a picture' do it 'should proce...
class Setting < ApplicationRecord belongs_to :user # validates :name, presence : { message: :no_name} validates :country, length: { minimum: 2, message: :country } validates :language, length: { minimum: 2, message: :language } end
# frozen_string_literal: true module DX module Api module File # Clone a file, based on its id, from a source container (e.g. a source project) to a folder path in a destination container (e.g. a destination project) # https://documentation.dnanexus.com/developer/api/data-containers/cloning#api-metho...
class ApplicationController < ActionController::Base def admin_only authenticate_user! unless current_user.admin redirect_to user_path(current_user), notice: "Only an administrator may perform that function." end end end
class Team attr_accessor :name, :ranking def initialize(name, ranking) @name = name @ranking = ranking end end @teams = [] def menu puts "Choose From the Following:" puts "----------------------" puts "1. Enter Teams" puts "2. List Teams" puts "3. List Match-ups" puts "0. Exit Progra...
require 'spec_helper' describe Ginatra::Repo do let(:repo) { Ginatra::RepoList.find('test') } describe "repo" do it "returns name" do expect(repo.name).to eq("test") end it "returns param" do expect(repo.param).to eq("test") end it "returns description" do expect(repo.descr...
class ApplicationController < ActionController::Base protect_from_forgery def is_admin unless(session[:admin]) redirect_to admin_login_path end end def is_member unless(member_signed_in?) session["member_return_to"] = "#{request.fullpath}" redirect_to new_member_session_path end end ...
puts (0..1000).select {|n| n%3==0 || n%5==0}.inject(0) {|s,n| s+=n}
execute "replace frontend" do if /^(2.0|2.2)/ =~ node['zabbix']['server']['version'] command <<-CMD #{node['hyclops']['download_path']}/setup.py replace \ -d #{node['zabbix']['frontend_dir']} \ --zabbix-version=#{$&} CMD action :run else p "Not supported version.(Supported only 2.0...
module Forums class Topic < ApplicationRecord include MarkdownRenderCaching has_ancestry cache_depth: true belongs_to :isolated_by, optional: true, class_name: 'Topic' belongs_to :created_by, class_name: 'User' has_many :threads, dependent: :destroy has_many :subscriptions, dependent:...
require 'rails_helper' describe Api::V1::IpController, type: :controller do let!(:api_key) { create(:api_key) } before { request.headers['Content-Type'] = 'application/json;charset=utf-8' request.headers['Authorization'] = "Bearer #{api_key.token}" } describe 'POST /api/v1/store' do context 'whe...
class QuestionTung < ActiveRecord::Base belongs_to :survey_tung has_many :answers, :dependent => :destroy accepts_nested_attributes_for :answers, :reject_if => lambda { |a| a[:content].blank? }, :allow_destroy => true validates_presence_of :content, :question_type validate :proper_answers_number private...
require "rails_helper" RSpec.describe WalterMessageNotificationJob, type: :job do describe "#perform" do it "does not send a request when no endpoint is set" do fake_http = spy(HTTP) message = create(:outgoing_message) expect(fake_http).not_to receive(:post) stub_const("HTTP", fake_http...
class AdminController < ApplicationController before_filter :login_required require_role :admin def index @current_item = "admin" end end
class Comment < ApplicationRecord belongs_to :user belongs_to :imageable, polymorphic: true validates_presence_of :content validates_length_of :content, :within => 1..100 end
class CommentsController < ApplicationController before_action :authenticate_user! before_action :set_comment, only: [:destroy] before_action :is_owner?, only: [:destroy] def create @comment = Comment.new(comment_params) if @comment.save flash[:notice] = "댓글을 작성하였습니다." redirect_...
#encoding: utf-8 class BlogInfo < ActiveRecord::Base self.table_name = 'blog_info' validates :name, length: {minimum: 2, maximum: 20} validates :email, format: {with: /\A[a-zA-Z0-9\-]+@[a-zA-Z0-9-]+\.(org|com|cn|io|net|cc|me)\z/} end
class ConvertDeploymentsActiveFlagToADeactivationFlag < ActiveRecord::Migration def self.up rename_column :deployments, :is_active, :is_deactivated end def self.down rename_column :deployments, :is_deactivated, :is_active end end
class TeacherSchoolClassDiscipline < ActiveRecord::Base belongs_to :teacher belongs_to :school_class belongs_to :discipline belongs_to :period has_many :students, through: :school_class def school_class_discipline_name school_class.name + " - " + discipline.name end def teache...
class UsersController < ApplicationController def show profile = Profile.find(params[:id]) user = User.find(params[:id]) end def edit @user = User.find(current_user) end def update if current_user.update(user_params) sign_in(current_user, bypass: true) redirect_to user_path, not...
require_relative '../../../puppet_x/century_link/clc' require_relative '../../../puppet_x/century_link/prefetch_error' Puppet::Type.type(:clc_server).provide(:v2, parent: PuppetX::CenturyLink::Clc) do mk_resource_methods read_only(:id, :os_type, :os, :location, :ip_addresses) def self.instances begin ...
$:.push File.expand_path("../lib", __FILE__) require "spellbook/version" Gem::Specification.new do |s| s.name = "spellbook" s.version = SpellBook::VERSION s.platform = Gem::Platform::RUBY s.authors = ["Yutaka HARA"] s.email = ["yutaka.hara.gmail.com"] s.homepage = "http://github....
class Contentr::Admin::FilesController < Contentr::Admin::ApplicationController def index @files = Contentr::File.all end def new @file = Contentr::File.new end def create @file = Contentr::File.new(file_params) if @file.save flash[:success] = 'File created.' redirect_to contentr...
Rails.application.routes.draw do root 'welcome#index' resources :upvotes resources :countries get '/users/:id', to: 'users#show', as: 'user' resources :divingsites do put "like" => "divingsites#upvote" end resources :reviews get '/signup', to: 'users#new', as: 'signup' post '/signup', to: '...
class ApplicationController < ActionController::Base protect_from_forgery with: :null_session def show_all klass = get_class klass.all end def find_random klass = get_class klass.all.sample end def find_resource klass = get_class search_param = get_search_param if params[:id] ...
class RecipesController < ApplicationController before_action :set_recipe, only: [:show, :edit, :update, :destroy] def index @recipes = current_user.recipes.recent @completed = Recipe.new.completed(current_user) end def show end def new @recipe = current_user.recipes.new @recipe.ingredient...
require 'bcrypt' class User include Mongoid::Document attr_accessor :password field :email, type: String field :name, type: String field :password_salt, type: String field :password_hash, type: String has_many :tools def authenticated?(pswd) BCrypt::Password.new(self.password_hash) == pswd e...
require 'everyday_natsort_kernel' require 'rbe/data/data_store' require 'everyday_thor_util/builder' include EverydayThorUtil::Builder root_command[:var] = command(aliases: %w(variable v), short_desc: 'var SUBCOMMAND ARGS...', desc: 'configure stored variables') root_command[:var][:add] = command(short_desc: 'add V...
require './spec/spec_helper' describe Result do let(:the_class) {Result} subject { Result.new(:label => "A result", :score => 1) } describe "Instance Methods" do it {should respond_to :id} it {should respond_to :klass} it {should respond_to :raw_data} it {should respond_to :score} it {should...
class PaginaPrincipalTaxistaController < ApplicationController before_action :authenticate_driver! def index @driver=current_driver end end
require 'binary_heap' class PriorityQueueHashMap include BinaryHeap def initialize max_heap=false @elements = [] @index = {} @is_min_heap = !max_heap end def pop min_or_max = @elements.shift.key @index[min_or_max] = nil min_or_max end def add (key, value) @elements << KeyValue...
# frozen_string_literal: true module Lox class Scanner attr_reader :input def initialize(input) @input = input end def each_char return enum_for(:each_char) unless block_given? input.each_line do |line| line.each_char do |character| yield(character) end ...
module Gaman module Clip # Internal: Parses a FIBS You Say CLIP message. This CLIP message confirms # that FIBS has processed your request to send a 'say' or 'tell'. Message # is in the format: # # name message # # name: name of the player that the message was sent to. # message...
require File.expand_path('../../../spec_helper', __FILE__) describe "1.9", -> describe "Time#round", -> before do @time = R.Time.utc(2010, 3, 30, 5, 43, "25.123456789".to_r) @subclass = Class.new(Time).now it "defaults to rounding to 0 places", -> @time.round.should == R.Time.utc(2010, 3, ...
module Merb::Cache::DatabaseStore::Sequel # Module that provides Sequel support for the database backend # The cache model class CacheModel < Sequel::Model(Merb::Controller._cache.config[:table_name].to_sym) set_schema do primary_key :id varchar :ckey, :index => true varchar :data ...
module Sass::Script::Functions include Flatrack::AssetExtensions def sized_image(filename, width=nil, height=nil) raise ArgumentError, 'height or width must be provided' unless width || height # assert types assert_type filename, :String if width assert_type width, :Number width = width...
class Player < ActiveRecord::Base self.per_page = 30 self.primary_key = 'account_id' include PlayersHelper include ApplicationHelper after_create :save_player has_many :playedgames, :dependent => :destroy has_many :games, :through => :playedgames has_many :participations, :class_name => "Participant" ...
require "xmlrpc/server" require 'xmlrpc/client' require "./LindaDistributed" require "./ConverterModule" module XMLRPCLinda class Common @@Port = 8088 @@Host = "localhost" @@Path = "/" @@Namespace = "LindaDistributed" def self.Port @@Port end d...
class Parameter < ActiveRecord::Base has_many :payload_requests has_many :clients, through: :payload_requests validates :list, presence: true, uniqueness: true end
# 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 CreateTypeWorkdaysWorkers < ActiveRecord::Migration def change if !table_exists? :type_workdays_workers create_table :type_workdays_workers do |t| t.integer :worker_id t.integer :type_workday_id end end end end
class JobTitle < ActiveRecord::Base include ReindexExpensesAfterSave validates :name, presence: true has_many :job_title_assignments has_many :expenses, through: :job_title_assignments end
require_relative "operations" require "rake" module Gaudi # This is the default directory layout: # src/platform # |-name/ - sources and local headers # |-inc/ - public headers # |-test/ - unit tests # # Code can be split in several source directories and by defau...
class SetDefaultHouseOfferType < ActiveRecord::Migration def up default_value = 0 # admin change_column_default :houses, :offer_type, default_value # admin House.all.each do |h| h.update_column(:offer_type, default_value) if h.offer_type.nil? end end def down change_column_default :hou...
require 'test_helper' class ApplicationHelperTest < ActionView::TestCase before do @text_question = create(:question, :text, :required) @number_question = create(:question, :number, :required) @text_response = build(:response, :text, question_id: @text_question.id) @number_response = build(:response...
module ReqresRspec module Formatters class Pdf < Base # generates PDF file from existing HTML docs # TODO: more info def write # http://www.princexml.com/download/ pdf_tool_path = 'prince' pdf_doc_path = File.join(output_path, 'reqres_rspec.pdf') if `which #{pdf_...
class UsersController < ApplicationController before_action :authenticate_user! # before_action :set_user, only: [:show] def index # user profiles feed if params[:query].present? @users = User.search_by_name_and_job(params[:query]) else @users = User.all end def show # user p...
# -*- coding: utf-8 -*- # hatsune lisp is moest language require_relative 'miku' require_relative 'error' require 'stringio' module MIKU def self.parse(str) if(str.is_a?(String)) _parse(StringIO.new(str, 'r').extend(StaticCode)) else str.extend(StaticCode) if not str.is_a? StaticCode str....
# frozen_string_literal: true require "test_helper" require "action_controller" module QuiltRails module Quilt class UiControllerTest < ActionDispatch::IntegrationTest include ActiveSupport::Testing::Isolation setup { boot_dummy } test "error when no react server" do time = Benchmark...
unless defined?(NATS) require "nats/client" end require "concurrent" module NATS def initialize(options) @options = options process_uri_options @buf = nil @ssid, @subs = 1, {} @err_cb = NATS.err_cb @close_cb = NATS.close_cb @reconnect_cb = NATS.reconnect_cb @disconnect_cb = NATS.d...
# frozen_string_literal: true require_relative 'piece' # logic for knight chess piece class Knight < Piece def initialize(board, args) super(board, args) @symbol = " \u265E " @captures = [] end # iterates over move_set and adds the location as a move when valid def find_possible_moves(board) ...
class CategoriesController < ApplicationController before_action :set_category, only: [:update, :destroy] before_action :authenticate_user! def index @categories = Category.all @total_categories = @categories.size flash[:notice] = nil if params[:query].present? @categories = Category.where('...
def setup_cookie # When this step-definition executes, the Browser has just opened and is sitting on the 'data:' URL # We need to go somewhere first before we can set the cookie in the Browser. # So we'll go to the login page visit(LoginPage) on(LoginPage).print_cookies on(LoginPage).add_cookie(@cookie_nam...
class AddSkillCategoryReferenceToSkills < ActiveRecord::Migration[5.0] def change add_reference :skills, :skill_category, foreign_key: true add_column :skills, :description, :string, default: "Please add description." end end
class CreateShips < ActiveRecord::Migration[6.0] def change create_table :ships do |t| t.integer :user_id t.integer :game_id t.integer :hp t.float :scores t.integer :position_x t.integer :position_y t.string :direction t.integer :start_time t.integer :player_o...
require 'rails_helper' RSpec.describe 'discover movies page' do before(:each)do @user = User.create(email: 'test123@xyz.com', password: 'viewparty') visit welcome_path fill_in :email, with: "test123@xyz.com" fill_in :password, with: "viewparty" click_button "Sign In" click_button "Discover Mo...
# encoding: utf-8 class Admin::ProjectsController < Admin::AdminController def index @projects = Project.order('id desc') end def new # end def create @project = Project.new project_params @project.project_thumbnail = ProjectThumbnail.new(project_thumbnail_params) if @project.save ...
class Tower < Cask version 'latest' sha256 :no_check url 'https://www.git-tower.com/download' homepage 'http://www.git-tower.com/' link 'Tower.app' end
# Invoice Requires # # Invoice contains the dynamic data needed to make an invoice. # Invoice works with the static date (invoice_text) to create a viewable and # printable invoice. # # Invoices are created during a run by the invoices_maker. # # An Invoice is made of: # # property # - property_ref (human_ref) # - oc...
class AddSalesRankToAmazonProducts < ActiveRecord::Migration[5.0] def change add_column :amazon_products, :sales_rank, :integer end end
require 'rails_helper' RSpec.describe Schedule, type: :model do it "has a valid factory" do expect(build(:schedule)).to be_valid end let(:schedule) { build(:schedule) } describe "ActiveModel validations" do # Basic validations it { expect(schedule).to validate_presence_of(:starts_at) } ...
require "crypto_env_var/version" require "crypto_env_var/cipher" require "crypto_env_var/utils" module CryptoEnvVar CRYPTO_ENV_VAR = "CRYPTO_ENV" DECRYPT_KEY_VAR = "CRYPTO_ENV_DECRYPT_KEY" CRYPTO_ENV = lambda { ENV.fetch(CRYPTO_ENV_VAR) } DECRYPT_KEY = lambda { ENV.fetch(DECRYPT_KEY_VAR) } class...
class AddNoticeToLeagueMatches < ActiveRecord::Migration[5.0] def change add_column :league_matches, :notice, :string, null: false, default: '' end end
class User < ApplicationRecord has_secure_password has_many :user_items has_many :items, through: :user_items has_many :item_types, -> { distinct }, through: :items has_and_belongs_to_many :freezers, {:join_table => :user_freezers} #has_many :freezers, -> { distinct }, through: :items has_many :notes d...
class AuthenticateUser def initialize(email, password) @email = email @password = password end def authenticate JwtHelper.encode(user_id: user.id) if user end private def user @user = User.find_by(email: @email) return @user if @user && @user.authenticate(@password) raise(AppE...
# DO WHAT WE CAN TO MAKE IT TRUE Given /^a (?:valid|open) silent auction$/ do create_silent_auction end Given /^there are valid auctions as the following:$/ do |table| table.hashes.each do | hash | hash["open"] = (hash["open"] == "yes") ? true : false auction = SilentAuction.make!(:title => hash['title'], ...
# -*- coding: utf-8 -*- # 実行メインクラスの概念はなく上から順次実行されます # 実行は ruby basic_practice.rb で行う # 外部ライブラリの使い方 require "json" obj = JSON.parse('{"key1":"value1","key2":"value2"}') p obj # 標準出力 print("This file name is basic_practice.rb\n") p "short ver" # 標準入力 p "Please input any key : " input = STDIN.gets p input # 引数 p ARGV[0]...
require "minitest/autorun" require "minitest/pride" require 'net/http' require 'json' class APITest < Minitest::Test def test_request_success keyword = "thomas" results = keyword_search(keyword) assert_equal results.class, Hash assert_equal results[:Search].class, Array assert_equal results[:Res...
# frozen_string_literal: true class GameUnitsFinder include BaseFinder def initialize(current_user, params = {}) @current_user = current_user @params = params end def call current_units = Unit .joins(:users) .where(users: { id: @current_user.id }) game_...
class AddValueJsonToDynamicFields < ActiveRecord::Migration def change add_column :dynamic_annotation_fields, :value_json, :jsonb, default: '{}' add_index :dynamic_annotation_fields, :value_json, using: :gin end end
require 'spec_helper' shared_examples 'a classifiable model' do let(:model) { described_class.new } let(:default_type) do PanamaxApi::TYPES.find { |type| type['default'] }['name'] end context 'when the type field is nil' do it 'sets the type to be the default value' do model.valid? expec...
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "Meme::Post" do describe "::find" do before :each do query = "SELECT * FROM meme.search WHERE query='meme rocks'" fake_web(query, 'meme_search.json') @results = Meme::Post.find('meme rocks') end Meme::Post::VA...
class BusinessController < ApplicationController def initialize super @var = BusinessDecorator.new @var.link = { I18n.t("cmn_sentence.listTitle", model:Business.model_name.human)=>{controller:"business", action:"index"}, I18n.t("cmn_sentence.newTitle", model:Business.model_name.human)=>{controller:"busine...
# frozen_string_literal: true module Api module V1 # Room Reservation database model class RoomResRoom < RoomResRecord self.table_name = APPLICATION_CONFIG['api']['database']['roomres']['rooms']['table_name'] has_many :reservations, class_name: 'Api::V1::RoomResReservation', foreign_key: 'room_id...
module Cinemas class CinemaRepository CinemaNotFound = Class.new(StandardError) CinemaNumberAlreadyTaken = Class.new(StandardError) attr_reader :repository def initialize(repository: Cinemas::Model) @repository = repository end def find_by_id(id) repository.find(id) rescue ActiveRecord::RecordN...
class Mutations::CompleteResolution < Mutations::BaseMutation null true # arguments passed as "args" argument :id, ID, required: true argument :completed, Boolean, required: true # return type from the mutation #type Types::ResolutionType field :resolution, Types::ResolutionType, null: true field :er...
class CartProduct < ActiveRecord::Base belongs_to :user # return products in the cart of the current user def self.show_cart(page, current_user_id) @cart_products = order("created_at DESC").where(user_id: current_user_id) @show_cart_list = [] @cart_products.each do |cart_product| show_cart_item = {} ...
class DamsDatastream < ActiveFedora::RdfxmlRDFDatastream property :complexSubject, predicate: DAMS.complexSubject, class_name: "MadsComplexSubject" property :scheme, predicate: MADS.isMemberOfMADSScheme, class_name: "MadsScheme" property :temporal, predicate: DAMS.temporal, class_name: "MadsTemporal" property :...
class DropNights < ActiveRecord::Migration def change drop_table :nights end end
# encoding: utf-8 # See LICENSE.txt for licensing information. require 'logger' require './c64asm/data' require './c64asm/basic' require 'pry' # Fixnum monkey-patches class Fixnum # Return the least significant byte def ls_byte; self & 255; end # Return the most significant byte def ms_byte; self >> 8; end e...
class AllPatientsService def initialize(params) @search = params[:search] end #get patients depending on whether a search is present def call if @search.blank? patients = Patient.limit(28) elsif @search.present? patients = Patient.search(@search) ...
module Quanta ###################################################################### # Usage ###################################################################### # datamap = { # ## Declare variables that can be used withing the map # _var_: { # "area_value": { # "sq-ft": "square-feet" # ...