Sha256: d4a4abd7bf5f6b1edc0299d0b668249f3ce64c856aebda788c4cb52d709189c1
Contents?: true
Size: 835 Bytes
Versions: 2
Compression:
Stored size: 835 Bytes
Contents
# frozen_string_literal: true module Cosensee # parse a line class ParsedBracket def initialize(content: []) @content = content @parsed = false end attr_accessor :content def parsed? @parsed end def update(**attributes) attributes.each do |key, value| # Check if the key is a valid accessor raise ArgumentError, "Attribute #{key} is not allowed to be updated." unless self.class.method_defined?("#{key}=") public_send("#{key}=", value) end self end def single_text? content.size == 1 && content.first.is_a?(String) end def first_content content.first end def ==(other) other.is_a?(Cosensee::ParsedBracket) && other.content == content && other.parsed? == parsed? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cosensee-0.8.0 | lib/cosensee/parsed_bracket.rb |
cosensee-0.6.0 | lib/cosensee/parsed_bracket.rb |