Sha256: d3f0a6faaa8db1dab15aa6ffa8e46c4c3fa884ef08904bc03ed19c5fda57a727

Contents?: true

Size: 1.4 KB

Versions: 8

Compression:

Stored size: 1.4 KB

Contents

module Animoto
  module Assets
    class TitleCard
      # The main text of this title card.
      # @return [String]
      attr_accessor :title
      
      # The secondary text of this title card.
      # @return [String]
      attr_accessor :subtitle
    
      # Whether or not this image is spotlit. Spotlighting a visual tells to director to add
      # more emphasis to this visual when directing.
      # @return [Boolean]
      attr_writer :spotlit
      
      # Returns whether or not this image is spotlit.
      # @return [Boolean]
      def spotlit?
        @spotlit
      end
      
      # Creates a new TitleCard.
      #
      # @param [String] title the main text
      # @param [String] subtitle the secondary text
      # @param [Hash{Symbol=>Object}] options
      # @option options [Boolean] :spotlit whether or not to spotlight this title card
      # @return [Assets::TitleCard] the TitleCard object
      def initialize title, subtitle = nil, options = {}
        @title, @subtitle = title, subtitle
        @spotlit = options[:spotlit]
      end
    
      # Returns a representation of this TitleCard as a Hash.
      #
      # @return [Hash{String=>Object}] this TitleCard as a Hash
      def to_hash
        hash = { 'type' => 'title_card' }
        hash['h1'] = title
        hash['h2'] = subtitle if subtitle
        hash['spotlit'] = spotlit? unless @spotlit.nil?
        hash
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
animoto-1.5.6 ./lib/animoto/assets/title_card.rb
animoto-1.5.5 ./lib/animoto/assets/title_card.rb
animoto-1.5.4 ./lib/animoto/assets/title_card.rb
animoto-1.5.3 ./lib/animoto/assets/title_card.rb
animoto-1.5.2 ./lib/animoto/assets/title_card.rb
animoto-1.5.1 ./lib/animoto/assets/title_card.rb
animoto-1.5.0 ./lib/animoto/assets/title_card.rb
animoto-1.3.1 ./lib/animoto/assets/title_card.rb