Class: GeoPattern::PatternStore

Inherits:
Object
  • Object
show all
Defined in:
lib/geo_pattern/pattern_store.rb

Overview

rubocop:enable Style/ConstantName

Instance Method Summary collapse

Constructor Details

#initializePatternStore


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/geo_pattern/pattern_store.rb', line 28

def initialize
  @store = {
    chevrons: StructureGenerators::ChevronsGenerator,
    concentric_circles: StructureGenerators::ConcentricCirclesGenerator,
    diamonds: StructureGenerators::DiamondsGenerator,
    hexagons: StructureGenerators::HexagonsGenerator,
    mosaic_squares: StructureGenerators::MosaicSquaresGenerator,
    nested_squares: StructureGenerators::NestedSquaresGenerator,
    octagons: StructureGenerators::OctagonsGenerator,
    overlapping_circles: StructureGenerators::OverlappingCirclesGenerator,
    overlapping_rings: StructureGenerators::OverlappingRingsGenerator,
    plaid: StructureGenerators::PlaidGenerator,
    plus_signs: StructureGenerators::PlusSignsGenerator,
    sine_waves: StructureGenerators::SineWavesGenerator,
    squares: StructureGenerators::SquaresGenerator,
    tessellation: StructureGenerators::TessellationGenerator,
    triangles: StructureGenerators::TrianglesGenerator,
    xes: StructureGenerators::XesGenerator
  }
end

Instance Method Details

#[](pattern) ⇒ Object


49
50
51
52
53
# File 'lib/geo_pattern/pattern_store.rb', line 49

def [](pattern)
  $stderr.puts 'String pattern references are deprecated as of 1.3.0' if pattern.is_a?(String)

  store[pattern.to_s.to_sym]
end

#allObject


55
56
57
# File 'lib/geo_pattern/pattern_store.rb', line 55

def all
  store.values
end

#known?(pattern) ⇒ Boolean


59
60
61
# File 'lib/geo_pattern/pattern_store.rb', line 59

def known?(pattern)
  store.key?(pattern.to_s.to_sym)
end