Guest User

Untitled

a guest
Sep 11th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.51 KB | None | 0 0
  1. class Test
  2.   def initialize(@step : Hash(Symbol, String) | Nil, @tree : String)
  3.   end
  4.  
  5.   def initialize
  6.     @step = {} of Symbol => String
  7.     @tree = ""
  8.   end
  9.  
  10.   YAML.mapping({
  11.     :step => {
  12.       type: Hash(Symbol, String),
  13.       nilable: true
  14.     },
  15.     :tree => String
  16.   })
  17.  
  18.   def to_yaml(yaml : YAML::Generator)
  19.     hash = {
  20.     {% for key, value in @type.instance_variables %}
  21.       {{key}}: %var{key},
  22.     {% end %} # expecting token "=>" not "NEWLINE"
  23.     } of String => YAML::Any
  24.   end
  25. end
Advertisement
Add Comment
Please, Sign In to add comment