class Eatr::Schema::Field
Public Class Methods
new(field_attributes)
click to toggle source
# File lib/eatr/schema.rb, line 4 def initialize(field_attributes) @field_attributes = field_attributes end
Public Instance Methods
children()
click to toggle source
# File lib/eatr/schema.rb, line 36 def children Array[*@field_attributes['children']].map { |f| Field.new(f) } end
node?()
click to toggle source
# File lib/eatr/schema.rb, line 28 def node? @field_attributes.has_key?('node') end
required?()
click to toggle source
# File lib/eatr/schema.rb, line 32 def required? @field_attributes.fetch('required', true) end
type()
click to toggle source
# File lib/eatr/schema.rb, line 24 def type @field_attributes['type'].to_s.downcase end
value()
click to toggle source
# File lib/eatr/schema.rb, line 40 def value @field_attributes['value'] || @field_attributes['default'] end