Sha256: 171006e0f005c8dc2155815549787bb84e80578fc5fb6bf9a5c4a039e4c8ac6b
Contents?: true
Size: 576 Bytes
Versions: 9
Compression:
Stored size: 576 Bytes
Contents
# frozen_string_literal: true module Scryglass class ViewWrapper attr_accessor :model, :string, :string_lambda def initialize(model, string: nil, string_lambda: nil) unless !!string ^ !!string_lambda raise ArgumentError, 'Must provide either `string` or `string_lambda`, ' \ 'but not both.' end self.model = model self.string = string self.string_lambda = string_lambda end def to_s return string if string return string_lambda.call(model) if string_lambda end end end
Version data entries
9 entries across 9 versions & 1 rubygems