class Mahoujin::Graphics::Styles::Json

Attributes

basic[R]

Public Class Methods

new() click to toggle source
# File lib/mahoujin/graphics/styles/json.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/json.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/json.rb, line 27
def initialize_atoms
  @atoms = {}

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

  @atoms[Atoms::ZeroOrMoreRepetition] = { padding: { top: 1.5, bottom: 1.5, left: 4.5, right: 4.5 }.freeze }
  @atoms[Atoms::Optional]             = { padding: {           bottom: 1.5, left: 3.0, right: 3.0 }.freeze }
  @atoms[Atoms::SpecificRepetition]   = { padding: { top: 1.5,              left: 1.5, right: 1.5 }.freeze }

  @atoms[Atoms::Concatenation] = { space: 1.5 }
  @atoms[Atoms::Choice]        = { space: 1, padding: {                    left: 3, right: 3 }.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/json.rb, line 18
def initialize_basic
  @basic = {}
  @basic[:font]  = { family: 'serif', size: 12 }.freeze
  @basic[:line]  = { width: 3 }.freeze

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