module Playbook::Props
def clear_props
def clear_props props.keys.each { |prop_name| remove_method(prop_name) } props.clear end
def initialize(prop_values = {}, &block)
def initialize(prop_values = {}, &block) self.values = { children: block }.merge(Hash(prop_values)) self.class.props.each do |key, definition| definition.validate! values[key] end end
def partial(path)
def partial(path) define_method(:to_partial_path) { path } end
def prop(name)
def prop(name) self.class.props[name].value values[name] end
def prop(name, type: Playbook::Props::String, **options)
def prop(name, type: Playbook::Props::String, **options) self.props = props.merge(name => type.new(**options.merge(name: name, kit: self))) define_method(name) { prop(name) } end