repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker.rb | lib/travis/worker.rb | require 'travis/worker/config'
module Travis
module Worker
class << self
def config
@config ||= Config.new
end
end
end
end
| ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/version.rb | lib/travis/worker/version.rb | module Travis
module Worker
VERSION = "0.2.0"
end
end
| ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/application.rb | lib/travis/worker/application.rb | require 'java'
require 'march_hare'
require 'metriks'
require 'metriks/reporter/librato_metrics'
require 'raven'
require 'travis/support/amqp'
require 'travis/support/logger'
require 'travis/worker/pool'
require 'travis/worker/application/commands/dispatcher'
require 'travis/worker/application/heart'
require 'travis/wo... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/virtual_machine.rb | lib/travis/worker/virtual_machine.rb | require 'active_support/inflector'
module Travis
module Worker
module VirtualMachine
class VmNotFound < StandardError; end
class VmFatalError < StandardError; end
def self.provider
@provider ||= begin
provider = Travis::Worker.config.vms.provider
provider_name = p... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/pool.rb | lib/travis/worker/pool.rb | require 'travis/worker/instance'
module Travis
module Worker
class WorkerNotFound < Exception
def initialize(name)
super "Unknown worker #{name}"
end
end
class Pool
def self.create(broker_connection)
new(Travis::Worker.config.names, Travis::Worker.config, broker_connect... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/cli.rb | lib/travis/worker/cli.rb | require 'travis/worker/cli/app'
require 'travis/worker/cli/console'
require 'travis/worker/cli/development'
$stdout.sync = true
module Travis
module Worker
module Cli
def run(*commands)
normalize_commands(commands).each do |command|
puts "$ #{command}"
return false unless syste... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/config.rb | lib/travis/worker/config.rb | require 'yaml'
require 'hashr'
require 'socket'
require 'travis/worker/virtual_machine'
module Travis
module Worker
class Config < Hashr
module Vms
def count
self[:count]
end
def name_prefix
self[:name_prefix] || "travis-#{Travis::Worker.config.env}"
end
... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/factory.rb | lib/travis/worker/factory.rb | require 'travis/worker/instance'
require 'travis/worker/virtual_machine'
module Travis
module Worker
class Factory
attr_reader :name, :config, :broker_connection
def initialize(name, config = nil, broker_connection = nil)
@name = name
@config = config
... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/instance.rb | lib/travis/worker/instance.rb | require 'multi_json'
require 'thread'
require 'celluloid'
require 'core_ext/hash/compact'
require 'travis/support'
require 'travis/worker/factory'
require 'travis/worker/virtual_machine'
require 'travis/worker/reporter'
require 'travis/worker/utils/hard_timeout'
require 'travis/worker/utils/serialization'
require 'trav... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/reporter.rb | lib/travis/worker/reporter.rb | require 'travis/support/logging'
require 'travis/worker/utils/serialization'
module Travis
module Worker
# Reporter that streams build logs. Because workers now support multiple types of
# projects (e.g. Ruby, Clojure) as long as VMs provide all the necessary, log streaming
# picks routing key dynamicall... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/virtual_machine/docker.rb | lib/travis/worker/virtual_machine/docker.rb | require 'docker'
require 'fog'
require 'shellwords'
require 'digest/sha1'
require 'benchmark'
require 'travis/support'
require 'travis/worker/ssh/session'
module Travis
module Worker
module VirtualMachine
class Docker
include Retryable
include Logging
class << self
def vm... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/ssh/session.rb | lib/travis/worker/ssh/session.rb | require 'shellwords'
require 'travis/worker/utils/buffer'
require 'travis/worker/utils/hard_timeout'
require 'travis/worker/ssh/connector/net_ssh'
require 'travis/support/logging'
require 'base64'
require 'hashr'
module Travis
module Worker
module Ssh
# Encapsulates an SSH connection to a remote host.
... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/ssh/connector/net_ssh.rb | lib/travis/worker/ssh/connector/net_ssh.rb | require 'net/ssh'
module Travis
module Worker
module Ssh
module Connector
class NetSSH
def initialize(config)
@config = config
end
def connect
options = { port: @config.port, paranoid: false, timeout: 10 }
if @config.private_key_pat... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/application/heart.rb | lib/travis/worker/application/heart.rb | require 'multi_json'
require 'travis/worker/utils/serialization'
module Travis
module Worker
class Application
class Heart
include Celluloid
include Logging
include Utils::Serialization
attr_reader :exchange, :interval, :application
def initialize(channel, &block)
... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/application/http_heart.rb | lib/travis/worker/application/http_heart.rb | require 'multi_json'
require 'time'
require 'excon'
module Travis
module Worker
class Application
class HTTPHeart
include Celluloid
attr_reader :url, :shutdown_block, :interval
def initialize(url, shutdown_block)
# The shutdown block is accepted as a param and not a bloc... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/application/remote.rb | lib/travis/worker/application/remote.rb | require 'travis/worker/utils/serialization'
module Travis
module Worker
class Application
class Remote
include Logging, Utils::Serialization
def initialize
Travis.logger.level = Logger.const_get(Travis::Worker.config.log_level.to_s.upcase) # TODO hrmm ...
Travis::Amqp.c... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/application/commands/dispatcher.rb | lib/travis/worker/application/commands/dispatcher.rb | require 'hashr'
require 'json'
require 'multi_json'
require 'travis/support'
require 'travis/support/amqp'
require 'travis/worker/application/commands/cancel_job'
module Travis
module Worker
class Application
module Commands
class Dispatcher
include Logging
attr_reader :pool
... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/application/commands/cancel_job.rb | lib/travis/worker/application/commands/cancel_job.rb | require 'travis/support'
# { "type": "cancel_job", "job_id": 388638 }
module Travis
module Worker
class Application
module Commands
class CancelJob
include Logging
attr_reader :pool, :job_id
def initialize(pool, job_id)
@pool = pool
@job_id =... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/utils/serialization.rb | lib/travis/worker/utils/serialization.rb | require 'hashr'
require 'multi_json'
module Travis
module Worker
module Utils
module Serialization
def encode(data)
MultiJson.encode(data)
end
def decode(data)
Hashr.new(MultiJson.decode(data))
end
end
end
end
end
| ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/utils/hard_timeout.rb | lib/travis/worker/utils/hard_timeout.rb | require 'timeout'
# inspired by https://gist.github.com/1356797
# and @headius helped me modify it to this
#
# for safe keeping : https://gist.github.com/f489c48601060899ecff
module Travis
module Worker
module Utils
module HardTimeout
def self.timeout(sec, klass=nil)
return yield(sec) if ... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/utils/filtered_string.rb | lib/travis/worker/utils/filtered_string.rb | module Travis
module Worker
module Utils
class FilteredString < Struct.new(:unfiltered, :filtered)
def to_s
filtered
end
def to_str
to_s
end
def mutate(*args)
str = args.shift
filtered = str % args
unfiltered = str %... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/utils/buffer.rb | lib/travis/worker/utils/buffer.rb | require 'travis/support/logging'
require 'travis/support/chunkifier'
require 'json'
require 'coder'
module Travis
module Worker
module Utils
class Buffer
include Logging
class OutputLimitExceededError < StandardError
attr_reader :limit
def initialize(limit)
... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/cli/development.rb | lib/travis/worker/cli/development.rb | require "thor"
require "java"
require "march_hare"
require "multi_json"
require 'travis/worker'
module Travis
module Worker
module Cli
# These tasks are used for development and only for development.
# They have many limitations and SHOULD NOT be considered good
# programming style or examples... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/cli/console.rb | lib/travis/worker/cli/console.rb | require 'thor'
require 'thor/console'
require 'travis/worker'
module Travis
module Worker
module Cli
class Console < Thor
namespace 'travis'
desc 'console', 'Start the Travis console'
method_option :with, :aliases => '-w', :type => :string, :default => 'travis:worker', :desc => 'I... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/cli/app.rb | lib/travis/worker/cli/app.rb | require 'thor'
require 'travis/worker'
require 'hashr'
module Travis
module Worker
module Cli
class App < Thor
namespace 'travis:worker'
desc 'boot', 'Boot the manager and start workers'
method_option :start_hook, :default => ENV['START_HOOK'], :desc => 'Executable or command to ru... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/job/script.rb | lib/travis/worker/job/script.rb | require "faraday"
require "json"
require "travis/build"
require "metriks"
module Travis
module Worker
module Job
class Script
CompileError = Class.new(StandardError)
include Logging
include Retryable
log_header { "#{@log_prefix}:worker:job:script" }
def initialize... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
travis-ci/travis-worker | https://github.com/travis-ci/travis-worker/blob/4ca25dda14ee1673262ea0f48a32ea8fdb19bd64/lib/travis/worker/job/runner.rb | lib/travis/worker/job/runner.rb | require 'celluloid'
require 'travis/support/logging'
require 'travis/worker/utils/hard_timeout'
require 'travis/worker/job/script'
# monkey patch net-ssh for now
require 'net/ssh/buffered_io'
module Net
module SSH
module BufferedIo
def fill(n=8192)
input.consume!
data = recv(n)
debu... | ruby | MIT | 4ca25dda14ee1673262ea0f48a32ea8fdb19bd64 | 2026-01-04T17:43:19.367934Z | false |
maccman/remail | https://github.com/maccman/remail/blob/417573e13fa26ad19209ec09755ffb5488e4fcae/lib/remail.rb | lib/remail.rb | require "active_resource"
module Remail
def site=(site)
Email.site = site
end
module_function :site=
def app_id=(name)
self.site = "http://#{name}.appspot.com"
end
module_function :app_id=
def api_key=(key)
Email.headers["Authorization"] = key
end
module_function :api_key=
clas... | ruby | MIT | 417573e13fa26ad19209ec09755ffb5488e4fcae | 2026-01-04T17:43:32.051600Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio.rb | lib/localio.rb | require 'localio/version'
require 'localio/locfile'
require 'localio/processor'
require 'localio/localizable_writer'
require 'localio/filter'
module Localio
def self.from_cmdline(args)
if ARGV.empty?
if File.exist? 'Locfile'
process_locfile('Locfile')
else
raise ArgumentError, 'Locfi... | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/version.rb | lib/localio/version.rb | module Localio
VERSION = "0.1.7"
end
| ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/string_helper.rb | lib/localio/string_helper.rb | class String
def self.colorize(text, color_code)
"\e[#{color_code}m#{text}\e[0m"
end
def cyan
self.class.colorize(self, 36)
end
def green
self.class.colorize(self, 32)
end
def yellow
self.class.colorize(self, 33)
end
def red
self.class.colorize(self, 31)
end
def underscore... | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/term.rb | lib/localio/term.rb | class Term
attr_accessor :values, :keyword
def initialize(keyword)
@keyword = keyword
@values = Hash.new
end
def is_comment?
@keyword.downcase == '[comment]'
end
end | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/processor.rb | lib/localio/processor.rb | require 'localio/processors/google_drive_processor'
require 'localio/processors/xls_processor'
require 'localio/processors/xlsx_processor'
require 'localio/processors/csv_processor'
module Processor
def self.load_localizables(platform_options, service, options)
puts "Service: #{service}"
case service
w... | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/segment.rb | lib/localio/segment.rb | class Segment
attr_accessor :key, :translation, :language
def initialize(key, translation, language)
@key = key
@translation = translation.replace_escaped
@language = language
end
def is_comment?
@key == nil
end
end | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/locfile.rb | lib/localio/locfile.rb | require 'localio/module'
class Locfile
# Specify the target platform for the localizables
#
# possible values
# :android, :ios, :rails, :json
dsl_accessor :platform_name, :platform_options
# Specifies the filesystem path where the generated files will be
dsl_accessor :output_path
# Specifies the for... | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/filter.rb | lib/localio/filter.rb | class Filter
def self.apply_filter(segments, only, except)
segments = only segments, only[:keys] unless only.nil?
segments = except segments, except[:keys] unless except.nil?
segments
end
private
def self.only segments, keys_filter
filtered_segments = []
segments.each do |segment|
... | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/segments_list_holder.rb | lib/localio/segments_list_holder.rb | class SegmentsListHolder
attr_accessor :segments, :language
def initialize(language)
@segments = []
@language = language
end
def get_binding
binding
end
end | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/config_store.rb | lib/localio/config_store.rb | class ConfigStore
CONFIG_FILE = '.localio.yml'
def initialize
if File.exist? CONFIG_FILE
@config = YAML.load_file(CONFIG_FILE)
end
@config ||= Hash.new
end
def has?(key)
@config.has_key?(clean_param key)
end
def get(key)
@config[clean_param key]
end
def store(key, data)
... | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/template_handler.rb | lib/localio/template_handler.rb | require 'erb'
require 'localio/segments_list_holder'
class TemplateHandler
def self.process_template(template_name, target_directory, generated_file_name, segments)
full_template_path = File.join(File.dirname(File.expand_path(__FILE__)), "templates/#{template_name}")
input_file = File.open(full_template_path... | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/localizable_writer.rb | lib/localio/localizable_writer.rb | require 'localio/writers/android_writer'
require 'localio/writers/ios_writer'
require 'localio/writers/swift_writer'
require 'localio/writers/json_writer'
require 'localio/writers/rails_writer'
require 'localio/writers/java_properties_writer'
require 'localio/writers/resx_writer'
module LocalizableWriter
def self.wr... | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/formatter.rb | lib/localio/formatter.rb | require 'localio/string_helper'
module Formatter
def self.format(key, formatter, callback)
case formatter
when :smart
# Smart formatting is given by the processor.
# I don't like this very much but creating more classes seemed overkill.
callback.call(key)
when :none
ke... | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/module.rb | lib/localio/module.rb | class Module
def dsl_accessor(*symbols)
symbols.each { |sym|
class_eval %{
def #{sym}(*val)
if val.empty?
@#{sym}
else
@#{sym} = val.size == 1 ? val[0] : val
end
end
}
}
end
end
| ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/processors/csv_processor.rb | lib/localio/processors/csv_processor.rb | require 'csv'
require 'localio/term'
class CsvProcessor
def self.load_localizables(platform_options, options)
# Parameter validations
path = options[:path]
raise ArgumentError, ':path attribute is missing from the source, and it is required for CSV spreadsheets' if path.nil?
override_default = nil... | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/processors/google_drive_processor.rb | lib/localio/processors/google_drive_processor.rb | require 'google_drive'
require 'localio/term'
require 'localio/config_store'
class GoogleDriveProcessor
def self.load_localizables(platform_options, options)
# Parameter validations
spreadsheet = options[:spreadsheet]
raise ArgumentError, ':spreadsheet required for Google Drive source!' if spreadsheet.n... | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/processors/xls_processor.rb | lib/localio/processors/xls_processor.rb | require 'spreadsheet'
require 'localio/term'
class XlsProcessor
def self.load_localizables(platform_options, options)
# Parameter validations
path = options[:path]
raise ArgumentError, ':path attribute is missing from the source, and it is required for xls spreadsheets' if path.nil?
sheet = option... | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/processors/xlsx_processor.rb | lib/localio/processors/xlsx_processor.rb | require 'simple_xlsx_reader'
require 'localio/term'
class XlsxProcessor
def self.load_localizables(platform_options, options)
# Parameter validations
path = options[:path]
raise ArgumentError, ':path attribute is missing from the source, and it is required for xlsx spreadsheets' if path.nil?
sheet... | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/writers/swift_writer.rb | lib/localio/writers/swift_writer.rb | require 'localio/template_handler'
require 'localio/segments_list_holder'
require 'localio/segment'
require 'localio/formatter'
class SwiftWriter
def self.write(languages, terms, path, formatter, options)
puts 'Writing iOS translations...'
create_constants = options[:create_constants].nil? ? true : options[:... | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/writers/java_properties_writer.rb | lib/localio/writers/java_properties_writer.rb | require 'localio/template_handler'
require 'localio/segments_list_holder'
require 'localio/segment'
require 'localio/formatter'
class JavaPropertiesWriter
def self.write(languages, terms, path, formatter, options)
puts 'Writing Java Properties translations...'
languages.keys.each do |lang|
output_path... | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/writers/resx_writer.rb | lib/localio/writers/resx_writer.rb | require 'localio/template_handler'
require 'localio/segments_list_holder'
require 'localio/segment'
require 'localio/formatter'
class ResXWriter
def self.write(languages, terms, path, formatter, options)
puts 'Writing .NET ResX translations...'
default_language = options[:default_language]
resource_file ... | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/writers/json_writer.rb | lib/localio/writers/json_writer.rb | require 'localio/template_handler'
require 'localio/segments_list_holder'
require 'localio/segment'
require 'localio/formatter'
class JsonWriter
def self.write(languages, terms, path, formatter, options)
puts 'Writing JSON translations...'
languages.keys.each do |lang|
output_path = path
# We h... | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/writers/ios_writer.rb | lib/localio/writers/ios_writer.rb | require 'localio/template_handler'
require 'localio/segments_list_holder'
require 'localio/segment'
require 'localio/formatter'
class IosWriter
def self.write(languages, terms, path, formatter, options)
puts 'Writing iOS translations...'
create_constants = options[:create_constants].nil? ? true : options[:cr... | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/writers/rails_writer.rb | lib/localio/writers/rails_writer.rb | require 'localio/template_handler'
require 'localio/segments_list_holder'
require 'localio/segment'
require 'localio/formatter'
class RailsWriter
def self.write(languages, terms, path, formatter, options)
puts 'Writing Rails YAML translations...'
languages.keys.each do |lang|
output_path = path
... | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
mrmans0n/localio | https://github.com/mrmans0n/localio/blob/7ef4d7deb5a954c11fb9663c735ff01554e0fefa/lib/localio/writers/android_writer.rb | lib/localio/writers/android_writer.rb | require 'localio/template_handler'
require 'localio/segments_list_holder'
require 'localio/segment'
require 'localio/formatter'
require 'nokogiri'
class AndroidWriter
def self.write(languages, terms, path, formatter, options)
puts 'Writing Android translations...'
default_language = options[:default_language... | ruby | MIT | 7ef4d7deb5a954c11fb9663c735ff01554e0fefa | 2026-01-04T17:43:32.552430Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/spec/spec_helper.rb | spec/spec_helper.rb | if ENV['CODECLIMATE_REPO_TOKEN']
require "codeclimate-test-reporter"
CodeClimate::TestReporter.start
else
require 'simplecov'
SimpleCov.start
end
require 'bundler/setup'
require './lib/gauguin'
require 'pry'
Bundler.setup
RSpec.configure do |config|
end
def configure(config_option, value)
old_value = Gaug... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/spec/integration/samples_spec.rb | spec/integration/samples_spec.rb | require 'spec_helper'
module Gauguin
describe "samples" do
def self.picture_path(file_name)
File.join("spec", "support", "pictures", file_name)
end
let(:painting) { Painting.new(picture_path(file_name)) }
def self.paths
(1..11).map { |i| picture_path(File.join("samples", "sample#{i}.png... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/spec/integration/painting_spec.rb | spec/integration/painting_spec.rb | require 'spec_helper'
module Gauguin
describe Painting do
let(:path) do
File.join("spec", "support", "pictures", file_name)
end
let(:gray) { Color.new(204, 204, 204) }
let(:black) { Color.new(0, 0, 0) }
let(:white) { Color.new(255, 255, 255) }
let(:painting) { Painting.new(path) }
... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/spec/lib/gauguin/colors_limiter_spec.rb | spec/lib/gauguin/colors_limiter_spec.rb | require 'spec_helper'
module Gauguin
describe ColorsLimiter do
describe "#limit" do
let(:limiter) { ColorsLimiter.new }
let(:colors) { [black, red, white] }
let(:white) { Color.new(255, 255, 255, 0.01) }
let(:red) { Color.new(255, 0, 0, 0.02) }
let(:black) { Color.new(0, 0, 0, 0.97)... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/spec/lib/gauguin/colors_retriever_spec.rb | spec/lib/gauguin/colors_retriever_spec.rb | require 'spec_helper'
module Gauguin
describe ColorsRetriever do
let(:retriever) { ColorsRetriever.new(image) }
let(:image) do
fake = FakeImage.new
fake.magic_black_pixel = magic_black_pixel
fake.magic_white_pixel = magic_white_pixel
fake.magic_red_pixel = magic_red_pixel
fake.... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/spec/lib/gauguin/colors_clusterer_spec.rb | spec/lib/gauguin/colors_clusterer_spec.rb | require 'spec_helper'
module Gauguin
describe ColorsClusterer do
let(:black) { Color.new(0, 0, 0, 0.597) }
let(:white) { Color.new(255, 255, 255, 0.4) }
let(:clusterer) { ColorsClusterer.new }
describe "call" do
subject { clusterer.call(colors) }
context "colors is empty" do
le... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/spec/lib/gauguin/painting_spec.rb | spec/lib/gauguin/painting_spec.rb | require 'spec_helper'
module Gauguin
describe Painting do
let(:colors) { [] }
let(:image_repository) { double(get: double('image')) }
let(:colors_retriever) { double }
let(:colors_limiter) { double }
let(:noise_reducer) { double }
let(:colors_clusterer) { double }
let(:image_recolorer) {... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/spec/lib/gauguin/noise_reducer_spec.rb | spec/lib/gauguin/noise_reducer_spec.rb | require 'spec_helper'
module Gauguin
describe NoiseReducer do
let(:reducer) { NoiseReducer.new }
describe "#reduce" do
subject { reducer.call(colors).keys }
let(:white) { Color.new(255, 255, 255, 0.01) }
let(:red) { Color.new(255, 0, 0, 0.02) }
let(:black) { Color.new(0, 0, 0, 0.97)... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/spec/lib/gauguin/image_repository_spec.rb | spec/lib/gauguin/image_repository_spec.rb | require 'spec_helper'
module Gauguin
describe ImageRepository do
let(:repository) { ImageRepository.new }
let(:path) { "path" }
describe "#get" do
it "returns image" do
expect(Gauguin::Image).to receive(:new).with(path)
repository.get(path)
end
end
end
end
| ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/spec/lib/gauguin/image_recolorer_spec.rb | spec/lib/gauguin/image_recolorer_spec.rb | require 'spec_helper'
module Gauguin
describe ImageRecolorer do
describe "#recolor" do
let(:image) do
fake = FakeImage.new
fake.pixels = pixels
fake.rows = pixels.count
fake.columns = pixels.first.count
fake.colors_to_pixels = {
white.to_s => white_pixel,
... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/spec/lib/gauguin/color_spec.rb | spec/lib/gauguin/color_spec.rb | require 'spec_helper'
module Gauguin
describe Color do
let(:black) { Color.new(0, 0, 0) }
let(:red) { Color.new(255, 0, 0) }
describe "initialize" do
let(:red) { 1 }
let(:green) { 2 }
let(:blue) { 3 }
let(:percentage) { 0.5 }
subject { Color.new(red, green, blue, percentag... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/spec/lib/gauguin/palette_serializer_spec.rb | spec/lib/gauguin/palette_serializer_spec.rb | require 'spec_helper'
module Gauguin
describe PaletteSerializer do
let(:palette) do
{
Color.new(255, 255, 255, 0.7, true) => [Color.new(255, 0, 0, 0.7, true)]
}
end
it "serializes palette" do
dumped = PaletteSerializer.dump(palette)
loaded = PaletteSerializer.load(dumped)... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/spec/lib/gauguin/image_spec.rb | spec/lib/gauguin/image_spec.rb | require 'spec_helper'
module Gauguin
describe Image do
let(:path) do
File.join("spec", "support", "pictures", "gray_and_black.png")
end
let(:image) { Image.new(path) }
let(:magic_pixel) { double }
describe "initialize" do
context "path given" do
subject { Image.new(path) }
... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/spec/lib/gauguin/color_space/rgb_vector_spec.rb | spec/lib/gauguin/color_space/rgb_vector_spec.rb | require 'spec_helper'
module Gauguin::ColorSpace
describe RgbVector do
describe "#to_xyz" do
let(:red) { RgbVector[255, 0, 0] }
it "converts to lab space" do
expect(red.to_xyz).to eq(
XyzVector[41.24, 21.26, 1.9300000000000002])
end
end
end
end
| ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/spec/lib/gauguin/color_space/xyz_vector_spec.rb | spec/lib/gauguin/color_space/xyz_vector_spec.rb | require 'spec_helper'
module Gauguin::ColorSpace
describe XyzVector do
describe "#to_lab" do
let(:red) { XyzVector[41.24, 21.26, 1.9300000000000002] }
it "converts to lab space" do
expect(red.to_lab).to eq(
LabVector[53.23288178584245, 80.10930952982204, 67.22006831026425])
e... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/lib/gauguin.rb | lib/gauguin.rb | require "gauguin/version"
require "gauguin/color"
require "gauguin/color_space"
require "gauguin/colors_retriever"
require "gauguin/colors_limiter"
require "gauguin/colors_clusterer"
require "gauguin/noise_reducer"
require "gauguin/image_recolorer"
require "gauguin/painting"
require "gauguin/image"
require "gauguin/ima... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/lib/gauguin/noise_reducer.rb | lib/gauguin/noise_reducer.rb | module Gauguin
class NoiseReducer
def call(colors_clusters)
pivots = colors_clusters.keys.sort_by! { |key, group| key.percentage }.reverse
percentage_sum = 0
index = 0
pivots.each do |color|
percentage_sum += color.percentage
break if percentage_sum > Gauguin.configuration... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/lib/gauguin/version.rb | lib/gauguin/version.rb | module Gauguin
VERSION = "0.0.3"
end
| ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/lib/gauguin/image_repository.rb | lib/gauguin/image_repository.rb | module Gauguin
class ImageRepository
def get(path)
Gauguin::Image.new(path)
end
end
end
| ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/lib/gauguin/palette_serializer.rb | lib/gauguin/palette_serializer.rb | require 'yaml'
module Gauguin
class PaletteSerializer
def self.load(value)
return unless value
value = YAML.load(value)
value = value.to_a.map do |color_key, group|
[Gauguin::Color.from_a(color_key), group]
end
Hash[value]
end
def self.dump(value)
value = val... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/lib/gauguin/image_recolorer.rb | lib/gauguin/image_recolorer.rb | module Gauguin
class ImageRecolorer
def initialize(image)
@image = image.dup
end
def recolor(new_colors)
columns = @image.columns
rows = @image.rows
new_image = Image.blank(columns, rows)
(0...columns).each do |column|
(0...rows).each do |row|
image_pixel... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/lib/gauguin/colors_retriever.rb | lib/gauguin/colors_retriever.rb | module Gauguin
class ColorsRetriever
def initialize(image)
@image = image
end
def colors
colors = {}
histogram = @image.color_histogram
image_size = @image.columns * @image.rows
histogram.each do |pixel, count|
image_pixel = @image.pixel(pixel)
red, green,... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/lib/gauguin/colors_clusterer.rb | lib/gauguin/colors_clusterer.rb | module Gauguin
class ColorsClusterer
def call(colors)
clusters = {}
while !colors.empty?
pivot = colors.shift
group = [pivot]
colors, pivot, group = find_all_similar(colors, pivot, group)
clusters[pivot] = group
end
update_pivots_percentages(clusters)
... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/lib/gauguin/color.rb | lib/gauguin/color.rb | module Gauguin
class Color
attr_accessor :red, :green, :blue, :percentage, :transparent
def initialize(red, green, blue, percentage = 1, transparent = false)
self.red = red
self.green = green
self.blue = blue
self.percentage = percentage
self.transparent = transparent
end
... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/lib/gauguin/colors_limiter.rb | lib/gauguin/colors_limiter.rb | module Gauguin
class ColorsLimiter
def call(colors)
colors_limit = Gauguin.configuration.colors_limit
if colors.count > colors_limit
colors = colors.sort_by { |key, group| key.percentage }.
reverse[0..colors_limit - 1]
end
colors
end
end
end
| ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/lib/gauguin/color_space.rb | lib/gauguin/color_space.rb | require 'matrix'
require "gauguin/color_space/rgb_vector"
require "gauguin/color_space/xyz_vector"
require "gauguin/color_space/lab_vector"
| ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/lib/gauguin/painting.rb | lib/gauguin/painting.rb | module Gauguin
class Painting
def initialize(path, image_repository = nil, colors_retriever = nil,
colors_limiter = nil, noise_reducer = nil,
colors_clusterer = nil, image_recolorer = nil)
@image_repository = image_repository || Gauguin::ImageRepository.new
@image... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/lib/gauguin/image.rb | lib/gauguin/image.rb | require 'rmagick'
require 'forwardable'
module Gauguin
class Image
extend Forwardable
attr_accessor :image
delegate [:color_histogram, :columns, :rows, :write] => :image
def initialize(path = nil)
return unless path
list = Magick::ImageList.new(path)
self.image = list.first
en... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/lib/gauguin/color_space/xyz_vector.rb | lib/gauguin/color_space/xyz_vector.rb | module Gauguin
module ColorSpace
class XyzVector < Vector
WHITE_REFERENCE = self[95.047, 100.000, 108.883]
EPSILON = 0.008856
KAPPA = 903.3
def to_lab
zipped = self.zip(XyzVector::WHITE_REFERENCE)
x, y, z = zipped.map do |component, white_component|
component / ... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/lib/gauguin/color_space/lab_vector.rb | lib/gauguin/color_space/lab_vector.rb | module Gauguin
module ColorSpace
class LabVector < Vector
end
end
end
| ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
LunarLogic/gauguin | https://github.com/LunarLogic/gauguin/blob/4067ee2674990871d8bcc38466ee359f13d0e060/lib/gauguin/color_space/rgb_vector.rb | lib/gauguin/color_space/rgb_vector.rb | module Gauguin
module ColorSpace
class RgbVector < Vector
MAX_VAUE = 255.0
# Observer. = 2°, Illuminant = D65
RGB_TO_XYZ = Matrix[[0.4124, 0.2126, 0.0193],
[0.3576, 0.7152, 0.1192],
[0.1805, 0.0722, 0.9505]]
def pivot!
self.each... | ruby | MIT | 4067ee2674990871d8bcc38466ee359f13d0e060 | 2026-01-04T17:43:30.804125Z | false |
jasonbellamy/jekyll-mermaid | https://github.com/jasonbellamy/jekyll-mermaid/blob/3363e4b156f438e791d66aa2fe6c37d7475c7b67/lib/jekyll-mermaid.rb | lib/jekyll-mermaid.rb | module Jekyll
class Mermaid < Liquid::Block
def initialize(tag_name, markup, tokens)
super
end
def render(context)
@config = context.registers[:site].config['mermaid']
"<script src=\"#{@config['src']}\"></script>"\
"<div class=\"mermaid\">#{super}</div>"
end
end
end
Liquid... | ruby | MIT | 3363e4b156f438e791d66aa2fe6c37d7475c7b67 | 2026-01-04T17:43:37.043292Z | false |
RealFaviconGenerator/rails_real_favicon | https://github.com/RealFaviconGenerator/rails_real_favicon/blob/05e8895597a4ecf6420a92ea37d4c215de7adfbc/test/rails_real_favicon_test.rb | test/rails_real_favicon_test.rb | require 'test_helper'
class RailsRealFaviconTest < ActiveSupport::TestCase
test "truth" do
assert_kind_of Module, RailsRealFavicon
end
end
| ruby | MIT | 05e8895597a4ecf6420a92ea37d4c215de7adfbc | 2026-01-04T17:43:37.290160Z | false |
RealFaviconGenerator/rails_real_favicon | https://github.com/RealFaviconGenerator/rails_real_favicon/blob/05e8895597a4ecf6420a92ea37d4c215de7adfbc/test/test_helper.rb | test/test_helper.rb | # Configure Rails Environment
ENV["RAILS_ENV"] = "test"
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
require "rails/test_help"
# Filter out Minitest backtrace while allowing backtrace from other libraries
# to be shown.
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
# Load... | ruby | MIT | 05e8895597a4ecf6420a92ea37d4c215de7adfbc | 2026-01-04T17:43:37.290160Z | false |
RealFaviconGenerator/rails_real_favicon | https://github.com/RealFaviconGenerator/rails_real_favicon/blob/05e8895597a4ecf6420a92ea37d4c215de7adfbc/test/dummy/app/jobs/application_job.rb | test/dummy/app/jobs/application_job.rb | class ApplicationJob < ActiveJob::Base
end
| ruby | MIT | 05e8895597a4ecf6420a92ea37d4c215de7adfbc | 2026-01-04T17:43:37.290160Z | false |
RealFaviconGenerator/rails_real_favicon | https://github.com/RealFaviconGenerator/rails_real_favicon/blob/05e8895597a4ecf6420a92ea37d4c215de7adfbc/test/dummy/app/helpers/application_helper.rb | test/dummy/app/helpers/application_helper.rb | module ApplicationHelper
end
| ruby | MIT | 05e8895597a4ecf6420a92ea37d4c215de7adfbc | 2026-01-04T17:43:37.290160Z | false |
RealFaviconGenerator/rails_real_favicon | https://github.com/RealFaviconGenerator/rails_real_favicon/blob/05e8895597a4ecf6420a92ea37d4c215de7adfbc/test/dummy/app/controllers/application_controller.rb | test/dummy/app/controllers/application_controller.rb | class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
end
| ruby | MIT | 05e8895597a4ecf6420a92ea37d4c215de7adfbc | 2026-01-04T17:43:37.290160Z | false |
RealFaviconGenerator/rails_real_favicon | https://github.com/RealFaviconGenerator/rails_real_favicon/blob/05e8895597a4ecf6420a92ea37d4c215de7adfbc/test/dummy/app/mailers/application_mailer.rb | test/dummy/app/mailers/application_mailer.rb | class ApplicationMailer < ActionMailer::Base
default from: 'from@example.com'
layout 'mailer'
end
| ruby | MIT | 05e8895597a4ecf6420a92ea37d4c215de7adfbc | 2026-01-04T17:43:37.290160Z | false |
RealFaviconGenerator/rails_real_favicon | https://github.com/RealFaviconGenerator/rails_real_favicon/blob/05e8895597a4ecf6420a92ea37d4c215de7adfbc/test/dummy/app/channels/application_cable/channel.rb | test/dummy/app/channels/application_cable/channel.rb | module ApplicationCable
class Channel < ActionCable::Channel::Base
end
end
| ruby | MIT | 05e8895597a4ecf6420a92ea37d4c215de7adfbc | 2026-01-04T17:43:37.290160Z | false |
RealFaviconGenerator/rails_real_favicon | https://github.com/RealFaviconGenerator/rails_real_favicon/blob/05e8895597a4ecf6420a92ea37d4c215de7adfbc/test/dummy/app/channels/application_cable/connection.rb | test/dummy/app/channels/application_cable/connection.rb | module ApplicationCable
class Connection < ActionCable::Connection::Base
end
end
| ruby | MIT | 05e8895597a4ecf6420a92ea37d4c215de7adfbc | 2026-01-04T17:43:37.290160Z | false |
RealFaviconGenerator/rails_real_favicon | https://github.com/RealFaviconGenerator/rails_real_favicon/blob/05e8895597a4ecf6420a92ea37d4c215de7adfbc/test/dummy/test/application_system_test_case.rb | test/dummy/test/application_system_test_case.rb | require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
end
| ruby | MIT | 05e8895597a4ecf6420a92ea37d4c215de7adfbc | 2026-01-04T17:43:37.290160Z | false |
RealFaviconGenerator/rails_real_favicon | https://github.com/RealFaviconGenerator/rails_real_favicon/blob/05e8895597a4ecf6420a92ea37d4c215de7adfbc/test/dummy/test/test_helper.rb | test/dummy/test/test_helper.rb | ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Add more helper methods to be used by all tests here...
end
| ruby | MIT | 05e8895597a4ecf6420a92ea37d4c215de7adfbc | 2026-01-04T17:43:37.290160Z | false |
RealFaviconGenerator/rails_real_favicon | https://github.com/RealFaviconGenerator/rails_real_favicon/blob/05e8895597a4ecf6420a92ea37d4c215de7adfbc/test/dummy/config/application.rb | test/dummy/config/application.rb | require_relative 'boot'
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
# require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "action_cable/engine"
require "sprockets/railti... | ruby | MIT | 05e8895597a4ecf6420a92ea37d4c215de7adfbc | 2026-01-04T17:43:37.290160Z | false |
RealFaviconGenerator/rails_real_favicon | https://github.com/RealFaviconGenerator/rails_real_favicon/blob/05e8895597a4ecf6420a92ea37d4c215de7adfbc/test/dummy/config/environment.rb | test/dummy/config/environment.rb | # Load the Rails application.
require_relative 'application'
# Initialize the Rails application.
Rails.application.initialize!
| ruby | MIT | 05e8895597a4ecf6420a92ea37d4c215de7adfbc | 2026-01-04T17:43:37.290160Z | false |
RealFaviconGenerator/rails_real_favicon | https://github.com/RealFaviconGenerator/rails_real_favicon/blob/05e8895597a4ecf6420a92ea37d4c215de7adfbc/test/dummy/config/puma.rb | test/dummy/config/puma.rb | # Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches... | ruby | MIT | 05e8895597a4ecf6420a92ea37d4c215de7adfbc | 2026-01-04T17:43:37.290160Z | false |
RealFaviconGenerator/rails_real_favicon | https://github.com/RealFaviconGenerator/rails_real_favicon/blob/05e8895597a4ecf6420a92ea37d4c215de7adfbc/test/dummy/config/routes.rb | test/dummy/config/routes.rb | Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
| ruby | MIT | 05e8895597a4ecf6420a92ea37d4c215de7adfbc | 2026-01-04T17:43:37.290160Z | false |
RealFaviconGenerator/rails_real_favicon | https://github.com/RealFaviconGenerator/rails_real_favicon/blob/05e8895597a4ecf6420a92ea37d4c215de7adfbc/test/dummy/config/spring.rb | test/dummy/config/spring.rb | %w(
.ruby-version
.rbenv-vars
tmp/restart.txt
tmp/caching-dev.txt
).each { |path| Spring.watch(path) }
| ruby | MIT | 05e8895597a4ecf6420a92ea37d4c215de7adfbc | 2026-01-04T17:43:37.290160Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.