repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
voc/eventkalender
spec/spec_helper.rb
<filename>spec/spec_helper.rb # frozen_string_literal: true # First include simplecov to track code coverage require 'simplecov' SimpleCov.start do add_filter '/spec/' end require 'rspec' require 'webmock/rspec' require 'rack/test' require 'sinatra' require 'haml' %w[scraper fixnum].each do |file| require File....
voc/eventkalender
spec/lib/eventkalender/parser/meetings_spec.rb
<gh_stars>1-10 # frozen_string_literal: true require 'spec_helper' describe Eventkalender::Parser::Meetings do describe '#to_txt' do it 'should return events string' do # pending end end end
voc/eventkalender
lib/eventkalender/fixnum.rb
<gh_stars>1-10 # frozen_string_literal: true # This class overwrites Integer in core to adds rails like time handling # and can be used to determine time shifts. # # @example # 1.day.ago #=> 2014-05-08 23:02:46 +0200 # @example # 23.hours.ago #=> 2014-05-08 12:12:49 +0200 class Integer # a day in seconds SECON...
voc/eventkalender
lib/eventkalender.rb
# frozen_string_literal: true require_relative 'eventkalender/event/event' require_relative 'eventkalender/event/meeting' require_relative 'eventkalender/event/conference' require_relative 'eventkalender/parser/parser' require_relative 'eventkalender/parser/conferences' require_relative 'eventkalender/parser/meetings...
voc/eventkalender
lib/eventkalender/event/event.rb
# frozen_string_literal: true class Eventkalender # Represents a voc event. # # @!attribute [rw] start_date # @param date [String] witch represents start date of the event # @return [Date] event start date # @!attribute [rw] end_date # @param date [String] witch represents end date of the event #...
voc/eventkalender
spec/lib/eventkalender/parser/conferences_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Eventkalender::Parser::Conferences do before(:each) do end after(:each) do @parser = nil end describe '#events' do # pending end describe '#to_txt' do it 'should return events string' do # pending end end describe...
voc/eventkalender
spec/lib/eventkalender/fixnum_spec.rb
# frozen_string_literal: true require 'spec_helper' describe 'Integer' do describe 'Constants' do it 'should have seconds per day, seconds per hour and seconds per minutes defined' do expect(Integer::SECONDS_IN_DAY).to eq 86_400 expect(Integer::SECONDS_IN_HOUR...
voc/eventkalender
lib/eventkalender/parser/meetings.rb
<gh_stars>1-10 # frozen_string_literal: true class Eventkalender class Parser::Meetings < Eventkalender::Parser attr_accessor :event_table def initialize(event_table) @event_table = event_table parse(event_table) end def events(events = parse) events end # Converts events...
someoneAnyone/PageCollectionViewLayout
PageCollectionViewLayout.podspec
<gh_stars>1-10 Pod::Spec.new do |s| s.name = "PageCollectionViewLayout" s.version = "0.0.1" s.summary = "A quick and dirty UICollectionFlowLayout that mimics some of the UIPageViewController." s.description = <<-DESC I did not like how the UIPageViewController handled data. I ...
olineham/morebetter-theme
lib/model_patches.rb
<reponame>olineham/morebetter-theme<filename>lib/model_patches.rb # Add a callback - to be executed before each request in development, # and at startup in production - to patch existing app classes. # Doing so in init/environment.rb wouldn't work in development, since # classes are reloaded, but initialization is not ...
olineham/morebetter-theme
lib/public_body_categories_en.rb
<filename>lib/public_body_categories_en.rb # The PublicBodyCategories structure works like this: # [ # "Main category name", # [ "tag_to_use_as_category", "Sub category title", "sentence that can describes things in this subcategory" ], # [ "another_tag", "Second sub category title", "another descriptive ...
olineham/morebetter-theme
lib/config/custom-routes.rb
<gh_stars>0 # Here you can override or add to the pages in the core website Alaveteli::Application.routes.draw do # brand new controller example #map.with_options :controller => 'general' do |general| # general.mycontroller '/mycontroller', :action => 'mycontroller' #end # Additional help page example #m...
livio/SmartDeviceLink-Promisekit
SmartDeviceLink+PromiseKit.podspec
<gh_stars>1-10 Pod::Spec.new do |spec| spec.name = 'SmartDeviceLink+PromiseKit' spec.version = '0.2' spec.platform = :ios, '8.0' spec.license = { :type => "New BSD", :file => "LICENSE" } spec.summary = 'PromiseKit extensions for SmartDeviceLink' spec.author = '<NAME>' spe...
dexcodeinc/pdf-reader
lib/pdf/reader/cmap.rb
# coding: utf-8 ################################################################################ # # Copyright (C) 2008 <NAME> (<EMAIL>) # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software wit...
dexcodeinc/pdf-reader
lib/pdf/reader/standard_security_handler.rb
# coding: utf-8 ################################################################################ # # Copyright (C) 2011 <NAME> (<EMAIL>) # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software wit...
dexcodeinc/pdf-reader
lib/pdf/reader/abstract_strategy.rb
# coding: utf-8 class PDF::Reader # DEPRECATED: this class was deprecated in version 0.11.0 and will # eventually be removed class AbstractStrategy # :nodoc: def initialize(ohash, receivers, options = {}) @ohash, @options = ohash, options if receivers.is_a?(Array) @receivers...
dexcodeinc/pdf-reader
lib/pdf/reader/width_calculator.rb
# coding: utf-8 # PDF files may define fonts in a number of ways. Each approach means we must # calculate glyph widths differently, so this set of classes conform to an # interface that will perform the appropriate calculations. require 'pdf/reader/width_calculator/built_in' require 'pdf/reader/width_calculator/compo...
dexcodeinc/pdf-reader
lib/pdf/reader/font_descriptor.rb
<gh_stars>1-10 # coding: utf-8 require 'ttfunk' class PDF::Reader # Font descriptors are outlined in Section 9.8, PDF 32000-1:2008, pp 281-288 class FontDescriptor attr_reader :font_name, :font_family, :font_stretch, :font_weight, :font_bounding_box, :cap_height, :ascent, :descent, :leading,...
dexcodeinc/pdf-reader
spec/reader/filter/null_spec.rb
# coding: utf-8 require File.dirname(__FILE__) + "/../../spec_helper" describe PDF::Reader::Filter::Null do it "returns the data unchanged" do filter = PDF::Reader::Filter::Null.new expect(filter.filter("\x00")).to eql("\x00") end end
dexcodeinc/pdf-reader
spec/xref_spec.rb
# coding: utf-8 require File.dirname(__FILE__) + "/spec_helper" # expose the xrefs hash inside the XRef class so we can ensure it's built correctly class PDF::Reader::XRef attr_reader :xref end describe PDF::Reader::XRef, "initilisation" do context "with cairo-basic.pdf" do it "should load all xrefs correctl...
dexcodeinc/pdf-reader
lib/pdf/reader/object_stream.rb
<gh_stars>1-10 # coding: utf-8 class PDF::Reader # provides a wrapper around a PDF stream object that contains other objects in it. # This is done for added compression and is described as an "Object Stream" in the spec. # class ObjectStream # :nodoc: def initialize(stream) @dict = stream.hash ...
dexcodeinc/pdf-reader
spec/reader_spec.rb
<reponame>dexcodeinc/pdf-reader # coding: utf-8 require File.dirname(__FILE__) + "/spec_helper" describe PDF::Reader do let(:cairo_basic) { pdf_spec_file("cairo-basic")} let(:oo3) { pdf_spec_file("oo3")} let(:no_text_spaces) { pdf_spec_file("no_text_spaces")} describe "open() class method" do ...
dexcodeinc/pdf-reader
lib/pdf/reader/width_calculator/type_one_or_three.rb
<filename>lib/pdf/reader/width_calculator/type_one_or_three.rb # coding: utf-8 class PDF::Reader module WidthCalculator # Calculates the width of a glyph in a Type One or Type Three class TypeOneOrThree def initialize(font) @font = font if @font.font_descriptor @missing_widt...
dexcodeinc/pdf-reader
lib/pdf/reader/register_receiver.rb
# coding: utf-8 # Copyright (C) 2010 <NAME> (<EMAIL>) class PDF::Reader # An example receiver that just records all callbacks generated by parsing # a PDF file. # # Useful for testing the contents of a file in an rspec/test-unit suite. # # Usage: # # PDF::Reader.open("somefile.pdf") do |reader| ...
dexcodeinc/pdf-reader
spec/page_spec.rb
# coding: utf-8 require File.dirname(__FILE__) + "/spec_helper" describe PDF::Reader::Page, "raw_content()" do it "should return a string from raw_content() from cairo-basic.pdf page 1" do @browser = PDF::Reader.new(pdf_spec_file("cairo-basic")) @page = @browser.page(1) expect(@page.raw_content).to ...
dexcodeinc/pdf-reader
lib/pdf/reader/transformation_matrix.rb
# coding: utf-8 class PDF::Reader # co-ordinate systems in PDF files are specified using a 3x3 matrix that looks # something like this: # # [ a b 0 ] # [ c d 0 ] # [ e f 1 ] # # Because the final column never changes, we can represent each matrix using # only 6 numbers. This is important to sav...
dexcodeinc/pdf-reader
lib/pdf/reader/width_calculator/true_type.rb
<reponame>dexcodeinc/pdf-reader<filename>lib/pdf/reader/width_calculator/true_type.rb # coding: utf-8 class PDF::Reader module WidthCalculator # Calculates the width of a glyph in a TrueType font class TrueType def initialize(font) @font = font if @font.font_descriptor @miss...
dexcodeinc/pdf-reader
spec/font_spec.rb
<filename>spec/font_spec.rb # coding: utf-8 require File.dirname(__FILE__) + "/spec_helper" describe PDF::Reader::Font do let(:object_hash) { PDF::Reader::ObjectHash.allocate } describe "basefont=()" do let(:font) { PDF::Reader::Font.new(object_hash, {}) } it "should select a sensible encoding when se...
dexcodeinc/pdf-reader
lib/pdf-reader.rb
<reponame>dexcodeinc/pdf-reader<filename>lib/pdf-reader.rb # coding: utf-8 require "pdf/reader"
dexcodeinc/pdf-reader
spec/object_hash_spec.rb
# coding: utf-8 require File.dirname(__FILE__) + "/spec_helper" describe PDF::Reader::ObjectHash do it "should have enumerable mixed in" do filename = pdf_spec_file("cairo-unicode") h = PDF::Reader::ObjectHash.new(filename) expect(h.map { |ref, obj| obj.class }.size).to eql(57) end end describe PDF:...
dexcodeinc/pdf-reader
spec/width_calculator/built_in_spec.rb
<gh_stars>0 # coding: utf-8 require "spec_helper" describe PDF::Reader::WidthCalculator::BuiltIn do it_behaves_like "a WidthCalculator duck type" do let!(:font) { double(:basefont => :Helvetica) } subject { PDF::Reader::WidthCalculator::BuiltIn.new(font)} end end describe PDF::Reader::WidthCalculator...
dexcodeinc/pdf-reader
spec/cid_widths_spec.rb
<reponame>dexcodeinc/pdf-reader # coding: utf-8 require File.dirname(__FILE__) + "/spec_helper" describe PDF::Reader::CidWidths, "#initilize" do context "with an empty array" do subject { PDF::Reader::CidWidths.new(500, [])} it "should return the default width" do expect(subject[1]).to eq(500) en...
dexcodeinc/pdf-reader
lib/pdf/hash.rb
<filename>lib/pdf/hash.rb # coding: utf-8 module PDF # This class is deprecated, please stop using it. class Hash < ::PDF::Reader::ObjectHash # :nodoc: def initialize(input) warn "DEPRECATION NOTICE: PDF::Hash has been deprecated, use PDF::Reader::ObjectHash instead" super end def version ...
dexcodeinc/pdf-reader
spec/pages_strategy_spec.rb
<reponame>dexcodeinc/pdf-reader # coding: utf-8 require File.dirname(__FILE__) + "/spec_helper" class PDF::Reader::PagesStrategy public :content_stream end describe PDF::Reader::PagesStrategy do let(:object_hash) { PDF::Reader::ObjectHash.allocate } let(:font) { PDF::Reader::Font.new(object_hash, {}) } con...
dexcodeinc/pdf-reader
spec/reference_spec.rb
<reponame>dexcodeinc/pdf-reader # coding: utf-8 require File.dirname(__FILE__) + "/spec_helper" describe PDF::Reader::Reference, "hash method" do it "should return the same hash for 2 identical objects" do one = PDF::Reader::Reference.new(1,0) two = PDF::Reader::Reference.new(1,0) expect(one.hash).to ...
dexcodeinc/pdf-reader
spec/support/core_ext.rb
# coding: utf-8 class Array def to_h Hash[*self.flatten] end end
dexcodeinc/pdf-reader
lib/pdf/reader/filter/ascii_hex.rb
# coding: utf-8 # class PDF::Reader module Filter # :nodoc: # implementation of the AsciiHex stream filter class AsciiHex def initialize(options = {}) @options = options end ################################################################################ # Decode the specified...
dexcodeinc/pdf-reader
spec/reader/filter/lzw_spec.rb
<filename>spec/reader/filter/lzw_spec.rb # coding: utf-8 require File.dirname(__FILE__) + "/../../spec_helper" describe PDF::Reader::Filter::Lzw do it "should filter a lzw stream with no predictors correctly" do filter = PDF::Reader::Filter::Lzw.new compressed_data = binread(File.dirname(__FILE__) + "/../...
dexcodeinc/pdf-reader
spec/width_calculator/composite_spec.rb
# coding: utf-8 require "spec_helper" describe PDF::Reader::WidthCalculator::Composite do it_behaves_like "a WidthCalculator duck type" do let!(:font) { double(:cid_default_width => 50, :cid_widths => [10,[30,40]]) } subject { PDF:...
dexcodeinc/pdf-reader
spec/parser_spec.rb
# coding: utf-8 require File.dirname(__FILE__) + "/spec_helper" describe PDF::Reader::Parser do include ParserHelper include EncodingHelper it "should parse a name correctly" do expect(parse_string("/James").parse_token).to eql(:James) expect(parse_string("/A;Name_With-Various***Characters?").parse_tok...
dexcodeinc/pdf-reader
lib/pdf/reader/synchronized_cache.rb
<filename>lib/pdf/reader/synchronized_cache.rb # encoding: utf-8 # utilities.rb : General-purpose utility classes which don't fit anywhere else # # Copyright August 2012, <NAME>. All Rights Reserved. # # This is free software. Please see the LICENSE and COPYING files for details. # # This was originally written for th...
dexcodeinc/pdf-reader
spec/font_descriptor_spec.rb
<gh_stars>0 # coding: utf-8 require "spec_helper" describe PDF::Reader::FontDescriptor, "initialisation" do let!(:dict) do { :Ascent => 10, :Descent => 10, :MissingWidth => 500, :FontBBox => [0, 0, 10, 10], :AvgWidth => 40, :CapHeight => 30, :Flags...
leahjs/my-reminder-app
app/models/appointmentreminder.rb
<filename>app/models/appointmentreminder.rb<gh_stars>0 class Appointmentreminder < ActiveRecord::Base end
leahjs/my-reminder-app
app/views/appointmentreminders/index.json.jbuilder
json.array!(@appointmentreminders) do |appointmentreminder| json.extract! appointmentreminder, :id json.url appointmentreminder_url(appointmentreminder, format: :json) end
dylanahsmith/resque
lib/resque/coder.rb
module Resque class EncodeException < StandardError; end class DecodeException < StandardError; end class Coder # Given a Ruby object, returns a string suitable for storage in a # queue. def encode(object) raise EncodeException end # alias for encode def dump(object) encode(o...
dylanahsmith/resque
test/resque_test.rb
require 'test_helper' describe "Resque" do include Test::Unit::Assertions before do Resque.redis.flushall Resque.push(:people, { 'name' => 'chris' }) Resque.push(:people, { 'name' => 'bob' }) Resque.push(:people, { 'name' => 'mark' }) @original_redis = Resque.redis end after do Resqu...
dylanahsmith/resque
lib/resque/multi_json_coder.rb
<gh_stars>1-10 require 'multi_json' require 'resque/coder' # OkJson won't work because it doesn't serialize symbols # in the same way yajl and json do. if MultiJson.respond_to?(:adapter) raise "Please install the yajl-ruby or json gem" if MultiJson.adapter.to_s == 'MultiJson::Adapters::OkJson' elsif MultiJson.respo...
dylanahsmith/resque
lib/resque/version.rb
<gh_stars>100-1000 module Resque Version = VERSION = '1.20.0' end
dylanahsmith/resque
lib/resque/failure/airbrake.rb
begin require 'airbrake' rescue LoadError raise "Can't find 'airbrake' gem. Please add it to your Gemfile or install it." end require 'resque/failure/thoughtbot' module Resque module Failure class Airbrake < Base include Resque::Failure::Thoughtbot @klass = ::Airbrake end end end
JMuscutt/cwe-library-notifications
app/models/record_mailer.rb
<reponame>JMuscutt/cwe-library-notifications<gh_stars>0 # -*- encoding : utf-8 -*- # Only works for documents with a #to_marc right now. class RecordMailer < ActionMailer::Base def email_record(documents, details, url_gen_params) #raise ArgumentError.new("RecordMailer#email_record only works with documents with...
JMuscutt/cwe-library-notifications
app/models/article_facet.rb
# Represents a facet for article searches class ArticleFacet attr_reader :title, :values # Create a new facet def initialize title @title = title @values = Array.new end # Add a new value to an existing facet def add_value value, action, count tmp = Hash.new tmp...
JMuscutt/cwe-library-notifications
app/controllers/cover_images_controller.rb
# A controller that fetches cover images from OpenLibrary and # caches them using the ActiveRecord model module CoverImagesController require 'net/http' # Returns a URL if it can find a cover image for the document # Otherwise returns false def cover_image_url_for document cover = CoverImage.fi...
JMuscutt/cwe-library-notifications
app/helpers/article_helper.rb
# Helper functions for displaying journal/news articles module ArticleHelper def display_article_type(original_string) article_type = original_string.capitalize unless article_type.include? 'article' article_type += ' article' end return article_type end end
JMuscutt/cwe-library-notifications
app/models/user_fingerprint.rb
<gh_stars>0 class UserFingerprint < ActiveRecord::Base visitable validates_uniqueness_of :visit_id end
JMuscutt/cwe-library-notifications
test/models/user_test.rb
require 'test_helper' class UserTest < ActiveSupport::TestCase fixtures :user # test "the truth" do # assert true # end end
JMuscutt/cwe-library-notifications
app/models/article.rb
<filename>app/models/article.rb # Journal and newspaper articles taken from an external API class Article < SolrDocument # attr_reader :abstract, :authors, :db, :id, :journal, :title, :type, :url, :year PROXY_PREFIX = 'http://ezproxy.libweb.linnbenton.edu:2048/login?url=' def extract_data_from record ...
JMuscutt/cwe-library-notifications
test/models/eds_connection_test.rb
<reponame>JMuscutt/cwe-library-notifications require 'test_helper' require 'securerandom' require 'pp' class TestConnectionHandler < EDSApi::ConnectionHandler def initialize @session_token = SecureRandom.hex @auth_token = SecureRandom.hex end end class TestEdsConnection < EdsConnection att...
JMuscutt/cwe-library-notifications
db/migrate/20151231230715_create_cover_images.rb
class CreateCoverImages < ActiveRecord::Migration def change create_table :cover_images do |t| t.string :isbn t.string :thumbnail_url t.string :full_url t.string :solr_id t.string :oclc_number t.string :lccn t.timestamps null: false end end end
JMuscutt/cwe-library-notifications
test/models/article_search_test.rb
<reponame>JMuscutt/cwe-library-notifications require 'test_helper' class ArticleSearchTest < ActiveSupport::TestCase test "Article Search search_opts method returns an array" do a = ArticleSearch.new 'soap opera', 3, [], nil assert_instance_of Array, a.search_opts end end
JMuscutt/cwe-library-notifications
app/models/metadata_view_fingerprint.rb
<reponame>JMuscutt/cwe-library-notifications class MetadataViewFingerprint < ActiveRecord::Base end
JMuscutt/cwe-library-notifications
app/validators/url_validator.rb
<reponame>JMuscutt/cwe-library-notifications # Checks that URLs stored in the Database actually work class UrlValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) begin response = Net::HTTP.get_response(URI.parse(value)) rescue record.errors[attr...
JMuscutt/cwe-library-notifications
app/controllers/application_controller.rb
class ApplicationController < ActionController::Base require 'ebsco-discovery-service-api' require 'openssl' # Adds a few additional behaviors into the application controller include Blacklight::Controller layout 'blacklight' # Prevent CSRF attacks by raising an exception. # For APIs, you may want to ...
JMuscutt/cwe-library-notifications
app/helpers/format_helper.rb
# Methods that help figure out what formats the user is interested in # # Doesn't really help with views at all, so this should move module FormatHelper include BlacklightHelper def show_all_formats? return request.parameters[:show_articles] == 'true' ? true : false end def show_only_articles?...
JMuscutt/cwe-library-notifications
db/migrate/20170406175912_add_index_to_cover_images.rb
class AddIndexToCoverImages < ActiveRecord::Migration def change add_index :cover_images, :solr_id, :unique => true end end
JMuscutt/cwe-library-notifications
app/models/article_search.rb
<reponame>JMuscutt/cwe-library-notifications # Represents a search request in the external articles API and its response class ArticleSearch < Search require 'erb' include ERB::Util attr_reader :articles, :facets, :search_opts def enough_data_exists_in(record) return true end # Create ...
JMuscutt/cwe-library-notifications
app/models/search_fingerprint.rb
class SearchFingerprint < ActiveRecord::Base visitable after_create :create_user_fingerprint private def create_user_fingerprint unless self.visit.nil? if self.visit.has_attribute? 'id' fingerprint_already_exists = UserFingerprint.find_by_visit_id(self.visit.id) unless fingerprint_a...
JMuscutt/cwe-library-notifications
db/migrate/20170310223711_create_metadata_view_fingerprints.rb
<filename>db/migrate/20170310223711_create_metadata_view_fingerprints.rb<gh_stars>0 class CreateMetadataViewFingerprints < ActiveRecord::Migration def change create_table :metadata_view_fingerprints do |t| t.text :document_id t.text :database_code t.timestamps null: false end end end
JMuscutt/cwe-library-notifications
app/models/eds_connection.rb
<reponame>JMuscutt/cwe-library-notifications require 'openssl' # Connect to an external API to get some articles class EdsConnection < ArticleConnection # Create an initial connection to the API def initialize @auth_method = :ip @raw_connection = EDSApi::ConnectionHandler.new(2) if using_uid_auth? ...
JMuscutt/cwe-library-notifications
db/migrate/20170310223240_create_user_fingerprints.rb
class CreateUserFingerprints < ActiveRecord::Migration def change create_table :user_fingerprints do |t| t.boolean :on_campus t.boolean :in_district t.boolean :localhost t.boolean :bot_visitor t.text :postal_code t.references :visit, type: :uuid, index: { unique: true } ...
JMuscutt/cwe-library-notifications
app/models/cover_image.rb
<filename>app/models/cover_image.rb # A model to store cover images class CoverImage < ActiveRecord::Base extend ActiveModel::Callbacks include ActiveModel::Validations include ActiveModel::Validations::Callbacks before_validation :check_for_redirection validates :solr_id, presence: true valida...
JMuscutt/cwe-library-notifications
test/helpers/article_helper_test.rb
require 'test_helper' require Rails.root.join('app', 'helpers', 'data_field_helper').to_s include DataFieldHelper class ArticleHelperTest < ActionView::TestCase test "Article type is a string" do assert_kind_of String, display_article_type('Journal') end end
JMuscutt/cwe-library-notifications
test/helpers/representative_image_helper_test.rb
require 'test_helper' class RepresentativeImageHelperTest < ActionView::TestCase test "Article icon is a file and exists" do assert Rails.root.join('app', 'assets', 'images', format_icon_path('Article')).exist? end test "Representative Image Helper provides a link to the article icon" do article_doc = ...
JMuscutt/cwe-library-notifications
app/helpers/data_field_helper.rb
<reponame>JMuscutt/cwe-library-notifications # These helpers help with extracting and formatting # data about Solr documents and Article API data module DataFieldHelper include ActionView::Helpers::TextHelper require 'uri' # Make sure that this is an array def field_to_array(value) value_arr =...
JMuscutt/cwe-library-notifications
lib/tasks/findit.rake
namespace :findit do desc "Install Find It" task :install do Bundler.with_clean_env do sh "bundle install" end sh 'rails generate blacklight:assets -s' sh 'rails generate blacklight:user -s' sh 'rails generate devise:install -s' sh 'rake db:migrate RAI...
JMuscutt/cwe-library-notifications
app/models/worldcat_connection.rb
<gh_stars>0 # Connect to an external API to get some articles class WorldcatConnection < ArticleConnection # Create an initial connection to the API def initialize end def ready? end # Fetch a single article from the external API def retrieve_single_article db, id end def send_search search_opts ...
JMuscutt/cwe-library-notifications
db/migrate/20170310211333_create_search_fingerprints.rb
<reponame>JMuscutt/cwe-library-notifications class CreateSearchFingerprints < ActiveRecord::Migration def change create_table :search_fingerprints do |t| t.text :query_string t.text :facets_used t.boolean :known_item t.integer :page t.references :visit, type: :uuid t.timestamp...
JMuscutt/cwe-library-notifications
test/helpers/data_field_helper_test.rb
<filename>test/helpers/data_field_helper_test.rb require 'test_helper' class DataFieldHelperTest < ActionView::TestCase data_strings = YAML::load_file Rails.root.join('test', 'fixtures', 'data_strings.yml') test "Convert a string into an array" do assert_kind_of Array, field_to_array("A Magical String") end...
JMuscutt/cwe-library-notifications
test/helpers/access_options_helper_test.rb
<filename>test/helpers/access_options_helper_test.rb require 'test_helper' class AccessOptionsHelperTest < ActionView::TestCase setup :initialize_vars test "full text access link is a link" do assert is_valid_link display_fulltext_access_link('http://linnbenton.edu') end test "access options for documents...
JMuscutt/cwe-library-notifications
test/helpers/citation_helper_test.rb
require 'test_helper' class CitationHelperTest < ActionView::TestCase setup :initialize_vars test "Test that citations are being returned with 1 element in parseable HTML" do citations_generated = generate_citations(@short_document) citations_generated.each do |val| assert Nokogiri::HTML.parse(val[...
JMuscutt/cwe-library-notifications
test/models/cover_image_test.rb
<gh_stars>0 require 'test_helper' class CoverImageTest < ActiveSupport::TestCase test "Can't cache a cover image without a solr id" do cover = CoverImage.new thumbnail_url: 'https://covers.openlibrary.org/b/oclc/428817148-M.jpg' assert_not cover.valid? end test "Can't cache a cover image wi...
JMuscutt/cwe-library-notifications
db/schema.rb
<filename>db/schema.rb<gh_stars>0 # encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb d...
JMuscutt/cwe-library-notifications
test/helpers/library_holdings_helper_test.rb
require 'test_helper' # A class of tests for displaying availability data from the ILS # # Note that many of these rely on very specific titles from LBCC's collection class LibraryHoldingsHelperTest < ActionView::TestCase setup :set_session_var test "simple_library_holdings is parseable HTML" do assert Nokog...
JMuscutt/cwe-library-notifications
test/test_helper.rb
require 'coveralls' Coveralls.wear! require 'erb' include ERB::Util ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. #fixtures :all ...
JMuscutt/cwe-library-notifications
app/helpers/citation_helper.rb
<reponame>JMuscutt/cwe-library-notifications # Functions related to citations, which might be a bit more sophisticated # than simple view helpers and should therefore probably be eventually moved # into model/controller module CitationHelper include BlacklightHelper include ActionView::Helpers::TextHelper ...
JMuscutt/cwe-library-notifications
app/models/article_connection.rb
<filename>app/models/article_connection.rb # Connect to an external API to get some articles class ArticleConnection # Create an initial connection to the API def initialize end def ready? end # Fetch a single article from the external API def retrieve_single_article db, id puts db + id end def...
JMuscutt/cwe-library-notifications
app/models/user.rb
<filename>app/models/user.rb class User < ActiveRecord::Base if Blacklight::Utils.needs_attr_accessible? attr_accessible :email, :password, :password_confirmation end # Connects this user object to Blacklights Bookmarks. include Blacklight::User # Include default devise modules. Others available are: #...
JMuscutt/cwe-library-notifications
app/helpers/library_holdings_helper.rb
<gh_stars>0 # Displays real-time availability information from the ILS module LibraryHoldingsHelper # Returns an HTML representation of the library's holdings attached to a bib record identified by tcn parameter def display_simple_library_holdings tcn display_library_holdings = '' stat = get_st...
JMuscutt/cwe-library-notifications
app/models/search_builder.rb
# frozen_string_literal: true class SearchBuilder < Blacklight::SearchBuilder include Blacklight::Solr::SearchBuilderBehavior include BlacklightRangeLimit::RangeLimitBuilder end
JMuscutt/cwe-library-notifications
app/helpers/representative_image_helper.rb
<reponame>JMuscutt/cwe-library-notifications<filename>app/helpers/representative_image_helper.rb module RepresentativeImageHelper # Generates HTML for either a cover image or format # icon, based on the requested side and identifiers from # the Solr document def display_representative_image(document, op...
JMuscutt/cwe-library-notifications
test/controllers/cover_images_controller_test.rb
<filename>test/controllers/cover_images_controller_test.rb require 'test_helper' include CoverImagesController class CoverImagesControllerTest < ActionController::TestCase test "Trying to extract identifiers from a non-existant solr field returns a blank array" do identifiers = extract_identifiers SolrDocu...
JMuscutt/cwe-library-notifications
app/controllers/articles_controller.rb
<reponame>JMuscutt/cwe-library-notifications # This controller coordinates the connection to the external API and handles all the data it returns class ArticlesController < ApplicationController after_filter :track_metadata_view, :only => :show # Create article object named @document and fill it with data ...
JMuscutt/cwe-library-notifications
app/helpers/access_options_helper.rb
<reponame>JMuscutt/cwe-library-notifications<gh_stars>0 # Methods that help show users how they can access materials from the Library module AccessOptionsHelper include BlacklightHelper require 'nokogiri' require 'open-uri' require 'uri' # Display how a user can access the resource described in the...
georgemillo/rocketbar_core
app/controllers/rocketbar/core/application_controller.rb
module Rocketbar module Core class ApplicationController < ActionController::Base end end end
georgemillo/rocketbar_core
lib/rocketbar/core/core.rb
<reponame>georgemillo/rocketbar_core<gh_stars>0 require "rocketbar/core/engine" module Rocketbar module Core end end
diegocharles/acts_as_commentable
test/models.rb
<reponame>diegocharles/acts_as_commentable<filename>test/models.rb class Post < ApplicationRecord acts_as_commentable end class User < ApplicationRecord end class Wall < ApplicationRecord acts_as_commentable :public, :private end
diegocharles/acts_as_commentable
test/schema.rb
ActiveRecord::Schema.define(:version => 0) do create_table :posts do |t| t.text :text t.datetime :created_at t.datetime :updated_at end create_table :users do |u| u.string :name end create_table :walls do |w| w.string :name end create_table :comments do |t| t.string :title, :lim...
logicminds/puppet-debugger-graph
lib/debugger/graph/version.rb
module Debugger module Graph VERSION = "0.1.0" end end
logicminds/puppet-debugger-graph
spec/input_responders/graph_spec.rb
require 'spec_helper' require 'puppet-debugger' require 'puppet-debugger/plugin_test_helper' describe :graph do include_examples "plugin_tests" let(:args) { [] } it 'works' do plugin.create_graph_content # plugin.handle_input("file{'/tmp/test': }") # expect(output.string).to eq('sdafsda') end end...
logicminds/puppet-debugger-graph
lib/plugins/puppet-debugger/input_responders/graph.rb
require 'puppet-debugger/input_responder_plugin' require 'graphviz' require 'webrick' require 'fileutils' module PuppetDebugger module InputResponders class Graph < InputResponderPlugin COMMAND_WORDS = %w(graph) SUMMARY = 'Graph out the catalog in GraphViz format' COMMAND_GROUP = :tools at...
logicminds/puppet-debugger-graph
lib/debugger/graph.rb
require "debugger/graph/version" module Debugger module Graph # Your code goes here... end end