Skip to content

Render Options #5

@c910335

Description

@c910335

Something like this:

record Article, title : String, content : String

class ArticleRenderer < Crinder::Base(Article)
  field title : String, value: ->{ upcase_title? ? title.upcase : title }
  field content : String
  option upcase_title? : Bool = false
end

article = Article.new(title: "Render Options", content: "This is a new feature.")

ArticleRenderer.render(article, upcase_title?: true) # => "{\"title\":\"RENDER OPTIONS\",\"content\":\"This is a new feature.\"}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions