Sha256: 1beb090833e4b3d2729682a043084c6d88ec0134fc1fbf4ea42a5fce8ef35ff2
Contents?: true
Size: 572 Bytes
Versions: 7
Compression:
Stored size: 572 Bytes
Contents
module <%= config[:camel_cased_app_name] %> class ViewContext attr_reader :attrs def initialize(attrs = {}) @attrs = attrs end def csrf_token self[:csrf_token] end def csrf_metatag self[:csrf_metatag] end def csrf_tag self[:csrf_tag] end def flash self[:flash] end def flash? %i[notice alert].any? { |type| flash[type] } end def with(new_attrs) self.class.new(attrs.merge(new_attrs)) end private def [](name) attrs.fetch(name) end end end
Version data entries
7 entries across 4 versions & 1 rubygems