Sha256: dd8f0d1094258fcc40788b90604cd67b51b0da752a3be2bb82cff27eb7d542b8
Contents?: true
Size: 1012 Bytes
Versions: 2
Compression:
Stored size: 1012 Bytes
Contents
module Vedeu class Line include Coercions include Presentation attr_reader :attributes # @param attributes [Hash] # @param block [Proc] # @return [Hash] def self.build(attributes = {}, &block) new(attributes, &block).attributes end # @param attributes [Hash] # @param block [Proc] # @return [Line] def initialize(attributes = {}, &block) @attributes = defaults.merge!(attributes) if block_given? @self_before_instance_eval = eval('self', block.binding) instance_eval(&block) end end # @return [Array] def streams @streams ||= Stream.coercer(attributes[:streams]) end # @return [String] def to_s [ colour, style, streams ].join end private def defaults { colour: {}, streams: [], style: [] } end def method_missing(method, *args, &block) @self_before_instance_eval.send(method, *args, &block) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.1.17 | lib/vedeu/models/line.rb |
vedeu-0.1.16 | lib/vedeu/models/line.rb |