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 | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/circle.rb | Ruby | mit | 186 | main | 543 | class Prawn::SVG::Elements::Circle < Prawn::SVG::Elements::Base
USE_NEW_CIRCLE_CALL = Prawn::Document.instance_methods.include?(:circle)
def parse
require_attributes 'r'
@x = x(attributes['cx'] || '0')
@y = y(attributes['cy'] || '0')
@r = pixels(attributes['r'])
require_positive_value @r
en... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/rect.rb | Ruby | mit | 186 | main | 1,728 | class Prawn::SVG::Elements::Rect < Prawn::SVG::Elements::Base
include Prawn::SVG::Calculators::ArcToBezierCurve
def parse
require_attributes 'width', 'height'
@x = x(attributes['x'] || '0')
@y = y(attributes['y'] || '0')
@width = x_pixels(attributes['width'])
@height = y_pixels(attributes['hei... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/text_component.rb | Ruby | mit | 186 | main | 10,099 | module Prawn::SVG
class Elements::TextComponent < Elements::DirectRenderBase
attr_reader :children, :parent_component
attr_reader :x_values, :y_values, :dx, :dy, :rotation, :text_length, :length_adjust
attr_reader :font, :fallback_fonts
attr_reader :inside_clip_path
def initialize(document, sourc... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/switch.rb | Ruby | mit | 186 | main | 2,210 | class Prawn::SVG::Elements::Switch < Prawn::SVG::Elements::Base
FEATURE_PREFIX = 'http://www.w3.org/TR/SVG11/feature#'.freeze
SUPPORTED_FEATURES = Set.new(
%w[
SVG
SVG-static
CoreAttribute
Structure
BasicStructure
ConditionalProcessing
Image
Style
Shape
... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/path.rb | Ruby | mit | 186 | main | 9,366 | class Prawn::SVG::Elements::Path < Prawn::SVG::Elements::Base
include Prawn::SVG::Calculators::ArcToBezierCurve
include Prawn::SVG::Pathable
INSIDE_SPACE_REGEXP = /[ \t\r\n,]*/.freeze
OUTSIDE_SPACE_REGEXP = /[ \t\r\n]*/.freeze
INSIDE_REGEXP = /#{INSIDE_SPACE_REGEXP}(?>([+-]?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/bbox_scaling.rb | Ruby | mit | 186 | main | 3,113 | module Prawn::SVG::Elements::BboxScaling
private
def build_object_bounding_box_calls(bbox, source_element = source)
bbox_left = bbox[0]
bbox_top = bbox[1]
bbox_right = bbox[2]
bbox_bottom = bbox[3]
bbox_w = bbox_right - bbox_left
bbox_h = bbox_top - bbox_bottom
unit_sizing = Prawn::SVG... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/ellipse.rb | Ruby | mit | 186 | main | 554 | class Prawn::SVG::Elements::Ellipse < Prawn::SVG::Elements::Base
USE_NEW_ELLIPSE_CALL = Prawn::Document.instance_methods.include?(:ellipse)
def parse
require_attributes 'rx', 'ry'
@x = x(attributes['cx'] || '0')
@y = y(attributes['cy'] || '0')
@rx = x_pixels(attributes['rx'])
@ry = y_pixels(at... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/image.rb | Ruby | mit | 186 | main | 4,792 | class Prawn::SVG::Elements::Image < Prawn::SVG::Elements::Base
class FakeIO
def initialize(data)
@data = data
end
def read
@data
end
def rewind; end
end
ImageData = Struct.new(:dimensions, :document)
def parse
require_attributes 'width', 'height'
raise SkipElementQui... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/use.rb | Ruby | mit | 186 | main | 4,509 | class Prawn::SVG::Elements::Use < Prawn::SVG::Elements::Base
attr_reader :referenced_element_class, :referenced_element_source
def parse
href = href_attribute
raise SkipElementError, 'use tag must have an href or xlink:href' if href.nil?
if href.start_with?('#')
resolve_local_reference(href[1..]... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/root.rb | Ruby | mit | 186 | main | 721 | class Prawn::SVG::Elements::Root < Prawn::SVG::Elements::Base
def initialize(document, source = document.root, parent_calls = [], state = ::Prawn::SVG::State.new)
super
end
def parse
state.viewport_sizing = @document.sizing
end
def apply
if [nil, 'inherit'].include?(properties.fill) || propertie... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/viewport.rb | Ruby | mit | 186 | main | 860 | class Prawn::SVG::Elements::Viewport < Prawn::SVG::Elements::Base
def parse
parent_dimensions = [state.viewport_sizing.viewport_width, state.viewport_sizing.viewport_height]
@sizing = Prawn::SVG::Calculators::DocumentSizing.new(parent_dimensions, attributes)
@sizing.calculate
@x = x_pixels(attribute... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/line.rb | Ruby | mit | 186 | main | 609 | class Prawn::SVG::Elements::Line < Prawn::SVG::Elements::Base
include Prawn::SVG::Pathable
def parse
# Lines are one dimensional, so cannot be filled.
computed_properties.fill = Prawn::SVG::Paint.none
@x1 = x_pixels(attributes['x1'] || 0)
@y1 = y_pixels(attributes['y1'] || 0)
@x2 = x_pixels(at... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/text_node.rb | Ruby | mit | 186 | main | 10,617 | module Prawn::SVG
class Elements::TextNode
Chunk = Struct.new(:text, :x, :y, :dx, :dy, :rotate, :base_width, :offset, :fixed_width, :font_runs)
attr_reader :component, :chunks
attr_accessor :text
def initialize(component, text, leading_space, trailing_space)
@component = component
@text ... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/text_path.rb | Ruby | mit | 186 | main | 5,053 | module Prawn::SVG
class Elements::TextPath < Elements::TextComponent
def parse
href = href_attribute
unless href&.start_with?('#')
warnings << '<textPath> must reference a path element'
raise SkipElementQuietly
end
@path_element = document.elements_by_id[href[1..]]
u... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/marker.rb | Ruby | mit | 186 | main | 2,507 | class Prawn::SVG::Elements::Marker < Prawn::SVG::Elements::Base
def parse
set_display_none
end
def container?
true
end
def apply_marker(element, point: nil, angle: 0)
sizing = Prawn::SVG::Calculators::DocumentSizing.new([0, 0], attributes)
sizing.document_width = attributes['markerWidth'] ||... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/base.rb | Ruby | mit | 186 | main | 8,108 | class Prawn::SVG::Elements::Base
extend Forwardable
include Prawn::SVG::Elements::CallDuplicator
include Prawn::SVG::Elements::BboxScaling
include Prawn::SVG::Calculators::Pixels
include Prawn::SVG::Attributes::Transform
include Prawn::SVG::Attributes::Opacity
include Prawn::SVG::Attributes::ClipPath
... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/polyline.rb | Ruby | mit | 186 | main | 450 | class Prawn::SVG::Elements::Polyline < Prawn::SVG::Elements::Base
include Prawn::SVG::Pathable
def parse
require_attributes('points')
@points = parse_points(attributes['points'])
end
def apply
apply_commands
apply_markers
end
protected
def commands
@commands ||= [
Prawn::SVG:... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/call_duplicator.rb | Ruby | mit | 186 | main | 1,034 | #
# Unfortunately, prawn mutates arguments passed in to it.
# When we make a copy of one of the call stacks, we need to make a deep
# duplicate of it so that the first time prawn mutates the arguments, it
# won't affect the subsequent calls.
#
module Prawn::SVG::Elements::CallDuplicator
private
def duplicate_calls... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/container.rb | Ruby | mit | 186 | main | 223 | class Prawn::SVG::Elements::Container < Prawn::SVG::Elements::Base
def parse
set_display_none if name == 'symbol' && !state.inside_use
set_display_none if name == 'defs'
end
def container?
true
end
end |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/mask.rb | Ruby | mit | 186 | main | 1,837 | class Prawn::SVG::Elements::Mask < Prawn::SVG::Elements::Base
def parse
set_display_none
end
def container?
true
end
def build_mask_calls(element)
bbox = element.bounding_box
mask_units = attributes['maskUnits'] || 'objectBoundingBox'
content_units = attributes['maskContentUnits'] || 'us... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/pattern.rb | Ruby | mit | 186 | main | 4,853 | class Prawn::SVG::Elements::Pattern < Prawn::SVG::Elements::Base
attr_reader :parent_pattern
def parse
raise SkipElementQuietly if attributes['id'].nil?
@parent_pattern = document.gradients[href_attribute[1..]] if href_attribute && href_attribute[0] == '#'
set_display_none
document.gradients[att... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/direct_render_base.rb | Ruby | mit | 186 | main | 1,177 | #
# This element base class is used for elements that render directly to the Prawn canvas.
#
# Initially when I wrote prawn-svg, I was expecting to have multiple renderers and thought separating the codebase
# from the Prawn renderer would be a good idea. However, it turns out that the Prawn renderer was the only one
... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/gradient.rb | Ruby | mit | 186 | main | 5,886 | class Prawn::SVG::Elements::Gradient < Prawn::SVG::Elements::Base
attr_reader :parent_gradient
attr_reader :x1, :y1, :x2, :y2, :cx, :cy, :r, :fx, :fy, :fr, :units, :stops, :transform_matrix, :wrap
TAG_NAME_TO_TYPE = {
'linearGradient' => :linear,
'radialGradient' => :radial
}.freeze
def parse
# ... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/text.rb | Ruby | mit | 186 | main | 3,011 | module Prawn::SVG
class Elements::Text < Elements::DirectRenderBase
Cursor = Struct.new(:x, :y)
def parse
@root_component = Elements::TextComponent.new(document, source, [], state.dup)
@root_component.process
reintroduce_trailing_and_leading_whitespace if @root_component.children
end
... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/polygon.rb | Ruby | mit | 186 | main | 509 | class Prawn::SVG::Elements::Polygon < Prawn::SVG::Elements::Base
include Prawn::SVG::Pathable
def parse
require_attributes('points')
@points = parse_points(attributes['points'])
end
def apply
apply_commands
apply_markers
end
protected
def commands
@commands ||= [
Prawn::SVG::... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/elements/clip_path.rb | Ruby | mit | 186 | main | 609 | class Prawn::SVG::Elements::ClipPath < Prawn::SVG::Elements::Base
def parse
state.inside_clip_path = true
set_display_none
end
def container?
true
end
def build_clip_calls(element)
units = attributes['clipPathUnits'] || 'userSpaceOnUse'
if units == 'objectBoundingBox'
bbox = eleme... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/calculators/document_sizing.rb | Ruby | mit | 186 | main | 3,540 | module Prawn::SVG::Calculators
class DocumentSizing
DEFAULT_ASPECT_RATIO = 'xMidYMid meet'.freeze
attr_writer :document_width, :document_height
attr_writer :view_box, :preserve_aspect_ratio
attr_reader :bounds
attr_reader :x_offset, :y_offset, :x_scale, :y_scale
attr_reader :viewport_width, ... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/calculators/arc_to_bezier_curve.rb | Ruby | mit | 186 | main | 1,865 | module Prawn::SVG::Calculators
module ArcToBezierCurve
protected
# Convert the elliptical arc to a cubic bézier curve using this algorithm:
# http://www.spaceroots.org/documents/ellipse/elliptical-arc.pdf
#
# eta_1 and eta_2 are the eccentric anomaly angles (the parametric angles on the
# uni... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/calculators/pixels.rb | Ruby | mit | 186 | main | 1,585 | module Prawn::SVG::Calculators::Pixels
class Measurement
def self.to_pixels(value, axis_length = nil, font_size: Prawn::SVG::Properties::EM)
if value.respond_to?(:to_pixels)
value.to_pixels(axis_length, font_size)
elsif value.is_a?(String)
value = value.strip
value = Prawn::SVG... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/calculators/path_length.rb | Ruby | mit | 186 | main | 5,569 | module Prawn::SVG::Calculators
class PathLength
Segment = Struct.new(:start_point, :end_point, :type, :control_points, :segment_length, :cumulative_length, :lookup_table)
SUBDIVISION_TOLERANCE = 0.01
LOOKUP_TABLE_STEPS = 64
attr_reader :total_length
def initialize(commands)
@segments = []... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | lib/prawn/svg/calculators/aspect_ratio.rb | Ruby | mit | 186 | main | 1,735 | module Prawn::SVG::Calculators
class AspectRatio
attr_reader :align, :defer
attr_reader :width, :height, :x, :y
def initialize(value, container_dimensions, object_dimensions)
values = (value || 'xMidYMid meet').split
@x = @y = 0
if values.first == 'defer'
@defer = true
... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/spec_helper.rb | Ruby | mit | 186 | main | 1,540 | require 'bundler'
Bundler.require(:default, :development)
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f }
module Support
def flatten_calls(_calls)
[].tap do |flattened_calls|
... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/integration_spec.rb | Ruby | mit | 186 | main | 6,563 | require 'spec_helper'
require 'open-uri'
describe 'Integration test' do
root = "#{File.dirname(__FILE__)}/.."
describe 'a basic SVG file' do
let(:document) { Prawn::SVG::Document.new(svg, [800, 600], { enable_web_requests: false }) }
let(:element) { Prawn::SVG::Elements::Root.new(document) }
let(:svg... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/properties_spec.rb | Ruby | mit | 186 | main | 13,786 | require 'spec_helper'
RSpec.describe Prawn::SVG::Properties do
subject { Prawn::SVG::Properties.new }
describe '#load_default_stylesheet' do
it 'loads in the defaults and returns self' do
expect(subject.load_default_stylesheet).to eq subject
expect(subject.font_family).to eq 'sans-serif'
end
... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/paint_spec.rb | Ruby | mit | 186 | main | 3,373 | require 'spec_helper'
RSpec.describe Prawn::SVG::Paint do
let(:red) { Prawn::SVG::Color::RGB.new('ff0000') }
describe '.parse' do
it 'parses a color' do
expect(described_class.parse('red')).to eq(described_class.new(red, nil))
end
it 'parses an rgb color with an icc color, ignoring the icc colo... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/pdfmatrix_spec.rb | Ruby | mit | 186 | main | 1,894 | require 'spec_helper'
RSpec.describe Prawn::SVG::PDFMatrix do
subject do
obj = Object.new
obj.extend(Prawn::SVG::PDFMatrix)
obj
end
describe '#load_matrix' do
it 'converts a PDF-style matrix into a Ruby Matrix' do
expect(subject.load_matrix([1.0, 0.0, 0.0, 1.0, 5.0, 7.0])).to eq(Matrix[
... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/document_spec.rb | Ruby | mit | 186 | main | 8,962 | require "#{File.dirname(__FILE__)}/../../spec_helper"
describe Prawn::SVG::Document do
let(:bounds) { [100, 100] }
let(:options) { { enable_web_requests: false } }
describe '#initialize' do
context 'with a well-formed document' do
let(:svg) { '<svg></svg>' }
let(:options) { { color_mode: :cmyk, ... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/url_loader_spec.rb | Ruby | mit | 186 | main | 3,896 | require 'spec_helper'
describe Prawn::SVG::UrlLoader do
let(:enable_cache) { true }
let(:enable_web) { true }
let(:enable_file) { '.' }
let(:loader) do
Prawn::SVG::UrlLoader.new(enable_cache: enable_cache, enable_web: enable_web, enable_file_with_root: enable_file)
end
describe '#initialize' do
... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/percentage_spec.rb | Ruby | mit | 186 | main | 1,839 | require 'spec_helper'
describe Prawn::SVG::Percentage do
describe '.parse' do
it 'parses a percentage' do
expect(described_class.parse('1.23%')).to eq(described_class.new(1.23))
end
it 'parses a percentage with a positive sign' do
expect(described_class.parse('+1.23%')).to eq(described_class... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/transform_parser_spec.rb | Ruby | mit | 186 | main | 2,733 | require 'spec_helper'
RSpec.describe Prawn::SVG::TransformParser do
class Test
include Prawn::SVG::Calculators::Pixels
include Prawn::SVG::TransformParser
State = Struct.new(:viewport_sizing)
Properties = Struct.new(:numeric_font_size)
Document = Struct.new(:sizing)
def document
Docum... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/font_registry_spec.rb | Ruby | mit | 186 | main | 16,336 | require 'spec_helper'
RSpec.describe Prawn::SVG::FontRegistry do
describe '#load' do
let(:pdf) { Prawn::Document.new }
let(:font_registry) { Prawn::SVG::FontRegistry.new(pdf.font_families) }
it 'matches a built in font' do
expect(font_registry.load("blah, 'courier', nothing").name).to eq('Courier'... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/font_spec.rb | Ruby | mit | 186 | main | 2,537 | require "#{File.dirname(__FILE__)}/../../spec_helper"
describe Prawn::SVG::Font do
describe '#initialize' do
it 'sets name, weight, and style' do
font = Prawn::SVG::Font.new('Arial', :bold, :italic)
expect(font.name).to eq('Arial')
expect(font.weight).to eq(:bold)
expect(font.style).to eq... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/interface_spec.rb | Ruby | mit | 186 | main | 6,142 | require 'spec_helper'
describe Prawn::SVG::Interface do
let(:bounds) { double(width: 800, height: 600, absolute_left: 0, absolute_top: 0) }
let(:prawn) { instance_double(Prawn::Document, font_families: {}, bounds: bounds, cursor: 600) }
let(:svg) { '<svg width="250" height="100"></svg>' }
describe '#initi... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/font_metrics_spec.rb | Ruby | mit | 186 | main | 404 | require 'spec_helper'
RSpec.describe Prawn::SVG::FontMetrics do
let(:pdf) { Prawn::Document.new }
describe '.underline_metrics' do
it 'does not return the same values for different font sizes' do
underline_10 = described_class.underline_metrics(pdf, 10)
underline_20 = described_class.underline_met... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/length_spec.rb | Ruby | mit | 186 | main | 2,918 | require 'spec_helper'
describe Prawn::SVG::Length do
describe '.parse' do
it 'parses a length' do
expect(described_class.parse('1.23em')).to eq(described_class.new(1.23, :em))
end
it 'parses a length with a positive sign' do
expect(described_class.parse('+1.23em')).to eq(described_class.new(... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/ttf_spec.rb | Ruby | mit | 186 | main | 867 | require 'spec_helper'
RSpec.describe Prawn::SVG::TTF do
subject { Prawn::SVG::TTF.new(filename) }
context 'with a truetype font' do
let(:filename) { "#{File.dirname(__FILE__)}/../../sample_ttf/OpenSans-SemiboldItalic.ttf" }
it 'gets the English family and subfamily from the font file' do
expect(sub... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/pathable_spec.rb | Ruby | mit | 186 | main | 2,748 | require 'spec_helper'
RSpec.describe Prawn::SVG::Pathable do
class FakeElement < Prawn::SVG::Elements::Base
include Prawn::SVG::Pathable
def initialize(*args)
super
@properties = Struct.new(:marker_start, :marker_mid, :marker_end).new
end
public :apply_commands
public :apply_markers... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/funciri_spec.rb | Ruby | mit | 186 | main | 2,066 | require 'spec_helper'
describe Prawn::SVG::FuncIRI do
describe '.parse' do
it 'parses a URL' do
expect(described_class.parse('url(#foo)')).to eq(described_class.new('#foo'))
end
it 'parses a URL with whitespace' do
expect(described_class.parse('url( #foo )')).to eq(described_class.new('#foo'... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/ttc_spec.rb | Ruby | mit | 186 | main | 977 | require 'spec_helper'
RSpec.describe Prawn::SVG::TTC do
subject { Prawn::SVG::TTC.new(filename) }
context 'with a TrueType Collection font' do
let(:filename) { "#{File.dirname(__FILE__)}/../../sample_ttf/TestFamily.ttc" }
it 'extracts family, subfamily, index, and weight class for each font in the collec... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/color_spec.rb | Ruby | mit | 186 | main | 1,487 | require "#{File.dirname(__FILE__)}/../../spec_helper"
describe Prawn::SVG::Color do
describe '::parse' do
def parse(value)
values = Prawn::SVG::CSS::ValuesParser.parse(value)
Prawn::SVG::Color.parse(values[0])
end
it 'converts #xxx to an RGB color' do
expect(parse('#9ab')).to eq Prawn:... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/elements/base_spec.rb | Ruby | mit | 186 | main | 6,753 | require 'spec_helper'
describe Prawn::SVG::Elements::Base do
let(:svg) { '<svg></svg>' }
let(:document) do
Prawn::SVG::Document.new(svg, [800, 600], { enable_web_requests: false },
font_registry: Prawn::SVG::FontRegistry.new('Helvetica' => { normal: nil }))
end
let(:parent_calls) { [] }
let(:elemen... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/elements/marker_spec.rb | Ruby | mit | 186 | main | 2,884 | require 'spec_helper'
RSpec.describe Prawn::SVG::Elements::Marker do
let(:svg) do
<<-SVG
<svg>
<marker id="Triangle"
viewBox="0 0 10 10" refX="0" refY="5"
markerUnits="strokeWidth"
markerWidth="4" markerHeight="3"
orient="auto">
<path d="M 0 0 L 10 ... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/elements/mask_spec.rb | Ruby | mit | 186 | main | 11,738 | require 'spec_helper'
describe Prawn::SVG::Elements::Mask do
let(:document) { Prawn::SVG::Document.new(svg, [800, 600], { enable_web_requests: false }) }
let(:element) { Prawn::SVG::Elements::Root.new(document, document.root, []) }
let(:flattened_calls) { flatten_calls(element.base_calls) }
def find_call(call... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/elements/use_spec.rb | Ruby | mit | 186 | main | 8,693 | require 'spec_helper'
describe Prawn::SVG::Elements::Use do
let(:document) { Prawn::SVG::Document.new(svg, [800, 600], options) }
let(:element) { Prawn::SVG::Elements::Root.new(document, document.root, []) }
let(:options) { { enable_web_requests: false } }
let(:flattened_calls) { flatten_calls(element.base_cal... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/elements/root_spec.rb | Ruby | mit | 186 | main | 886 | require 'spec_helper'
describe Prawn::SVG::Elements::Root do
let(:color_mode) { :rgb }
let(:sizing) do
instance_double(Prawn::SVG::Calculators::DocumentSizing, x_offset: 0, y_offset: 0, x_scale: 1, y_scale: 1)
end
let(:document) do
instance_double(Prawn::SVG::Document, color_mode: color_mode, sizing: s... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/elements/polyline_spec.rb | Ruby | mit | 186 | main | 1,294 | require 'spec_helper'
RSpec.describe Prawn::SVG::Elements::Polyline do
let(:document) { Prawn::SVG::Document.new(svg, [800, 600], { width: 800, height: 600, enable_web_requests: false }) }
subject do
Prawn::SVG::Elements::Polyline.new(document, document.root, [], Prawn::SVG::State.new)
end
context 'with ... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/elements/gradient_spec.rb | Ruby | mit | 186 | main | 7,977 | require 'spec_helper'
describe Prawn::SVG::Elements::Gradient do
let(:document) { Prawn::SVG::Document.new(svg, [800, 600], { width: 800, height: 600, enable_web_requests: false }) }
let(:root_element) { Prawn::SVG::Elements::Root.new(document, document.root, []) }
let(:element) { document.gradients['flag'] }
... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/elements/pattern_spec.rb | Ruby | mit | 186 | main | 7,711 | require 'spec_helper'
describe Prawn::SVG::Elements::Pattern do
let(:document) { Prawn::SVG::Document.new(svg, [800, 600], { width: 800, height: 600, enable_web_requests: false }) }
let(:root_element) { Prawn::SVG::Elements::Root.new(document, document.root, []) }
let(:element) { document.gradients['pat'] }
b... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/elements/switch_spec.rb | Ruby | mit | 186 | main | 10,058 | require 'spec_helper'
describe Prawn::SVG::Elements::Switch do
let(:options) { { enable_web_requests: false } }
let(:document) { Prawn::SVG::Document.new(svg, [800, 600], options) }
let(:element) { Prawn::SVG::Elements::Root.new(document, document.root, []) }
let(:flattened_calls) { flatten_calls(element.base_... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/elements/polygon_spec.rb | Ruby | mit | 186 | main | 1,362 | require 'spec_helper'
RSpec.describe Prawn::SVG::Elements::Polygon do
let(:document) { Prawn::SVG::Document.new(svg, [800, 600], { width: 800, height: 600, enable_web_requests: false }) }
subject do
Prawn::SVG::Elements::Polygon.new(document, document.root, [], Prawn::SVG::State.new)
end
context 'with a ... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/elements/text_path_spec.rb | Ruby | mit | 186 | main | 5,639 | require 'spec_helper'
describe Prawn::SVG::Elements::TextPath do
let(:document) do
Prawn::SVG::Document.new(svg, [800, 600], { enable_web_requests: false },
font_registry: Prawn::SVG::FontRegistry.new('Helvetica' => { normal: nil }, 'Times-Roman' => { normal: nil }))
end
let(:element) { Prawn::SVG::Ele... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/elements/text_spec.rb | Ruby | mit | 186 | main | 30,540 | require "#{File.dirname(__FILE__)}/../../../spec_helper"
describe Prawn::SVG::Elements::Text do
let(:document) do
Prawn::SVG::Document.new(svg, [800, 600], { enable_web_requests: false },
font_registry: Prawn::SVG::FontRegistry.new('Helvetica' => { normal: nil }, 'Courier' => { normal: nil }, 'Times-Roman'... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/elements/line_spec.rb | Ruby | mit | 186 | main | 1,508 | require 'spec_helper'
RSpec.describe Prawn::SVG::Elements::Line do
let(:document) { Prawn::SVG::Document.new(svg, [800, 600], { width: 800, height: 600, enable_web_requests: false }) }
subject do
Prawn::SVG::Elements::Line.new(document, document.root, [], fake_state)
end
context 'with attributes specifie... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/elements/image_spec.rb | Ruby | mit | 186 | main | 5,678 | require 'spec_helper'
describe Prawn::SVG::Elements::Image do
let(:document) { Prawn::SVG::Document.new(svg, [800, 600], options) }
let(:element) { Prawn::SVG::Elements::Root.new(document, document.root, []) }
let(:options) { { enable_web_requests: false, enable_file_requests_with_root: '.' } }
let(:flattened_... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/elements/path_spec.rb | Ruby | mit | 186 | main | 8,662 | require 'spec_helper'
describe Prawn::SVG::Elements::Path do
let(:source) { double(name: 'path', attributes: {}) }
let(:state) { Prawn::SVG::State.new }
let(:path) { Prawn::SVG::Elements::Path.new(nil, source, [], state) }
before do
allow(path).to receive(:attributes).and_return('d' => d)
end
describ... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/css/stylesheets_spec.rb | Ruby | mit | 186 | main | 15,781 | require 'spec_helper'
RSpec.describe Prawn::SVG::CSS::Stylesheets do
describe 'typical usage' do
let(:svg) { <<-SVG }
<svg>
<style>
#inner rect { fill: #0000ff; }
#outer { fill: #220000; }
.hero > rect { fill: #00ff00; }
rect { fill: #ff0000; }
rect... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/css/font_family_parser_spec.rb | Ruby | mit | 186 | main | 917 | require 'spec_helper'
RSpec.describe Prawn::SVG::CSS::FontFamilyParser do
describe '#parse' do
it 'correctly handles quotes and escaping' do
tests = {
'' => [],
'font' => ['font'],
'font name, other font' => ['font name', 'other font'],... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/css/values_parser_spec.rb | Ruby | mit | 186 | main | 414 | require 'spec_helper'
RSpec.describe Prawn::SVG::CSS::ValuesParser do
it 'parses specified values' do
values = 'hello world url("#myid") no-quote(very good) escaping(")\\")ok") rgb( 1,4, 5 )'
expect(described_class.parse(values)).to eq [
'hello',
'world',
['url', ['#myid']],
['no-qu... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/css/font_face_parser_spec.rb | Ruby | mit | 186 | main | 2,921 | require 'spec_helper'
RSpec.describe Prawn::SVG::CSS::FontFaceParser do
describe '.parse_src' do
it 'parses a simple url() source' do
result = described_class.parse_src('url("font.ttf")')
expect(result).to eq([{ type: :url, url: 'font.ttf', format: nil }])
end
it 'parses a url() with format(... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/css/selector_parser_spec.rb | Ruby | mit | 186 | main | 2,028 | require 'spec_helper'
RSpec.describe Prawn::SVG::CSS::SelectorParser do
describe '::parse' do
it 'parses a simple selector' do
expect(described_class.parse('div')).to eq [{ name: 'div' }]
expect(described_class.parse('.c1')).to eq [{ class: ['c1'] }]
end
it 'parses a complex selector' do
... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/calculators/document_sizing_spec.rb | Ruby | mit | 186 | main | 5,478 | require "#{File.dirname(__FILE__)}/../../../spec_helper"
describe Prawn::SVG::Calculators::DocumentSizing do
let(:attributes) do
{ 'width' => '150', 'height' => '200', 'viewBox' => '0 -30 300 800', 'preserveAspectRatio' => 'xMaxYMid meet' }
end
let(:bounds) { [1200, 800] }
let(:sizing) { Prawn::SVG::Calc... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/calculators/pixels_spec.rb | Ruby | mit | 186 | main | 2,492 | require 'spec_helper'
describe Prawn::SVG::Calculators::Pixels do
class TestPixelsCalculator
include Prawn::SVG::Calculators::Pixels
def computed_properties
Struct.new(:numeric_font_size).new(16)
end
[:x, :y, :pixels, :x_pixels, :y_pixels].each { |method| public method }
end
let(:viewpor... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/calculators/path_length_spec.rb | Ruby | mit | 186 | main | 3,760 | require 'spec_helper'
describe Prawn::SVG::Calculators::PathLength do
let(:move) { Prawn::SVG::Pathable::Move }
let(:line) { Prawn::SVG::Pathable::Line }
let(:curve) { Prawn::SVG::Pathable::Curve }
let(:close) { Prawn::SVG::Pathable::Close }
describe 'horizontal line' do
subject { described_class.new([m... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/calculators/aspect_ratio_spec.rb | Ruby | mit | 186 | main | 3,543 | require "#{File.dirname(__FILE__)}/../../../spec_helper"
describe Prawn::SVG::Calculators::AspectRatio do
def test(*args)
aspect = Prawn::SVG::Calculators::AspectRatio.new(*args)
[[aspect.width, aspect.height], [aspect.x, aspect.y]]
end
it 'handles none' do
expect(test('none', [50, 80], [100, 100]))... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/attributes/transform_spec.rb | Ruby | mit | 186 | main | 1,626 | require 'spec_helper'
describe Prawn::SVG::Attributes::Transform do
class TransformTestElement
include Prawn::SVG::Attributes::Transform
attr_accessor :attributes, :warnings
def initialize
@warnings = []
@attributes = {}
end
def transformable?
true
end
end
let(:eleme... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/attributes/opacity_spec.rb | Ruby | mit | 186 | main | 2,656 | require 'spec_helper'
describe Prawn::SVG::Attributes::Opacity do
class OpacityTestElement
include Prawn::SVG::Attributes::Opacity
attr_accessor :properties, :state
def initialize
@properties = ::Prawn::SVG::Properties.new
@state = ::Prawn::SVG::State.new
end
def computed_propertie... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/attributes/stroke_spec.rb | Ruby | mit | 186 | main | 5,001 | require 'spec_helper'
RSpec.describe Prawn::SVG::Attributes::Stroke do
let(:document) { Prawn::SVG::Document.new(svg, [800, 600], { width: 800, height: 600, enable_web_requests: false }) }
subject do
Prawn::SVG::Elements::Line.new(document, document.root, [], fake_state)
end
describe 'stroke-dashoffset' ... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/attributes/clip_path_spec.rb | Ruby | mit | 186 | main | 8,079 | require 'spec_helper'
RSpec.describe Prawn::SVG::Attributes::ClipPath do
let(:font_registry) { Prawn::SVG::FontRegistry.new('Helvetica' => { normal: nil }) }
let(:document) { Prawn::SVG::Document.new(svg, [800, 600], { enable_web_requests: false }, font_registry: font_registry) }
let(:element) { Prawn::SVG::Elem... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/loaders/data_spec.rb | Ruby | mit | 186 | main | 1,503 | require 'spec_helper'
RSpec.describe Prawn::SVG::Loaders::Data do
let(:uri) { URI(url) }
subject { Prawn::SVG::Loaders::Data.new.from_url(url) }
context 'with a valid image/png data URL' do
let(:url) { 'data:image/png;base64,aGVsbG8=' }
it 'loads the data' do
expect(subject).to eq 'hello'
en... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/loaders/web_spec.rb | Ruby | mit | 186 | main | 1,000 | require 'spec_helper'
RSpec.describe Prawn::SVG::Loaders::Web do
let(:url) { 'http://hello.there/path' }
let(:uri) { URI(url) }
subject { Prawn::SVG::Loaders::Web.new.from_url(url) }
it 'loads an HTTP URL' do
expect(Net::HTTP).to receive(:get).with(uri).and_return('hello!')
expect(subject).to eq 'hel... |
github | mogest/prawn-svg | https://github.com/mogest/prawn-svg | spec/prawn/svg/loaders/file_spec.rb | Ruby | mit | 186 | main | 4,113 | require 'spec_helper'
RSpec.describe Prawn::SVG::Loaders::File do
let(:root_path) { '.' }
let(:fake_root_path) { '/some' }
let(:file_loader) { Prawn::SVG::Loaders::File.new(root_path) }
subject { file_loader.from_url(url) }
context 'when an invalid path is supplied' do
let(:root_path) { '/does/not/exis... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | flow_core.gemspec | Ruby | mit | 186 | master | 1,052 | # frozen_string_literal: true
$LOAD_PATH.push File.expand_path("lib", __dir__)
# Maintain your gem's version:
require "flow_core/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |spec|
spec.name = "flow_core"
spec.version = FlowCore::VERSION
spec.authors = ["j... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | Gemfile | Ruby | mit | 186 | master | 1,369 | # frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Declare your gem's dependencies in flow_core.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :developm... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | Rakefile | Ruby | mit | 186 | master | 599 | # frozen_string_literal: true
require "bundler/setup"
require "rdoc/task"
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = "rdoc"
rdoc.title = "FlowCore"
rdoc.options << "--line-numbers"
rdoc.rdoc_files.include("README.md")
rdoc.rdoc_files.include("lib/**/*.rb")
end
APP_RAKEFILE = File.expand_path("test/... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | db/migrate/20200130200532_create_workflow_tables.rb | Ruby | mit | 186 | master | 5,355 | # frozen_string_literal: true
class CreateWorkflowTables < ActiveRecord::Migration[6.0]
def change
create_table :flow_core_workflows do |t|
t.string :name, null: false
t.string :tag
t.integer :verified, null: false, default: false
t.datetime :verified_at
t.string :type
t.ti... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | db/migrate/20200130200533_create_pipeline_tables.rb | Ruby | mit | 186 | master | 2,045 | # frozen_string_literal: true
class CreatePipelineTables < ActiveRecord::Migration[6.0]
def change
create_table :flow_core_pipelines do |t|
t.string :name, null: false
t.string :type
t.timestamps
end
create_table :flow_core_steps do |t|
t.references :pipeline, null: false, forei... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | lib/flow_core.rb | Ruby | mit | 186 | master | 431 | # frozen_string_literal: true
require "rgl/adjacency"
require "rgl/dijkstra"
require "rgl/topsort"
require "rgl/traversal"
require "rgl/path"
require "acts_as_list"
require "ancestry"
require "flow_core/engine"
require "flow_core/errors"
require "flow_core/arc_guardable"
require "flow_core/task_callbacks"
require "... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | lib/flow_core/definition.rb | Ruby | mit | 186 | master | 399 | # frozen_string_literal: true
require "flow_core/definition/place"
require "flow_core/definition/transition"
require "flow_core/definition/net"
require "flow_core/definition/trigger"
require "flow_core/definition/guard"
module FlowCore::Definition
class << self
def build(attributes = {}, &block)
FlowCore:... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | lib/flow_core/task_callbacks.rb | Ruby | mit | 186 | master | 379 | # frozen_string_literal: true
module FlowCore
module TaskCallbacks
extend ActiveSupport::Concern
def on_task_enable(_task); end
def on_task_finish(_task); end
def on_task_terminate(_task); end
def on_task_suspend(_task); end
def on_task_resume(_task); end
def on_task_errored(_task, ... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | lib/flow_core/engine.rb | Ruby | mit | 186 | master | 264 | # frozen_string_literal: true
module FlowCore
class Engine < ::Rails::Engine
initializer "flow_core.load_default_i18n" do
ActiveSupport.on_load(:i18n) do
I18n.load_path << File.expand_path("locale/en.yml", __dir__)
end
end
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | lib/flow_core/task_executable.rb | Ruby | mit | 186 | master | 802 | # frozen_string_literal: true
module FlowCore
module TaskExecutable
extend ActiveSupport::Concern
included do
has_one :task, as: :executable, class_name: "FlowCore::Task", autosave: true, required: true
has_one :transition, -> { readonly }, through: :task, class_name: "FlowCore::Transition"
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | lib/flow_core/arc_guardable.rb | Ruby | mit | 186 | master | 238 | # frozen_string_literal: true
module FlowCore
module ArcGuardable
extend ActiveSupport::Concern
def permit?(_task)
raise NotImplementedError
end
def description
raise NotImplementedError
end
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | lib/flow_core/errors.rb | Ruby | mit | 186 | master | 305 | # frozen_string_literal: true
module FlowCore
# Generic base class for all Workflow Core exceptions.
class Error < StandardError; end
class UnverifiedWorkflow < Error; end
class InvalidTransition < Error; end
class NoNewTokenCreated < Error; end
class ForbiddenOperation < Error; end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | lib/flow_core/violations.rb | Ruby | mit | 186 | master | 6,774 | # frozen_string_literal: true
require "active_support/core_ext/array/conversions"
require "active_support/core_ext/string/inflections"
require "active_support/core_ext/object/deep_dup"
require "active_support/core_ext/string/filters"
module FlowCore
class Violations
include Enumerable
MESSAGE_OPTIONS = %i[... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | lib/flow_core/definition/transition.rb | Ruby | mit | 186 | master | 2,661 | # frozen_string_literal: true
module FlowCore::Definition
class Transition
attr_reader :net, :tag, :attributes, :trigger, :input_tags, :output_tags
private :net
def initialize(net, tag, attributes = {}, &block)
raise TypeError unless net.is_a? FlowCore::Definition::Net
raise TypeError unles... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | lib/flow_core/definition/trigger.rb | Ruby | mit | 186 | master | 849 | # frozen_string_literal: true
module FlowCore::Definition
class Trigger
def initialize(attributes)
constant_or_klass = attributes.is_a?(Hash) ? attributes.delete(:type) : attributes
@klass =
if constant_or_klass.is_a? String
constant_or_klass.safe_constantize
else
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | lib/flow_core/definition/guard.rb | Ruby | mit | 186 | master | 838 | # frozen_string_literal: true
module FlowCore::Definition
class Guard
def initialize(attributes)
constant_or_klass = attributes.is_a?(Hash) ? attributes.delete(:type) : attributes
@klass =
if constant_or_klass.is_a? String
constant_or_klass.safe_constantize
else
co... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | lib/flow_core/definition/place.rb | Ruby | mit | 186 | master | 657 | # frozen_string_literal: true
module FlowCore::Definition
class Place
attr_reader :tag, :attributes
def initialize(tag, attributes = {})
raise TypeError unless tag.is_a? Symbol
@tag = tag
@attributes = attributes.with_indifferent_access.except(FlowCore::Place::FORBIDDEN_ATTRIBUTES)
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | lib/flow_core/definition/net.rb | Ruby | mit | 186 | master | 3,127 | # frozen_string_literal: true
module FlowCore::Definition
class Net
attr_reader :attributes, :places, :transitions, :start_tag, :end_tag
def initialize(attributes = {})
@attributes = attributes.with_indifferent_access.except(FlowCore::Workflow::FORBIDDEN_ATTRIBUTES)
@places = []
@transitio... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | app/models/flow_core/transition.rb | Ruby | mit | 186 | master | 4,790 | # frozen_string_literal: true
module FlowCore
class Transition < FlowCore::ApplicationRecord
self.table_name = "flow_core_transitions"
FORBIDDEN_ATTRIBUTES = %i[workflow_id created_at updated_at].freeze
belongs_to :generated_by,
class_name: "FlowCore::Step", foreign_key: :generated_by_st... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.