source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/user.rb
Ruby
mit
44
main
891
# frozen_string_literal: true require 'net/http' module Openfoodfacts class User < Hashie::Mash class << self # Login # def login(user_id, password, locale: DEFAULT_LOCALE, domain: DEFAULT_DOMAIN) path = 'cgi/session.pl' uri = URI("https://#{locale}.#{domain}/#{path}") ...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/packaging.rb
Ruby
mit
44
main
718
# frozen_string_literal: true require 'hashie' module Openfoodfacts class Packaging < Hashie::Mash # TODO: Add more locales LOCALE_PATHS = { 'fr' => 'conditionnements', 'uk' => 'packaging', 'us' => 'packaging', 'world' => 'packaging' }.freeze class << self # Get packag...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/number_of_ingredients.rb
Ruby
mit
44
main
789
# frozen_string_literal: true require 'hashie' module Openfoodfacts class NumberOfIngredients < Hashie::Mash # TODO: Add more locales LOCALE_PATHS = { 'fr' => 'nombres-d-ingredients', 'uk' => 'numbers-of-ingredients', 'us' => 'numbers-of-ingredients', 'world' => 'numbers-of-ingredien...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/allergen.rb
Ruby
mit
44
main
709
# frozen_string_literal: true require 'hashie' module Openfoodfacts class Allergen < Hashie::Mash # TODO: Add more locales LOCALE_PATHS = { 'fr' => 'allergenes', 'uk' => 'allergens', 'us' => 'allergens', 'world' => 'allergens' }.freeze class << self # Get allergens ...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/last_edit_date.rb
Ruby
mit
44
main
770
# frozen_string_literal: true require 'hashie' module Openfoodfacts class LastEditDate < Hashie::Mash # TODO: Add more locales LOCALE_PATHS = { 'fr' => 'dates-de-derniere-modification', 'uk' => 'last-edit-dates', 'us' => 'last-edit-dates', 'world' => 'last-edit-dates' }.freeze ...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/contributor.rb
Ruby
mit
44
main
729
# frozen_string_literal: true require 'hashie' module Openfoodfacts class Contributor < Hashie::Mash # TODO: Add more locales LOCALE_PATHS = { 'fr' => 'contributeurs', 'uk' => 'contributors', 'us' => 'contributors', 'world' => 'contributors' }.freeze class << self # Ge...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/category.rb
Ruby
mit
44
main
713
# frozen_string_literal: true require 'hashie' module Openfoodfacts class Category < Hashie::Mash # TODO: Add more locales LOCALE_PATHS = { 'fr' => 'categories', 'uk' => 'categories', 'us' => 'categories', 'world' => 'categories' }.freeze class << self # Get categories...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/label.rb
Ruby
mit
44
main
687
# frozen_string_literal: true require 'hashie' module Openfoodfacts class Label < Hashie::Mash # TODO: Add more locales LOCALE_PATHS = { 'fr' => 'labels', 'uk' => 'labels', 'us' => 'labels', 'world' => 'labels' }.freeze class << self # Get labels # def all(...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/press.rb
Ruby
mit
44
main
1,253
# frozen_string_literal: true require 'hashie' require 'nokogiri' require 'time' module Openfoodfacts class Press < Hashie::Mash # TODO: Add more locales LOCALE_PATHS = { 'fr' => 'revue-de-presse-fr' }.freeze LOCALE_DATE_FORMATS = { 'fr' => '%d/%m/%Y' }.freeze class << self ...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/mission.rb
Ruby
mit
44
main
1,848
# frozen_string_literal: true require 'hashie' module Openfoodfacts class Mission < Hashie::Mash # TODO: Add more locales LOCALE_PATHS = { 'fr' => 'missions', 'uk' => 'missions', 'us' => 'missions', 'world' => 'missions' }.freeze class << self def all(locale: DEFAULT_L...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/packager_code.rb
Ruby
mit
44
main
744
# frozen_string_literal: true require 'hashie' module Openfoodfacts class PackagerCode < Hashie::Mash # TODO: Add more locales LOCALE_PATHS = { 'fr' => 'codes-emballeurs', 'uk' => 'packager-codes', 'us' => 'packager-codes', 'world' => 'packager-codes' }.freeze class << self ...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/product.rb
Ruby
mit
44
main
8,438
# frozen_string_literal: true require 'cgi' require 'hashie' require 'net/http' require 'nokogiri' module Openfoodfacts class Product < Hashie::Mash # disable_warnings # TODO: Add more locales LOCALE_WEBURL_PREFIXES = { 'fr' => 'produit', 'uk' => 'product', 'us' => 'product', 'wo...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/manufacturing_place.rb
Ruby
mit
44
main
784
# frozen_string_literal: true require 'hashie' module Openfoodfacts class ManufacturingPlace < Hashie::Mash # TODO: Add more locales LOCALE_PATHS = { 'fr' => 'lieux-de-fabrication', 'uk' => 'manufacturing-places', 'us' => 'manufacturing-places', 'world' => 'manufacturing-places' ...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/country.rb
Ruby
mit
44
main
701
# frozen_string_literal: true require 'hashie' module Openfoodfacts class Country < Hashie::Mash # TODO: Add more locales LOCALE_PATHS = { 'fr' => 'pays', 'uk' => 'countries', 'us' => 'countries', 'world' => 'countries' }.freeze class << self # Get countries # ...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/locale.rb
Ruby
mit
44
main
956
# frozen_string_literal: true module Openfoodfacts class Locale < String GLOBAL = 'world' class << self # Get locales # def all(domain: DEFAULT_DOMAIN) path = 'cgi/countries.pl' url = "https://#{GLOBAL}.#{domain}/#{path}" json = Openfoodfacts.http_get(url).read ...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/ingredient.rb
Ruby
mit
44
main
712
# frozen_string_literal: true require 'hashie' module Openfoodfacts class Ingredient < Hashie::Mash # TODO: Add more locales LOCALE_PATHS = { 'fr' => 'ingredients', 'uk' => 'ingredients', 'us' => 'ingredients', 'world' => 'ingredients' }.freeze class << self # Get labe...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/trace.rb
Ruby
mit
44
main
687
# frozen_string_literal: true require 'hashie' module Openfoodfacts class Trace < Hashie::Mash # TODO: Add more locales LOCALE_PATHS = { 'fr' => 'traces', 'uk' => 'traces', 'us' => 'traces', 'world' => 'traces' }.freeze class << self # Get traces # def all(...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/brand.rb
Ruby
mit
44
main
703
# frozen_string_literal: true require 'hashie' module Openfoodfacts class Brand < Hashie::Mash # TODO: Add more locales LOCALE_PATHS = { 'fr' => 'marques', 'uk' => 'brands', 'us' => 'brands', 'world' => 'brands' }.freeze class << self # Get product brands # ...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/entry_date.rb
Ruby
mit
44
main
730
# frozen_string_literal: true require 'hashie' module Openfoodfacts class EntryDate < Hashie::Mash # TODO: Add more locales LOCALE_PATHS = { 'fr' => 'dates-d-ajout', 'uk' => 'entry-dates', 'us' => 'entry-dates', 'world' => 'entry-dates' }.freeze class << self # Get ent...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/period_after_opening.rb
Ruby
mit
44
main
775
# frozen_string_literal: true require 'hashie' module Openfoodfacts class PeriodAfterOpening < Hashie::Mash # TODO: Add more locales LOCALE_PATHS = { 'fr' => 'durees-d-utilisation-apres-ouverture', 'uk' => 'periods-after-opening', 'us' => 'periods-after-opening', 'world' => 'periods-...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/nutrition_grade.rb
Ruby
mit
44
main
768
# frozen_string_literal: true require 'hashie' module Openfoodfacts class NutritionGrade < Hashie::Mash # TODO: Add more locales LOCALE_PATHS = { 'fr' => 'notes-nutritionnelles', 'uk' => 'nutrition-grades', 'us' => 'nutrition-grades', 'world' => 'nutrition-grades' }.freeze c...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/store.rb
Ruby
mit
44
main
689
# frozen_string_literal: true require 'hashie' module Openfoodfacts class Store < Hashie::Mash # TODO: Add more locales LOCALE_PATHS = { 'fr' => 'magasins', 'uk' => 'stores', 'us' => 'stores', 'world' => 'stores' }.freeze class << self # Get stores # def al...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/city.rb
Ruby
mit
44
main
687
# frozen_string_literal: true require 'hashie' module Openfoodfacts class City < Hashie::Mash # TODO: Add more locales LOCALE_PATHS = { 'fr' => 'communes', 'uk' => 'cities', 'us' => 'cities', 'world' => 'cities' }.freeze class << self # Get cities # def all...
github
openfoodfacts/openfoodfacts-ruby
https://github.com/openfoodfacts/openfoodfacts-ruby
lib/openfoodfacts/origin.rb
Ruby
mit
44
main
695
# frozen_string_literal: true require 'hashie' module Openfoodfacts class Origin < Hashie::Mash # TODO: Add more locales LOCALE_PATHS = { 'fr' => 'origines', 'uk' => 'origins', 'us' => 'origins', 'world' => 'origins' }.freeze class << self # Get origins # d...
github
scarfacedeb/mina-unicorn
https://github.com/scarfacedeb/mina-unicorn
mina-unicorn.gemspec
Ruby
mit
45
master
784
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "mina/unicorn/version" Gem::Specification.new do |spec| spec.name = "mina-unicorn" spec.version = Mina::Unicorn::VERSION spec.authors = ["tab", "Andrew Volozhanin"] spec.email ...
github
scarfacedeb/mina-unicorn
https://github.com/scarfacedeb/mina-unicorn
lib/mina/unicorn/tasks.rb
Ruby
mit
45
master
1,021
require "mina/bundler" require "mina/deploy" require "mina/unicorn/utility" namespace :unicorn do include Mina::Unicorn::Utility set :unicorn_env, -> { fetch(:rails_env) || fetch(:rack_env) || "deployment" } set :unicorn_config, -> { "#{fetch(:current_path)}/config/unicorn.rb" } set :unicorn_pid, ...
github
scarfacedeb/mina-unicorn
https://github.com/scarfacedeb/mina-unicorn
lib/mina/unicorn/utility.rb
Ruby
mit
45
master
2,928
# Ported from: https://github.com/sosedoff/capistrano-unicorn/blob/master/lib/capistrano-unicorn/utility.rb module Mina module Unicorn module Utility def start_unicorn %{ if [ -e "#{unicorn_pid}" ]; then if #{unicorn_user} kill -0 `cat #{unicorn_pid}` > /dev/null 2>&1; then ...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
jekyll-diagrams.gemspec
Ruby
mit
45
master
2,194
# frozen_string_literal: true $LOAD_PATH << File.expand_path('lib', __dir__) require 'jekyll-diagrams/version' Gem::Specification.new do |spec| spec.name = 'jekyll-diagrams' spec.version = Jekyll::Diagrams::VERSION spec.author = 'zhustec' spec.email = 'zhustec@foxmail.com' spe...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
Rakefile
Ruby
mit
45
master
682
# frozen_string_literal: true require 'bundler/gem_helper' require 'cucumber/rake/task' require 'rspec/core/rake_task' require 'rubocop/rake_task' def docker `uname -r`.include?('Microsoft') ? 'docker.exe' : 'docker' end task default: %i[spec] Cucumber::Rake::Task.new(:features) RSpec::Core::RakeTask.new(:spec) R...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
features/support/env.rb
Ruby
mit
45
master
699
# frozen_string_literal: true lib = File.expand_path('../lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'simplecov' require 'rspec' require 'factory_bot' require 'tmpdir' require 'jekyll-diagrams' World(FactoryBot::Syntax::Methods) TEST_DIR = File.join(Dir.tmpdir, 'jekyll-diagrams-...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
features/step_definitions/jekyll-diagrams.rb
Ruby
mit
45
master
648
# frozen_string_literal: true Given('I have a file named {string} with:') do |file, content| File.write(file, content) end When('I run jekyll build') do run_jekyll end Then('the file {string} should exist') do |file| expect(File.exist?(file)).to be true end Then('I should see svg output in {string}') do |file...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
spec/jekyll-diagrams_spec.rb
Ruby
mit
45
master
480
# frozen_string_literal: true require 'spec_helper' RSpec.describe Jekyll::Diagrams do describe '.config_name' do subject { described_class.config_name } it { is_expected.to eq 'jekyll-diagrams' } end describe '.logger_topic' do subject { described_class.logger_topic } it { is_expected.to eq ...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
spec/spec_helper.rb
Ruby
mit
45
master
472
# frozen_string_literal: true require 'simplecov' require 'rspec' require 'factory_bot' require 'jekyll-diagrams' RSpec.configure do |config| config.include FactoryBot::Syntax::Methods config.before(:suite) do FactoryBot.find_definitions end end def context_with_config(config = {}) config = { quiet...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
spec/jekyll-diagrams/wavedrom_renderer_spec.rb
Ruby
mit
45
master
703
# frozen_string_literal: true require 'spec_helper' RSpec.describe Jekyll::Diagrams::WavedromRenderer do subject(:renderer) do described_class.new(Liquid::ParseContext.new, '') end describe '#render_svg' do it 'call build_command' do allow(renderer).to receive(:build_command) allow(renderer...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
spec/jekyll-diagrams/mermaid_renderer_spec.rb
Ruby
mit
45
master
719
# frozen_string_literal: true require 'spec_helper' RSpec.describe Jekyll::Diagrams::MermaidRenderer do subject(:renderer) do described_class.new(Liquid::ParseContext.new, '') end describe '#render_svg' do it 'call build_command' do allow(renderer).to receive(:build_command) allow(renderer)...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
spec/jekyll-diagrams/erd_renderer_spec.rb
Ruby
mit
45
master
1,326
# frozen_string_literal: true require 'spec_helper' RSpec.describe Jekyll::Diagrams::ErdRenderer do subject(:renderer) do described_class.new(Liquid::ParseContext.new, '') end describe '#render_svg' do it 'call build_command' do allow(renderer).to receive(:build_command) allow(renderer).to ...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
spec/jekyll-diagrams/basic_renderer_spec.rb
Ruby
mit
45
master
1,959
# frozen_string_literal: true require 'spec_helper' RSpec.describe Jekyll::Diagrams::BasicRenderer do describe '.render' do it 'create an instance and render' do allow(described_class).to receive_message_chain(:new, :render) described_class.render('context', 'content', { key: 'value' }) expe...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
spec/jekyll-diagrams/plantuml_renderer_spec.rb
Ruby
mit
45
master
751
# frozen_string_literal: true require 'spec_helper' RSpec.describe Jekyll::Diagrams::PlantUMLRenderer do subject(:renderer) do described_class.new(Liquid::ParseContext.new, '') end describe '#render_svg' do it 'call build_command' do allow(renderer).to receive(:build_command) allow(renderer...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
spec/jekyll-diagrams/blockdiag_renderer_spec.rb
Ruby
mit
45
master
1,328
# frozen_string_literal: true require 'spec_helper' RSpec.describe Jekyll::Diagrams::BlockdiagRenderer do subject(:renderer) do described_class.new(Liquid::ParseContext.new, '') end describe '#render_svg' do it 'call build_command' do allow(renderer).to receive(:build_command) allow(rendere...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
spec/jekyll-diagrams/graphviz_renderer_spec.rb
Ruby
mit
45
master
1,077
# frozen_string_literal: true require 'spec_helper' RSpec.describe Jekyll::Diagrams::GraphvizRenderer do subject(:renderer) do described_class.new(Liquid::ParseContext.new, '') end describe '#render_svg' do it 'call build_command' do allow(renderer).to receive(:build_command) allow(renderer...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
spec/jekyll-diagrams/smcat_renderer_spec.rb
Ruby
mit
45
master
733
# frozen_string_literal: true require 'spec_helper' RSpec.describe Jekyll::Diagrams::SMCatRenderer do subject(:renderer) do described_class.new(Liquid::ParseContext.new, '') end describe '#render_svg' do it 'call build_command' do allow(renderer).to receive(:build_command) allow(renderer).t...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
spec/jekyll-diagrams/rendering_spec.rb
Ruby
mit
45
master
3,358
# frozen_string_literal: true require 'spec_helper' RSpec.describe Jekyll::Diagrams::Rendering do describe '.render_with_stdin_stdout' do it 'call render_with_command' do allow(described_class).to receive(:render_with_command) described_class.render_with_stdin_stdout('command', 'content') ex...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
spec/jekyll-diagrams/utils_spec.rb
Ruby
mit
45
master
4,150
# frozen_string_literal: true require 'spec_helper' RSpec.describe Jekyll::Diagrams::Utils do describe '.config_for' do context 'when the key is not found' do subject do described_class.config_for(context_with_config, 'not_exist_key') end it { is_expected.to eq({}) } end cont...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
spec/jekyll-diagrams/vega_renderer_spec.rb
Ruby
mit
45
master
1,083
# frozen_string_literal: true require 'spec_helper' RSpec.describe Jekyll::Diagrams::VegaRenderer do subject(:renderer) do described_class.new(Liquid::ParseContext.new, '') end describe '#render_svg' do it 'call build_command' do allow(renderer).to receive(:build_command) allow(renderer).to...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
spec/jekyll-diagrams/syntrax_renderer_spec.rb
Ruby
mit
45
master
697
# frozen_string_literal: true require 'spec_helper' RSpec.describe Jekyll::Diagrams::SyntraxRenderer do subject(:renderer) do described_class.new(Liquid::ParseContext.new, '') end describe '#render_svg' do it 'call build_command' do allow(renderer).to receive(:build_command) allow(renderer)...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
spec/jekyll-diagrams/basic_block_spec.rb
Ruby
mit
45
master
1,774
# frozen_string_literal: true require 'spec_helper' RSpec.describe Jekyll::Diagrams::BasicBlock do before do stub_const('TestBlock', Class.new(described_class)) end describe '.renderer_name' do subject { TestBlock.renderer_name } it { is_expected.to eq 'TestRenderer' } end describe '.renderer...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
spec/jekyll-diagrams/svgbob_renderer_spec.rb
Ruby
mit
45
master
889
# frozen_string_literal: true require 'spec_helper' RSpec.describe Jekyll::Diagrams::SvgbobRenderer do subject(:renderer) do described_class.new(Liquid::ParseContext.new, '') end describe '#render_svg' do it 'call build_command' do allow(renderer).to receive(:build_command) allow(renderer)....
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
spec/jekyll-diagrams/nomnoml_renderer_spec.rb
Ruby
mit
45
master
697
# frozen_string_literal: true require 'spec_helper' RSpec.describe Jekyll::Diagrams::NomnomlRenderer do subject(:renderer) do described_class.new(Liquid::ParseContext.new, '') end describe '#render_svg' do it 'call build_command' do allow(renderer).to receive(:build_command) allow(renderer)...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams.rb
Ruby
mit
45
master
986
# frozen_string_literal: true require 'jekyll' require_relative 'jekyll-diagrams/errors' require_relative 'jekyll-diagrams/utils' require_relative 'jekyll-diagrams/rendering' require_relative 'jekyll-diagrams/basic_renderer' require_relative 'jekyll-diagrams/basic_block' require_relative 'jekyll-diagrams/blockdiag'...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/plantuml.rb
Ruby
mit
45
master
205
# frozen_string_literal: true require_relative 'plantuml/renderer' require_relative 'plantuml/block' module Jekyll module Diagrams Liquid::Template.register_tag(:plantuml, PlantUMLBlock) end end
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/graphviz.rb
Ruby
mit
45
master
205
# frozen_string_literal: true require_relative 'graphviz/renderer' require_relative 'graphviz/block' module Jekyll module Diagrams Liquid::Template.register_tag(:graphviz, GraphvizBlock) end end
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/blockdiag.rb
Ruby
mit
45
master
311
# frozen_string_literal: true require_relative 'blockdiag/renderer' require_relative 'blockdiag/block' module Jekyll module Diagrams %i[blockdiag seqdiag actdiag nwdiag rackdiag packetdiag].each do |name| Liquid::Template.register_tag(name, const_get("#{name.capitalize}Block")) end end end
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/utils.rb
Ruby
mit
45
master
2,089
# frozen_string_literal: true module Jekyll module Diagrams module Utils module_function # Return configuration of Jekyll Diagrams # # @param context Liquid::Template # @return Configuration def configuration(context) site_config = context.registers[:site].config ...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/mermaid.rb
Ruby
mit
45
master
201
# frozen_string_literal: true require_relative 'mermaid/renderer' require_relative 'mermaid/block' module Jekyll module Diagrams Liquid::Template.register_tag(:mermaid, MermaidBlock) end end
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/syntrax.rb
Ruby
mit
45
master
201
# frozen_string_literal: true require_relative 'syntrax/renderer' require_relative 'syntrax/block' module Jekyll module Diagrams Liquid::Template.register_tag(:syntrax, SyntraxBlock) end end
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/nomnoml.rb
Ruby
mit
45
master
201
# frozen_string_literal: true require_relative 'nomnoml/renderer' require_relative 'nomnoml/block' module Jekyll module Diagrams Liquid::Template.register_tag(:nomnoml, NomnomlBlock) end end
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/basic_block.rb
Ruby
mit
45
master
744
# frozen_string_literal: true module Jekyll module Diagrams class BasicBlock < Liquid::Block def self.renderer @renderer ||= const_get(renderer_name) rescue NameError => error raise Errors::RendererNotFoundError, error.message.split(' ').last end def self.renderer_name ...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/rendering.rb
Ruby
mit
45
master
1,940
# frozen_string_literal: true require 'open3' require 'tempfile' require 'tmpdir' module Jekyll module Diagrams module Rendering module_function # Render SVG with stdin and stdout # # @param command Command to run # @param content Content passed to command # @return T...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/wavedrom.rb
Ruby
mit
45
master
205
# frozen_string_literal: true require_relative 'wavedrom/renderer' require_relative 'wavedrom/block' module Jekyll module Diagrams Liquid::Template.register_tag(:wavedrom, WavedromBlock) end end
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/errors.rb
Ruby
mit
45
master
727
# frozen_string_literal: true module Jekyll module Diagrams module Errors class BasicError < ::StandardError def initialize(val) # Jekyll::...::CommandNotFoundError -> 'CommandNotFoundError' klass = self.class.name.split('::').last # 'CommandNotFound' -> 'Command Not F...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/vega.rb
Ruby
mit
45
master
262
# frozen_string_literal: true require_relative 'vega/renderer' require_relative 'vega/block' module Jekyll module Diagrams %i[vega vegalite].each do |name| Liquid::Template.register_tag(name, const_get("#{name.capitalize}Block")) end end end
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/basic_renderer.rb
Ruby
mit
45
master
903
# frozen_string_literal: true module Jekyll module Diagrams class BasicRenderer include Rendering def self.render(context, content, options = {}) new(context, content, options).render end def initialize(context, content, options = {}) @context = context @content ...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/graphviz/renderer.rb
Ruby
mit
45
master
903
# frozen_string_literal: true module Jekyll module Diagrams class GraphvizRenderer < BasicRenderer XML_REGEX = /^<\?xml(([^>]|\n)*>\n?){2}/.freeze CONFIGRATIONS = { 'K' => 'default_layout', 'G' => 'graph_attributes', 'N' => 'node_attributes', 'E' => 'edge_attributes' ...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/erd/renderer.rb
Ruby
mit
45
master
817
# frozen_string_literal: true module Jekyll module Diagrams class ErdRenderer < BasicRenderer XML_REGEX = /^<\?xml(([^>]|\n)*>\n?){2}/.freeze CONFIGURATIONS = %w[config edge].freeze SWITCHES = { 'dot-entity' => false }.freeze def render_svg(code, config) command = b...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/nomnoml/renderer.rb
Ruby
mit
45
master
377
# frozen_string_literal: true module Jekyll module Diagrams class NomnomlRenderer < BasicRenderer def render_svg(code, config) command = build_command(config) render_with_tempfile(command, code) do |input, output| "#{input} #{output}" end end def build_comman...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/syntrax/renderer.rb
Ruby
mit
45
master
590
# frozen_string_literal: true module Jekyll module Diagrams class SyntraxRenderer < BasicRenderer CONFIGURATIONS = %w[scale style].freeze def render_svg(code, config) command = build_command(config) render_with_tempfile(command, code) do |input, output| "--input #{input} -...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/svgbob/renderer.rb
Ruby
mit
45
master
542
# frozen_string_literal: true module Jekyll module Diagrams class SvgbobRenderer < BasicRenderer CONFIGURATIONS = %w[font-family font-size scale stroke-width].freeze def render_svg(code, config) command = build_command(config) render_with_stdin_stdout(command, code) end ...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/smcat/renderer.rb
Ruby
mit
45
master
690
# frozen_string_literal: true module Jekyll module Diagrams class SMCatRenderer < BasicRenderer XML_REGEX = /^<\?xml(([^>]|\n)*>\n?){2}/.freeze CONFIGURATIONS = %w[direction engine input-type].freeze def render_svg(code, config) command = build_command(config) svg = render_wit...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/vega/renderer.rb
Ruby
mit
45
master
781
# frozen_string_literal: true module Jekyll module Diagrams %i[vega vegalite].each do |name| renderer = Class.new(BasicRenderer) do const_set :CONFIGURATIONS, %w[scale].freeze def render_svg(code, config) if @diagram == 'vegalite' code = render_with_stdin_stdout('vl2v...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/plantuml/renderer.rb
Ruby
mit
45
master
520
# frozen_string_literal: true module Jekyll module Diagrams class PlantUMLRenderer < BasicRenderer XML_REGEX = /^<\?xml([^>]|\n)*>\n?/.freeze def render_svg(code, config) command = build_command(config) svg = render_with_stdin_stdout(command, code) svg.sub!(XML_REGEX, '') ...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/mermaid/renderer.rb
Ruby
mit
45
master
754
# frozen_string_literal: true module Jekyll module Diagrams class MermaidRenderer < BasicRenderer CONFIGURATIONS = %w[theme width height backgroundColor configFile cssFile scale].freeze def render_svg(code, config) command = build_command(config) render_wit...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/wavedrom/renderer.rb
Ruby
mit
45
master
397
# frozen_string_literal: true module Jekyll module Diagrams class WavedromRenderer < BasicRenderer def render_svg(code, config) command = build_command(config) render_with_tempfile(command, code) do |input, output| "--input #{input} --svg #{output}" end end d...
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/blockdiag/block.rb
Ruby
mit
45
master
222
# frozen_string_literal: true module Jekyll module Diagrams %i[blockdiag seqdiag actdiag nwdiag rackdiag packetdiag].each do |name| const_set "#{name.capitalize}Block", Class.new(BasicBlock) end end end
github
zhustec/jekyll-diagrams
https://github.com/zhustec/jekyll-diagrams
lib/jekyll-diagrams/blockdiag/renderer.rb
Ruby
mit
45
master
1,101
# frozen_string_literal: true module Jekyll module Diagrams %i[blockdiag seqdiag actdiag nwdiag rackdiag packetdiag].each do |name| renderer = Class.new(BasicRenderer) do const_set :CONFIGURATIONS, %w[config font fontmap size].freeze const_set :SWITCHES, { 'antialias' => false ...
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
brewery_db.gemspec
Ruby
mit
45
master
956
require './lib/brewery_db/version' Gem::Specification.new do |gem| gem.name = 'brewery_db' gem.version = BreweryDB::VERSION gem.summary = 'A Ruby library for using the BreweryDB API.' gem.homepage = 'http://github.com/tylerhunt/brewery_db' gem.authors = ['Tyler Hunt', 'Steven Harman'] gem.license = 'MIT' ...
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db.rb
Ruby
mit
45
master
1,458
require 'brewery_db/version' module BreweryDB Error = Class.new(StandardError) BadRequest = Class.new(Error) NotFound = Class.new(Error) RateLimitExceeded = Class.new(Error) Unauthorized = Class.new(Error) autoload :Client, 'brewery_db/client' autoload :Collection, 'brewery_db/collection' autoload :Co...
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/web_hook.rb
Ruby
mit
45
master
747
require 'digest/sha1' module BreweryDB class WebHook attr_reader :action attr_reader :attribute attr_reader :attribute_id attr_reader :key attr_reader :nonce attr_reader :sub_action attr_reader :sub_attribute_id attr_reader :timestamp def initialize(args) @action = args[:ac...
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/config.rb
Ruby
mit
45
master
517
require 'faraday' module BreweryDB class Config BASE_URI = 'http://api.brewerydb.com/v2' USER_AGENT = "BreweryDB Ruby Gem #{BreweryDB::VERSION}" TIMEOUT = 60 attr_accessor :adapter attr_accessor :api_key attr_accessor :base_uri attr_accessor :logger attr_accessor :timeout attr_ac...
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/mash.rb
Ruby
mit
45
master
383
require 'hashie' module BreweryDB class Mash < Hashie::Mash protected def convert_key(key) key = key.to_s.dup key.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2') key.gsub!(/([a-z\d])([A-Z])/, '\1_\2') key.tr('-', '_').downcase end def convert_value(value, duping=false) value.is_a...
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/request.rb
Ruby
mit
45
master
478
module BreweryDB class Request def initialize(connection, path, params={}) @connection = connection @path = path @params = params end def response Response.new(response_body, self) end def next_page self.class.new(@connection, @path, @params.merge(p: page_number + 1...
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/paginated_collection.rb
Ruby
mit
45
master
734
module BreweryDB class PaginatedCollection < Collection include Enumerable BATCH_SIZE = 50 def count(*args, &block) # The Ruby documentation is wrong, and Enumerable#count no longer calls # #size, so let's make sure it's used here when no arguments are given. if args.empty? && !block_g...
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/collection.rb
Ruby
mit
45
master
453
module BreweryDB class Collection include Enumerable attr_reader :size alias length size def initialize(response) self.response = response end def each return to_enum unless block_given? @collection.each { |element| yield(element) } end private def response=(re...
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/response.rb
Ruby
mit
45
master
518
module BreweryDB class Response def initialize(body, request) @body = body @request = request end def data @body.data end def collection Collection.new(self) end def paginated_collection PaginatedCollection.new(self) end def next_page @reques...
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/client.rb
Ruby
mit
45
master
1,391
module BreweryDB class Client def initialize(&block) configure(&block) if block_given? end def config @config ||= Config.new end def configure yield(config) self end def beers @beers ||= Resources::Beers.new(config) end # Builds a new instance of t...
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/resource.rb
Ruby
mit
45
master
778
require 'faraday' require 'faraday_middleware' module BreweryDB class Resource def initialize(config) @config = config end private def get(path, params={}) Request.new(connection, path, params).response end def connection Faraday.new(request: { timeout: @config.timeout }) d...
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/resources/fluid_size.rb
Ruby
mit
45
master
252
module BreweryDB module Resources class FluidSize < Resource def all(params={}) get('fluidsizes', params).collection end def find(id, params={}) get('fluidsize/%s' % id, params).data end end end end
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/resources/menu.rb
Ruby
mit
45
master
279
module BreweryDB module Resources class Menu < Resource def beer_availability(params={}) get_menu('beer-availability', params).collection end private def get_menu(name, params) get("menu/#{name}", params) end end end end
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/resources/locations.rb
Ruby
mit
45
master
260
module BreweryDB module Resources class Locations < Resource def all(params={}) get('locations', params).paginated_collection end def find(id, params={}) get('location/%s' % id, params).data end end end end
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/resources/brewery.rb
Ruby
mit
45
master
298
module BreweryDB module Resources class Brewery < Resource attr_reader :id def initialize(config, options={}) @id = options[:id] super(config) end def beers(params={}) get("brewery/#{id}/beers", params).collection end end end end
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/resources/search.rb
Ruby
mit
45
master
582
module BreweryDB module Resources class Search < Resource def all(params={}) get('search', params).paginated_collection end def beers(params={}) all(params.merge(type: 'beer')) end def breweries(params={}) all(params.merge(type: 'brewery')) end ...
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/resources/breweries.rb
Ruby
mit
45
master
259
module BreweryDB module Resources class Breweries < Resource def all(params={}) get('breweries', params).paginated_collection end def find(id, params={}) get('brewery/%s' % id, params).data end end end end
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/resources/styles.rb
Ruby
mit
45
master
241
module BreweryDB module Resources class Styles < Resource def all(params={}) get('styles', params).collection end def find(id, params={}) get('style/%s' % id, params).data end end end end
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/resources/beers.rb
Ruby
mit
45
master
318
module BreweryDB module Resources class Beers < Resource def all(params={}) get('beers', params).paginated_collection end def find(id, params={}) get('beer/%s' % id, params).data end def random(params={}) find('random', params) end end end end
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/resources/categories.rb
Ruby
mit
45
master
252
module BreweryDB module Resources class Categories < Resource def all(params={}) get('categories', params).collection end def find(id, params={}) get('category/%s' % id, params).data end end end end
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/resources/hops.rb
Ruby
mit
45
master
245
module BreweryDB module Resources class Hops < Resource def all(params={}) get('hops', params).paginated_collection end def find(id, params={}) get('hop/%s' % id, params).data end end end end
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/resources/fermentables.rb
Ruby
mit
45
master
269
module BreweryDB module Resources class Fermentables < Resource def all(params={}) get('fermentables', params).paginated_collection end def find(id, params={}) get('fermentable/%s' % id, params).data end end end end
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/resources/glassware.rb
Ruby
mit
45
master
247
module BreweryDB module Resources class Glassware < Resource def all(params={}) get('glassware', params).collection end def find(id, params={}) get('glass/%s' % id, params).data end end end end
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/resources/yeasts.rb
Ruby
mit
45
master
251
module BreweryDB module Resources class Yeasts < Resource def all(params={}) get('yeasts', params).paginated_collection end def find(id, params={}) get('yeast/%s' % id, params).data end end end end
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
lib/brewery_db/middleware/error_handler.rb
Ruby
mit
45
master
835
module BreweryDB module Middleware class ErrorHandler < Faraday::Response::Middleware def on_complete(env) case env[:status] when 200 when 400 then fail with(BadRequest, env) when 401 then fail with(rate_limit_exceeded_or_unauthorized(env[:response_headers]), env) ...
github
tylerhunt/brewery_db
https://github.com/tylerhunt/brewery_db
examples/will_paginate.rb
Ruby
mit
45
master
346
# Paginate beer search results using will_paginate. query = params[:query] page = params[:page] || 1 per_page = BreweryDB::PaginatedCollection::BATCH_SIZE results = client.search.beers(q: query, p: page) count = results.count beers = WillPaginate::Collection.create(page, per_page, count) do |pager| pager.replace r...