Sha256: 2af81eb7a67592e8dd0888eea6c2829f54c7ee472afa436f04fffd01dfb69e85

Contents?: true

Size: 566 Bytes

Versions: 1

Compression:

Stored size: 566 Bytes

Contents

# frozen_string_literal: true

module Dphil
  class Verse
    using ::Ragabash::Refinements
    attr_reader :ms, :id, :verse, :syllables, :weights, :identify

    def initialize(verse, ms: nil, id: nil)
      @verse = verse.to_str.safe_copy
      @ms = ms.safe_copy
      @id = id.safe_copy
      @identify = VerseAnalysis.identify(@verse)
      deep_freeze
    end

    def to_json(options)
      { ms: ms,
        id: id,
        verse: verse,
        syllables: syllables,
        weights: weights,
        identify: identify }.to_json(options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dphil-0.1.4 lib/dphil/verse.rb