Sha256: 65126e9eeae3ed3285cb3053f4d968e85853548859dbd307f4a491483464710a

Contents?: true

Size: 845 Bytes

Versions: 56

Compression:

Stored size: 845 Bytes

Contents

class Card
  class FileCardCreator
    class AbstractFileCard
      # Module that provides #create_source_file method for a classes that
      # inherit from AbstractFileCard
      module SourceFile
        def create_source_file
          write_to_mod source_file_dir, source_file_name do |f|
            f.puts source_file_content
          end
        end

        private

        def source_file_content
          card = Card.fetch(@name)
          if card
            card.content
          else
            color_puts "warning:", :yellow,
                       "Card '#{@name}' doesn't exist. Creating empty source file ..."
            ""
          end
        end

        def source_file_name
          "#{@codename}.#{source_file_ext}"
        end

        def source_file_ext
          @type
        end
      end
    end
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
card-1.104.2 lib/card/file_card_creator/abstract_file_card/source_file.rb
card-1.104.1 lib/card/file_card_creator/abstract_file_card/source_file.rb
card-1.104.0 lib/card/file_card_creator/abstract_file_card/source_file.rb
card-1.103.4 lib/card/file_card_creator/abstract_file_card/source_file.rb
card-1.103.3 lib/card/file_card_creator/abstract_file_card/source_file.rb
card-1.103.2 lib/card/tasks/card/file_card_creator/abstract_file_card/source_file.rb
card-1.103.1 lib/card/tasks/card/file_card_creator/abstract_file_card/source_file.rb
card-1.103.0 lib/card/tasks/card/file_card_creator/abstract_file_card/source_file.rb
card-1.101.7 lib/card/tasks/card/file_card_creator/abstract_file_card/source_file.rb
card-1.102.0 lib/card/tasks/card/file_card_creator/abstract_file_card/source_file.rb
card-1.101.6 lib/card/tasks/card/file_card_creator/abstract_file_card/source_file.rb
card-1.101.5 lib/card/tasks/card/file_card_creator/abstract_file_card/source_file.rb
card-1.101.4 lib/card/tasks/card/file_card_creator/abstract_file_card/source_file.rb
card-1.101.3 lib/card/tasks/card/file_card_creator/abstract_file_card/source_file.rb
card-1.101.2 lib/card/tasks/card/file_card_creator/abstract_file_card/source_file.rb
card-1.101.1 lib/card/tasks/card/file_card_creator/abstract_file_card/source_file.rb
card-1.101.0 lib/card/tasks/card/file_card_creator/abstract_file_card/source_file.rb
card-1.100.0 lib/card/tasks/card/file_card_creator/abstract_file_card/source_file.rb
card-1.99.6 lib/card/tasks/card/file_card_creator/abstract_file_card/source_file.rb
card-1.99.5 lib/card/tasks/card/file_card_creator/abstract_file_card/source_file.rb