RubyGems Navigation menu

psychgus 1.0.0

Easily style YAML files using Psych, like Sequence/Mapping Flow style. Simple example: class CoffeeStyler include Psychgus::Styler def style_sequence(sniffer,node) node.style = Psychgus::SEQUENCE_FLOW end end coffee = { 'Roast'=>['Light', 'Medium', 'Dark', 'Extra Dark'], 'Style'=>['Cappuccino', 'Espresso', 'Latte', 'Mocha']} puts coffee.to_yaml(stylers: CoffeeStyler.new) # Output: # --- # Roast: [Light, Medium, Dark, Extra Dark] # Style: [Cappuccino, Espresso, Latte, Mocha] Class example: class Coffee include Psychgus::Blueberry def initialize @roast = ['Light', 'Medium', 'Dark', 'Extra Dark'] @style = ['Cappuccino', 'Espresso', 'Latte', 'Mocha'] end def psychgus_stylers(sniffer) CoffeeStyler.new end end puts Coffee.new.to_yaml # Output: # --- !ruby/object:Coffee # roast: [Light, Medium, Dark, Extra Dark] # style: [Cappuccino, Espresso, Latte, Mocha] The produced YAML without Psychgus styling (i.e., without CoffeeStyler): # --- # Roast: # - Light # - Medium # - Dark # - Extra Dark # Style: # - Cappuccino # - Espresso # - Latte # - Mocha

Gemfile:
= 复制到剪贴板 已复制!

安装:
=

版本列表:

  1. 1.3.4 - June 20, 2021 (34.5 KB)
  2. 1.3.3 - April 25, 2020 (34.5 KB)
  3. 1.3.2 - April 23, 2020 (34.5 KB)
  4. 1.2.2 - March 15, 2020 (34.5 KB)
  5. 1.2.1 - December 18, 2019 (34.5 KB)
  6. 1.0.0 - July 03, 2019 (29.5 KB)
显示所有版本 (共 8 个)

Runtime 依赖 (1):

psych >= 2.0.5

Development 依赖 (6):

bundler ~> 1.16
minitest ~> 5.11
rake ~> 12.3
rdoc ~> 6.1
redcarpet ~> 3.4
yard ~> 0.9

业主:

推送:

作者:

  • Jonathan Bradley Whited (@esotericpig)

SHA 256 校验和:

a727ce6db799d1af4933e497df603251240fe28b9ba1af2c3411745a435ab5e3

下载总量 13,706

这个版本 1,698

许可:

LGPL-3.0-or-later

需要的 Ruby 版本: >= 2.1.10

链接: