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
sorah/clarion
https://github.com/sorah/clarion
examples/pam-u2f/pam-u2f.rb
Ruby
mit
85
master
5,595
#!/usr/bin/env ruby # Use with pam_exec(8) require 'json' require 'socket' require 'syslog' require 'uri' require 'net/http' require 'net/https' require 'fileutils' require 'digest/sha2' class ClarionClient def initialize(endpoint) @endpoint = endpoint end def create_authn(keys, name: nil, comment: nil) ...
github
sorah/clarion
https://github.com/sorah/clarion
lib/clarion/authenticator.rb
Ruby
mit
85
master
2,333
require 'base64' require 'webauthn' require 'securerandom' require 'base64' module Clarion class Authenticator class Error < StandardError; end class InvalidKey < Error; end class InvalidAssertion < Error; end def initialize(authn, counter, store, rp_id: nil, legacy_app_id: nil) @authn = authn...
github
sorah/clarion
https://github.com/sorah/clarion
lib/clarion/registrator.rb
Ruby
mit
85
master
2,131
require 'clarion/key' require 'webauthn' require 'securerandom' require 'base64' module Clarion class Registrator class Error < StandardError; end class InvalidAttestation < Error; end def initialize(counter, rp_name: 'clarion', rp_id:, user_handle: SecureRandom.base64(64), user_name: 'clarion user', di...
github
sorah/clarion
https://github.com/sorah/clarion
lib/clarion/app.rb
Ruby
mit
85
master
9,591
require 'erubis' require 'sinatra/base' require 'securerandom' require 'clarion/registrator' require 'clarion/authenticator' require 'clarion/authn' module Clarion def self.app(*args) App.rack(*args) end class App < Sinatra::Base CONTEXT_RACK_ENV_NAME = 'clarion.ctx' def self.initialize_context(co...
github
sorah/clarion
https://github.com/sorah/clarion
lib/clarion/key.rb
Ruby
mit
85
master
2,505
module Clarion class Key CIPHER_ALGO = 'aes-256-gcm' def self.from_encrypted_json(private_key, json) payload = JSON.parse(json, symbolize_names: true) encrypted_data = payload.fetch(:data).unpack('m*')[0] encrypted_shared_key = payload.fetch(:key).unpack('m*')[0] shared_key_json = pri...
github
sorah/clarion
https://github.com/sorah/clarion
lib/clarion/authn.rb
Ruby
mit
85
master
3,127
require 'time' require 'securerandom' require 'clarion/key' module Clarion class Authn STATUSES = %i(open cancelled verified expired) class << self def make(**kwargs) kwargs.delete(:id) kwargs.delete(:created_at) kwargs.delete(:status) kwargs.delete(:verified_at) ...
github
sorah/clarion
https://github.com/sorah/clarion
lib/clarion/config.rb
Ruby
mit
85
master
1,246
require 'clarion/stores' require 'clarion/counters' module Clarion class Config class << self def option(meth) options << meth end def options @options ||= [] end end def initialize(options={}) @options = options # Validation self.class.options...
github
sorah/clarion
https://github.com/sorah/clarion
lib/clarion/const_finder.rb
Ruby
mit
85
master
461
module Clarion module ConstFinder def self.find(const, prefix, name) retried = false constant_name = name.to_s.gsub(/\A.|_./) { |s| s[-1].upcase } begin const.const_get constant_name, false rescue NameError unless retried begin require "#{prefix}/#{na...
github
sorah/clarion
https://github.com/sorah/clarion
lib/clarion/counters/base.rb
Ruby
mit
85
master
266
module Clarion module Counters class Base def initialize(options={}) @options = options end def get(key) raise NotImplementedError end def store(key) raise NotImplementedError end end end end
github
sorah/clarion
https://github.com/sorah/clarion
lib/clarion/counters/dynamodb.rb
Ruby
mit
85
master
1,128
require 'aws-sdk-dynamodb' require 'clarion/counters/base' module Clarion module Counters class Dynamodb < Base def initialize(table_name:, region:) @table_name = table_name @region = region end def get(key) item = table.query( limit: 1, select: 'ALL...
github
sorah/clarion
https://github.com/sorah/clarion
lib/clarion/counters/memory.rb
Ruby
mit
85
master
549
require 'thread' require 'clarion/counters/base' module Clarion module Counters class Memory < Base def initialize(*) super @lock = Mutex.new @counters = {} end def get(key) @lock.synchronize do @counters[key.handle] end end def st...
github
sorah/clarion
https://github.com/sorah/clarion
lib/clarion/stores/base.rb
Ruby
mit
85
master
278
module Clarion module Stores class Base def initialize(options={}) @options = options end def store_authn(authn) raise NotImplementedError end def find_authn(id) raise NotImplementedError end end end end
github
sorah/clarion
https://github.com/sorah/clarion
lib/clarion/stores/memory.rb
Ruby
mit
85
master
547
require 'thread' require 'clarion/stores/base' require 'clarion/authn' module Clarion module Stores class Memory < Base def initialize(*) super @lock = Mutex.new @store = {} end def store_authn(authn) @lock.synchronize do @store[authn.id] = authn.to_h(...
github
sorah/clarion
https://github.com/sorah/clarion
lib/clarion/stores/s3.rb
Ruby
mit
85
master
1,275
require 'aws-sdk-s3' require 'clarion/stores/base' module Clarion module Stores class S3 < Base def initialize(region:, bucket:, prefix: nil, retry_interval: 0.1, retry_max: 10) @region = region @bucket = bucket @prefix = prefix @retry_interval = retry_interval @retr...
github
sorah/clarion
https://github.com/sorah/clarion
spec/spec_helper.rb
Ruby
mit
85
master
363
require "bundler/setup" require "clarion" RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" # Disable RSpec exposing methods globally on `Module` and `main` config.disable_monkey_patching! config.expect_with :rsp...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
sass-embedded.gemspec
Ruby
mit
85
main
1,784
# frozen_string_literal: true require_relative 'lib/sass/embedded/version' Gem::Specification.new do |spec| spec.name = 'sass-embedded' spec.version = Sass::Embedded::VERSION spec.authors = ['なつき'] spec.email = ['i@ntk.me'] spec.summary = 'Use dart-sass with Ruby!' spec....
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
Gemfile
Ruby
mit
85
main
283
# frozen_string_literal: true source 'https://rubygems.org' gemspec group :development do gem 'rake', '>= 13' gem 'rspec', '~> 3.13.0' gem 'rubocop', '~> 1.86.0' gem 'rubocop-performance', '~> 1.26.0' gem 'rubocop-rake', '~> 0.7.1' gem 'rubocop-rspec', '~> 3.9.0' end
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
Rakefile
Ruby
mit
85
main
762
# frozen_string_literal: true require 'bundler/gem_tasks' require 'rspec/core/rake_task' require 'rubocop/rake_task' task default: %i[compile rubocop spec] desc 'Compile all the extensions' task :compile do sh 'rake', '-C', 'ext/sass', 'clobber', 'install' if ENV.key?('ext_platform') && ENV['ext_platform'] != '...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass_proto_spec.rb
Ruby
mit
85
main
5,452
# frozen_string_literal: true require 'spec_helper' RSpec.describe Sass do def remote_eq(lhs, rhs) result = nil Sass.compile_string( '$_: yield(lhs()==rhs());', functions: { 'yield($value)' => lambda { |args| result = args[0].assert_boolean.to_bool Sass::Value::Null::...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sandbox.rb
Ruby
mit
85
main
925
# frozen_string_literal: true require 'fileutils' require 'tmpdir' require 'uri' module Sandbox def sandbox Dir.mktmpdir do |dir| yield SandboxDirectory.new(dir) end end class SandboxDirectory attr_accessor :root def initialize(root) @root = root end def path(*paths) ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass_logger_spec.rb
Ruby
mit
85
main
6,063
# frozen_string_literal: true require 'spec_helper' # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/logger.node.test.ts # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/logger.test.ts RSpec.describe Sass do it 'emits debug to stderr by default' do stdio = capture_stdio do desc...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass_importer_spec.rb
Ruby
mit
85
main
29,922
# frozen_string_literal: true require 'spec_helper' # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/importer.node.test.ts # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/importer.test.ts RSpec.describe Sass do it 'uses an importer to resolve a @use' do result = described_class.comp...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass_deprecations_spec.rb
Ruby
mit
85
main
979
# frozen_string_literal: true require 'spec_helper' # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/deprecations.test.ts RSpec.describe Sass do describe 'a warning' do it 'is not emitted when deprecation id silenced' do stdio = capture_stdio do described_class.compile_string( ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/console.rb
Ruby
mit
85
main
438
# frozen_string_literal: true require 'stringio' module Console def capture_stdio stdout = $stdout $stdout = StringIO.new stderr = $stderr $stderr = StringIO.new yield ConsoleOutput.new $stdout.string, $stderr.string ensure $stdout = stdout $stderr = stderr end class Console...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass_compile_spec.rb
Ruby
mit
85
main
15,850
# frozen_string_literal: true require 'spec_helper' # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/compile.node.test.ts # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/compile.test.ts RSpec.describe Sass do describe '.compile_string' do describe 'success' do describe 'input'...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass_function_spec.rb
Ruby
mit
85
main
6,082
# frozen_string_literal: true require 'spec_helper' # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/function.test.ts RSpec.describe Sass do it 'passes an argument to a custom function and uses its return value' do fn = double allow(fn).to receive(:call) { |args| expect(args.length).to e...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/spec_helper.rb
Ruby
mit
85
main
1,888
# frozen_string_literal: true require 'sass-embedded' require 'json' require_relative 'console' require_relative 'sandbox' RSpec.configure do |config| config.color_mode = :on if ENV['GITHUB_ACTIONS'] == 'true' config.formatter = :documentation config.include Console config.include Sandbox end RSpec::Matche...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass_info_spec.rb
Ruby
mit
85
main
695
# frozen_string_literal: true require 'spec_helper' RSpec.describe Sass do describe '.info' do let(:identifier) do 'sass-embedded' end it 'begins with a unique identifier for the Sass implementation' do expect(described_class.info).to start_with(identifier) end it 'followed by U+00...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/elf_spec.rb
Ruby
mit
85
main
1,190
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Sass::ELF', skip: (Sass.const_defined?(:ELF) ? false : 'Sass::ELF is not available') do let(:described_class) do Sass.const_get(:ELF) end describe 'ruby', skip: (File.exist?('/proc/self/exe') ? false : 'procfs is not available') do it ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/compile_error_spec.rb
Ruby
mit
85
main
2,841
# frozen_string_literal: true require 'spec_helper' RSpec.describe Sass::CompileError do describe '.to_css' do describe 'generates valid css for error message' do it 'without quotes' do expect { Sass.compile_string('a { b:') } .to raise_error(described_class) do |error| expec...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/fork_tracker_spec.rb
Ruby
mit
85
main
4,326
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Sass::ForkTracker', skip: (Process.respond_to?(:fork) ? false : 'Process.fork is not usable') do let(:described_class) do Sass.const_get(:ForkTracker) end it 'tracks global compiler process' do Sass.compile_string('a { b: c }') ex...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/compiler_spec.rb
Ruby
mit
85
main
4,569
# frozen_string_literal: true require 'spec_helper' # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/compiler.node.test.ts # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/compiler.test.ts RSpec.describe Sass::Compiler do subject!(:compiler) do described_class.new end after do ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/gem_package_importer_spec.rb
Ruby
mit
85
main
2,133
# frozen_string_literal: true require 'spec_helper' RSpec.describe Sass::GemPackageImporter do around do |example| require 'bundler/inline' sandbox do |dir| bytes = if Gem.win_platform? [*32..127] - '<>:"/\|?*'.unpack('C*') else (1..127) end...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/value/string_spec.rb
Ruby
mit
85
main
5,004
# frozen_string_literal: true require 'spec_helper' # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/value/string.test.ts describe Sass::Value::String do describe 'construction' do it 'creates a quoted string with the given text' do string = described_class.new('nb', quoted: true) expe...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/value/argument_list_spec.rb
Ruby
mit
85
main
6,157
# frozen_string_literal: true require 'spec_helper' # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/value/argument-list.test.ts describe Sass::Value::ArgumentList do it 'passes an argument list' do fn = double allow(fn).to receive(:call) { |args| expect(args.length).to eq(1) expec...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/value/color_legacy_spec.rb
Ruby
mit
85
main
13,555
# frozen_string_literal: true require 'spec_helper' require_relative 'color/constructors' describe Sass::Value::Color do # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/value/color/legacy.test.ts describe 'Legacy Color' do def legacy_rgb(...) ColorConstructors.legacy_rgb(...) end ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/value/list_spec.rb
Ruby
mit
85
main
11,355
# frozen_string_literal: true require 'spec_helper' # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/value/list.test.ts describe Sass::Value::List do describe 'construction' do subject(:list) do described_class.new( [Sass::Value::String.new('a'), Sass::Value::String.new('b'), Sass::V...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/value/color_4_conversions_spec.rb
Ruby
mit
85
main
7,063
# frozen_string_literal: true require 'spec_helper' require_relative 'color/spaces' require_relative 'color/interpolation_examples' describe Sass::Value::Color do # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/value/color/color-4-conversions.test.ts describe 'Color 4 Conversions' do COLOR_SPA...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/value/calculation_spec.rb
Ruby
mit
85
main
13,061
# frozen_string_literal: true require 'spec_helper' # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/value/calculation.test.ts describe Sass::Value::Calculation do let(:valid_calculation_values) do [ Sass::Value::Number.new(1), Sass::Value::String.new('1', quoted: false), describ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/value/mixin_spec.rb
Ruby
mit
85
main
2,163
# frozen_string_literal: true require 'spec_helper' # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/value/mixin.test.ts describe Sass::Value::Mixin do it 'can round-trip a mixin reference from Sass' do fn = double allow(fn).to receive(:call) { |args| expect(args.length).to eq(1) v...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/value/color_4_channels_spec.rb
Ruby
mit
85
main
9,911
# frozen_string_literal: true require 'spec_helper' require_relative 'color/spaces' require_relative 'color/utils' describe Sass::Value::Color do # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/value/color/color-4-channels.test.ts describe 'Color 4 Channels' do COLOR_SPACES.each_value do |spac...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/value/boolean_spec.rb
Ruby
mit
85
main
2,197
# frozen_string_literal: true require 'spec_helper' # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/value/boolean.test.ts describe Sass::Value::Boolean do describe 'sassTrue' do subject(:value) do Sass::Value::Boolean::TRUE end it 'is truthy' do expect(value.to_bool).to be(tr...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/value/string_to_s_spec.rb
Ruby
mit
85
main
3,164
# frozen_string_literal: true require 'spec_helper' describe Sass::Value::String do describe '.to_s' do describe 'serialize quoted string' do let(:whitespace) do " \t\r\n\v\f".chars.repeated_permutation(3).map(&:join) end let(:cntrl) do [*"\x01".."\x1F", "\x7F"].repeated_permu...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/value/null_spec.rb
Ruby
mit
85
main
1,147
# frozen_string_literal: true require 'spec_helper' # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/value/null.test.ts describe Sass::Value::Null do subject(:value) do Sass::Value::Null::NULL end it 'is falsey' do expect(value.to_bool).to be(false) end it 'returns nil in realNull ch...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/value/function_spec.rb
Ruby
mit
85
main
3,906
# frozen_string_literal: true require 'spec_helper' # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/value/function.test.ts describe Sass::Value::Function do it 'can round-trip a function reference from Sass' do fn = double allow(fn).to receive(:call) { |args| expect(args.length).to eq(1...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/value/map_spec.rb
Ruby
mit
85
main
9,102
# frozen_string_literal: true require 'spec_helper' # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/value/map.test.ts describe Sass::Value::Map do subject(:map) do described_class.new({ Sass::Value::String.new('a') => Sass::Value::String.new('b'), ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/value/color_4_spaces_spec.rb
Ruby
mit
85
main
3,224
# frozen_string_literal: true require 'spec_helper' require_relative 'color/spaces' describe Sass::Value::Color do # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/value/color/color-4-spaces.test.ts describe 'Color 4 Spaces' do COLOR_SPACES.each_value do |space| describe space.name do ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/value/color_4_nonparametizable_spec.rb
Ruby
mit
85
main
2,030
# frozen_string_literal: true require 'spec_helper' require_relative 'color/constructors' describe Sass::Value::Color do # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/value/color/color-4-nonparametizable.test.ts describe 'Color 4 Non-parametizable' do describe 'to_gamut' do [ [...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/value/number_spec.rb
Ruby
mit
85
main
25,011
# frozen_string_literal: true require 'spec_helper' # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/value/number.test.ts describe Sass::Value::Number do let(:precision) do Sass::Value.const_get(:FuzzyMath)::PRECISION end describe 'unitless' do describe 'integer' do subject(:number)...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/value/color/interpolation_examples.rb
Ruby
mit
85
main
8,663
# frozen_string_literal: true # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/value/color/interpolation-examples.ts COLOR_INTERPOLATIONS = { lab: [ [ { weight: 0.5 }, [58.614201693004674, 10.016667522478151, -8.387819651868517] ], [ { weight: 1 ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/value/color/constructors.rb
Ruby
mit
85
main
3,310
# frozen_string_literal: true # @see https://github.com/sass/sass-spec/blob/main/js-api-spec/value/color/constructors.ts module ColorConstructors module_function def _alpha_to_kwargs(*args) case args.length when 0 {} when 1 { alpha: args[0] } else raise ArgumentError end en...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/value/color/spaces.rb
Ruby
mit
85
main
8,896
# frozen_string_literal: true require_relative 'constructors' class ColorSpace def initialize(hash) @hash = hash end def method_missing(symbol, ...) return super unless @hash.key?(symbol) if symbol == :constructor ColorConstructors.send(@hash[symbol], ...) else @hash[symbol] en...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
spec/sass/value/color/utils.rb
Ruby
mit
85
main
639
# frozen_string_literal: true module ColorUtils module_function def channel_cases(ch1, ch2, ch3) [ [ch1, ch2, ch3], [nil, ch2, ch3], [nil, nil, ch3], [ch1, nil, ch3], [ch1, nil, nil], [ch1, ch2, nil], [nil, ch2, nil], [nil, nil, nil] ].flat_map do |channels|...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/calculation_value.rb
Ruby
mit
85
main
643
# frozen_string_literal: true module Sass # The type of values that can be arguments to a SassCalculation. # # @see https://sass-lang.com/documentation/js-api/types/calculationvalue/ module CalculationValue private def assert_calculation_value(value, name = nil) if !value.is_a?(Sass::Calculation...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/value.rb
Ruby
mit
85
main
3,158
# frozen_string_literal: true module Sass # The abstract base class of Sass's value types. # # @see https://sass-lang.com/documentation/js-api/classes/value/ module Value # @return [::String, nil] def separator nil end # @return [::Boolean] def bracketed? false end # @...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/exception.rb
Ruby
mit
85
main
1,969
# frozen_string_literal: true module Sass # An exception thrown because a Sass compilation failed. class CompileError < StandardError # @return [String, nil] attr_reader :sass_stack # @return [Logger::SourceSpan, nil] attr_reader :span # @return [Array<String>] attr_reader :loaded_urls ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/elf.rb
Ruby
mit
85
main
8,455
# frozen_string_literal: true module Sass # The {ELF} class. # # It parses ELF header to extract interpreter. # @see https://github.com/torvalds/linux/blob/HEAD/include/uapi/linux/elf.h # @see https://github.com/torvalds/linux/blob/HEAD/kernel/kexec_elf.c class ELF # The {PackInfo} class. class Pac...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/gem_package_importer.rb
Ruby
mit
85
main
637
# frozen_string_literal: true module Sass # The built-in RubyGems package importer. This loads pkg: URLs from gems. class GemPackageImporter # @!visibility private def find_file_url(url, _canonicalize_context) return unless url.start_with?('pkg:') library, _, path = url[4..].partition(/[#?]/)....
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/serializer.rb
Ruby
mit
85
main
950
# frozen_string_literal: true module Sass # The {Serializer} module. module Serializer module_function CSS_ESCAPE = [*"\x01".."\x08", *"\x0A".."\x1F", "\x7F"] .product([*'0'..'9', *'a'..'f', *'A'..'F', "\t", ' ', nil]) .each_with_object({ "\0" => "\uFFFD", '\\' => '\\\\',...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/embedded_protocol.rb
Ruby
mit
85
main
227
# frozen_string_literal: true module Sass # @see https://github.com/sass/sass/blob/HEAD/spec/embedded-protocol.md module EmbeddedProtocol require 'sass/embedded_sass_pb' end private_constant :EmbeddedProtocol end
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/embedded.rb
Ruby
mit
85
main
2,204
# frozen_string_literal: true require_relative 'compiler' # The Sass module. # # This communicates with Embedded Dart Sass using the Embedded Sass protocol. # # @example # Sass.compile('style.scss') # # @example # Sass.compile_string('h1 { font-size: 40px; }') module Sass @compiler = nil @mutex = Mutex.new ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/compiler.rb
Ruby
mit
85
main
10,323
# frozen_string_literal: true require_relative 'canonicalize_context' require_relative 'compile_result' require_relative 'compiler/channel' require_relative 'compiler/connection' require_relative 'compiler/dispatcher' require_relative 'compiler/host' require_relative 'compiler/varint' require_relative 'embedded/versio...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/compile_result.rb
Ruby
mit
85
main
579
# frozen_string_literal: true module Sass # The result of compiling Sass to CSS. Returned by {Sass.compile} and {Sass.compile_string}. # # @see https://sass-lang.com/documentation/js-api/interfaces/compileresult/ class CompileResult # @return [String] attr_reader :css # @return [String, nil] a...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/canonicalize_context.rb
Ruby
mit
85
main
787
# frozen_string_literal: true module Sass # Contextual information passed to `canonicalize` and `find_file_url`. # Not all importers will need this information to resolve loads, but some may find it useful. # # @see https://sass-lang.com/documentation/js-api/interfaces/canonicalizecontext/ class Canonicalize...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/fork_tracker.rb
Ruby
mit
85
main
1,165
# frozen_string_literal: true module Sass # The {ForkTracker} module. # # It tracks objects that need to be closed after `Process.fork`. module ForkTracker module_function if Process.respond_to?(:_fork) # TODO: remove next line once ruby 3.1 support is dropped require 'set' unless defined?...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/node_package_importer.rb
Ruby
mit
85
main
700
# frozen_string_literal: true module Sass # The built-in Node.js package importer. This loads pkg: URLs from node_modules # according to the standard Node.js resolution algorithm. # # @see https://sass-lang.com/documentation/js-api/classes/nodepackageimporter/ class NodePackageImporter # @param entry_poi...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/calculation_value/calculation_operation.rb
Ruby
mit
85
main
1,302
# frozen_string_literal: true module Sass module CalculationValue # A binary operation that can appear in a SassCalculation. # # @see https://sass-lang.com/documentation/js-api/classes/calculationoperation/ class CalculationOperation include CalculationValue OPERATORS = %w[+ - * /].freez...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/compiler/dispatcher.rb
Ruby
mit
85
main
3,333
# frozen_string_literal: true module Sass class Compiler # The {Dispatcher} class. # # It dispatches messages between multiple instances of {Host} and a single {Connection} to the compiler. class Dispatcher def initialize(idle_timeout: 0) @id = 1 @observers = {}.compare_by_ident...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/compiler/channel.rb
Ruby
mit
85
main
1,506
# frozen_string_literal: true module Sass class Compiler # The {Channel} class. # # It manages the lifecycle of {Dispatcher}. class Channel def initialize(*args, **kwargs, &block) @args = args @kwargs = kwargs @block = block @dispatcher = Dispatcher.new(*@args, *...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/compiler/host.rb
Ruby
mit
85
main
6,712
# frozen_string_literal: true require_relative 'host/function_registry' require_relative 'host/importer_registry' require_relative 'host/logger_registry' require_relative 'host/protofier' require_relative 'host/struct' module Sass class Compiler # The {Host} class. # # It communicates with {Dispatcher} ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/compiler/connection.rb
Ruby
mit
85
main
2,374
# frozen_string_literal: true require 'open3' require 'sass/cli' module Sass class Compiler # The stdio based {Connection} between the {Dispatcher} and the compiler. # # It runs the `sass --embedded` command. class Connection def initialize @mutex = Mutex.new @stdin, @stdout, ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/compiler/varint.rb
Ruby
mit
85
main
729
# frozen_string_literal: true module Sass class Compiler # The {Varint} module. # # It reads and writes varints. module Varint module_function def length(value) return 1 if value < 128 (value.bit_length + 6) / 7 end def read(readable) value = bits = ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/compiler/host/logger_registry.rb
Ruby
mit
85
main
2,145
# frozen_string_literal: true module Sass class Compiler class Host # The {LoggerRegistry} class. # # It stores logger and handles log events. class LoggerRegistry LOGGER_METHODS = %i[debug warn].freeze private_constant :LOGGER_METHODS def initialize(logger) ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/compiler/host/struct.rb
Ruby
mit
85
main
856
# frozen_string_literal: true module Sass class Compiler class Host # The {Struct} class. # # It creates {::Struct}-like objects from {::Hash}. class Struct def initialize(hash, attrs: nil, methods: nil) @hash = hash @attrs = attrs @methods = methods ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/compiler/host/importer_registry.rb
Ruby
mit
85
main
5,713
# frozen_string_literal: true module Sass class Compiler class Host # The {ImporterRegistry} class. # # It stores importers and handles import requests. class ImporterRegistry attr_reader :importers def initialize(importers, load_paths, alert_color:) @id = 0 ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/compiler/host/function_registry.rb
Ruby
mit
85
main
2,683
# frozen_string_literal: true module Sass class Compiler class Host # The {FunctionRegistry} class. # # It stores sass custom functions and handles function calls. class FunctionRegistry attr_reader :compile_context, :global_functions def initialize(functions, alert_color...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/compiler/host/protofier.rb
Ruby
mit
85
main
12,039
# frozen_string_literal: true module Sass class Compiler class Host # The {Protofier} class. # # It converts Pure Ruby types and Protobuf Ruby types. class Protofier def initialize(function_registry) @function_registry = function_registry end def to_prot...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/logger/source_location.rb
Ruby
mit
85
main
601
# frozen_string_literal: true module Sass module Logger # A specific location within a source file. # # This is always associated with a {SourceSpan} which indicates which file it refers to. # # @see https://sass-lang.com/documentation/js-api/interfaces/sourcelocation/ class SourceLocation ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/logger/source_span.rb
Ruby
mit
85
main
825
# frozen_string_literal: true module Sass module Logger # A span of text within a source file. # # @see https://sass-lang.com/documentation/js-api/interfaces/sourcespan/ class SourceSpan # @return [SourceLocation] attr_reader :start, :end # @return [String] attr_reader :text ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/logger/silent.rb
Ruby
mit
85
main
619
# frozen_string_literal: true module Sass # A namespace for built-in Loggers. # # @see https://sass-lang.com/documentation/js-api/modules/logger/ module Logger module_function # A Logger that silently ignores all warnings and debug messages. # # @see https://sass-lang.com/documentation/js-api/...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/value/list.rb
Ruby
mit
85
main
1,874
# frozen_string_literal: true module Sass module Value # Sass's list type. # # @see https://sass-lang.com/documentation/js-api/classes/sasslist/ class List include Value # @param contents [Array<Value>] # @param separator [::String] # @param bracketed [::Boolean] def in...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/value/color.rb
Ruby
mit
85
main
22,477
# frozen_string_literal: true require_relative 'color/channel' require_relative 'color/conversions' require_relative 'color/gamut_map_method' require_relative 'color/interpolation_method' require_relative 'color/space' module Sass module Value # Sass's color type. # # No matter what representation was o...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/value/fuzzy_math.rb
Ruby
mit
85
main
2,146
# frozen_string_literal: true module Sass module Value # Sass's {FuzzyMath} module. module FuzzyMath PRECISION = 10 EPSILON = 10**(-PRECISION - 1) INVERSE_EPSILON = 10**(PRECISION + 1) module_function def equals?(number1, number2) return true if number1 == number2 ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/value/calculation.rb
Ruby
mit
85
main
2,128
# frozen_string_literal: true module Sass module Value # Sass's calculation type. # # @see https://sass-lang.com/documentation/js-api/classes/sasscalculation/ class Calculation include Value include CalculationValue class << self private :new # @param argument [Cal...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/value/null.rb
Ruby
mit
85
main
797
# frozen_string_literal: true module Sass module Value # Sass's null type. # # @see https://sass-lang.com/documentation/js-api/variables/sassnull/ class Null include Value def initialize @value = nil end # @return [nil] attr_reader :value # @return [Bool...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/value/string.rb
Ruby
mit
85
main
1,510
# frozen_string_literal: true module Sass module Value # Sass's string type. # # @see https://sass-lang.com/documentation/js-api/classes/sassstring/ class String include Value include CalculationValue # @param text [::String] # @param quoted [::Boolean] def initialize(t...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/value/argument_list.rb
Ruby
mit
85
main
824
# frozen_string_literal: true module Sass module Value # Sass's argument list type. # # An argument list comes from a rest argument. It's distinct from a normal {List} in that it may contain a keyword # map as well as the positional arguments. # # @see https://sass-lang.com/documentation/js-a...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/value/map.rb
Ruby
mit
85
main
1,599
# frozen_string_literal: true module Sass module Value # Sass's map type. # # @see https://sass-lang.com/documentation/js-api/classes/sassmap/ class Map include Value # @param contents [Hash<Value, Value>] def initialize(contents = {}) @contents = contents.freeze end ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/value/boolean.rb
Ruby
mit
85
main
993
# frozen_string_literal: true module Sass module Value # Sass's boolean type. # # @see https://sass-lang.com/documentation/js-api/classes/sassboolean/ class Boolean include Value # @param value [::Boolean] def initialize(value) @value = value end # @return [::B...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/value/function.rb
Ruby
mit
85
main
1,222
# frozen_string_literal: true module Sass module Value # Sass's function type. # # @see https://sass-lang.com/documentation/js-api/classes/sassfunction/ class Function include Value # @param signature [::String] # @param callback [Proc] def initialize(signature, &callback) ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/value/mixin.rb
Ruby
mit
85
main
740
# frozen_string_literal: true module Sass module Value # Sass's mixin type. # # @see https://sass-lang.com/documentation/js-api/classes/sassmixin/ class Mixin include Value class << self private :new end # @return [Object] protected attr_reader :compile_context...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/value/number.rb
Ruby
mit
85
main
12,406
# frozen_string_literal: true require_relative 'number/unit' module Sass module Value # Sass's number type. # # @see https://sass-lang.com/documentation/js-api/classes/sassnumber/ class Number include Value include CalculationValue # @param value [Numeric] # @param unit [::S...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/value/number/unit.rb
Ruby
mit
85
main
5,204
# frozen_string_literal: true module Sass module Value class Number # The {Unit} module. module Unit CONVERSIONS = { # Length 'in' => { 'in' => Rational(1), 'cm' => Rational(1, 2.54), 'pc' => Rational(1, 6), 'mm' => Rational(...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/value/color/gamut_map_method.rb
Ruby
mit
85
main
1,167
# frozen_string_literal: true module Sass module Value class Color # @see https://github.com/sass/dart-sass/blob/main/lib/src/value/color/gamut_map_method.dart module GamutMapMethod # @return [::String] attr_reader :name # @param name [::String] def initialize(name) ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/value/color/space.rb
Ruby
mit
85
main
6,646
# frozen_string_literal: true module Sass module Value class Color # @see https://github.com/sass/dart-sass/blob/main/lib/src/value/color/space.dart module Space # @return [::String] attr_reader :name # @return [Array<ColorChannel>] attr_reader :channels # @r...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/value/color/conversions.rb
Ruby
mit
85
main
22,982
# frozen_string_literal: true module Sass module Value class Color # @see https:#www.w3.org/TR/css-color-4/#color-conversion-code. # @see https://github.com/sass/dart-sass/blob/main/lib/src/value/color/conversions.dart module Conversions # The D50 white point. # # Defini...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/value/color/interpolation_method.rb
Ruby
mit
85
main
1,478
# frozen_string_literal: true module Sass module Value class Color # @see https://github.com/sass/dart-sass/blob/main/lib/src/value/color/interpolation_method.dart class InterpolationMethod # @return [Space] attr_reader :space # @return [Symbol, nil] attr_reader :hue ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/value/color/channel.rb
Ruby
mit
85
main
2,429
# frozen_string_literal: true module Sass module Value class Color # @see https://github.com/sass/dart-sass/blob/main/lib/src/value/color/channel.dart class ColorChannel # @return [::String] attr_reader :name # @return [::Boolean] def polar_angle? @polar_ang...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/value/color/gamut_map_method/clip.rb
Ruby
mit
85
main
1,197
# frozen_string_literal: true module Sass module Value class Color module GamutMapMethod # @see https://github.com/sass/dart-sass/blob/main/lib/src/value/color/gamut_map_method/local_minde.dart class Clip include GamutMapMethod def initialize super('clip') ...
github
sass-contrib/sass-embedded-host-ruby
https://github.com/sass-contrib/sass-embedded-host-ruby
lib/sass/value/color/gamut_map_method/local_minde.rb
Ruby
mit
85
main
3,047
# frozen_string_literal: true module Sass module Value class Color module GamutMapMethod # @see https://github.com/sass/dart-sass/blob/main/lib/src/value/color/gamut_map_method/local_minde.dart class LocalMinde include GamutMapMethod # A constant from the gamut-mapping ...