class Mahoujin::Graphics::Styles::Basic

Attributes

basic[R]

Public Class Methods

new() click to toggle source
# File lib/mahoujin/graphics/styles/basic.rb, line 7
def initialize
  initialize_basic
  initialize_atoms
end

Public Instance Methods

query(atom, attribute) click to toggle source
# File lib/mahoujin/graphics/styles/basic.rb, line 12
def query(atom, attribute)
  @atoms.fetch(atom).fetch(attribute)
end

Private Instance Methods

initialize_atoms() click to toggle source
# File lib/mahoujin/graphics/styles/basic.rb, line 27
def initialize_atoms
  @atoms = {}

  @atoms[Atoms::Terminal]    = { bsize: { width: 2 * 0.618, height: 1 + 2 * 0.618 }.freeze, font: {              }.freeze, background: '#FFFFFF' }
  @atoms[Atoms::NonTerminal] = { bsize: { width: 2 * 0.618, height: 1 + 2 * 0.618 }.freeze, font: {   bold: true }.freeze, background: '#FFFFFF' }
  @atoms[Atoms::Prose]       = { bsize: { width: 2 * 0.618, height: 1 + 2 * 0.618 }.freeze, font: { italic: true }.freeze, background: '#FFFFFF' }
  @atoms[Atoms::Exception]   = { bsize: { width: 2 * 0.618, height: 1 + 2 * 0.618 }.freeze, font: { italic: true }.freeze, background: '#FFFFFF' }
  @atoms[Atoms::RuleName]    = { bsize: { width: 0        , height: 1             }.freeze, font: {   bold: true }.freeze }

  @atoms[Atoms::ZeroOrMoreRepetition] = { padding: { top: 2, bottom: 2, left: 3, right: 3 }.freeze }
  @atoms[Atoms::Optional]             = { padding: {         bottom: 2, left: 2, right: 2 }.freeze }
  @atoms[Atoms::SpecificRepetition]   = { padding: { top: 2,            left: 1, right: 1 }.freeze }

  @atoms[Atoms::Concatenation] = { space: 1 }
  @atoms[Atoms::Choice]        = { space: 1, padding: {                    left: 2, right: 2 }.freeze }
  @atoms[Atoms::Rule]          = { space: 2, padding: {                    left: 2, right: 2 }.freeze }
  @atoms[Atoms::Syntax]        = { space: 4, padding: { top: 2, bottom: 2, left: 2, right: 2 }.freeze }
end
initialize_basic() click to toggle source
# File lib/mahoujin/graphics/styles/basic.rb, line 18
def initialize_basic
  @basic = {}
  @basic[:font]  = { family: 'serif', size: 12 }.freeze
  @basic[:line]  = { width: 1 }.freeze

  @basic[:unit] = nil
  @basic[:corner] = { radius: 0.618 }.freeze
end