class Schai::JsProperty
Attributes
description[RW]
example[RW]
format[RW]
optional[RW]
type[RW]
Public Class Methods
new(params)
click to toggle source
# File lib/schai/json_schema/js_property.rb, line 13 def initialize params params.each do |k, v| setter = "#{k}=".to_sym self.send(setter, v) end end
parse(params)
click to toggle source
# File lib/schai/json_schema/js_property.rb, line 5 def self.parse params if params.has_key? 'include' Schai.parse_file(params['include']).schema else self.new params end end
Public Instance Methods
to_schema()
click to toggle source
# File lib/schai/json_schema/js_property.rb, line 20 def to_schema ret = {} ret[:type] = (@type || 'null').to_sym ret[:format] = @format if @format ret[:description] = @description if @description ret[:example] = @example if @example ret end