module RBX

RBX is a module for handling enriched html parsing in a same manner that jsx does allowing for class resolution for tag names and dynamic content taken from those ruby classes.

Example:

module Todos
  class List
    include RBX::Component

    attr_reader :todos

    def initialize(todos:)
      super()
      @todos = todos
    end
  end

  class Todo
    include RBX::Component
    attr_reader :todo

    def initialize(todo:)
      super()
      @todo = todo
    end
  end
end

view = Todos::List.new(todos: [{"text" => "work"}])
puts view.render # => <ul><li>work</li> </ul>

__END__
@@Todos.List
<ul>{todos.map { |todo| <Todos.Todo todo={todo} /> }.join}</ul>

@@Todos.Todo
<li>{ todo["text"] }</li>

Component templates can be defined in several ways.