Sha256: 34aa061880f9dba5b8ac8eec6dbfc79d1369781f4ed54b04304aacc40aaa6f1b

Contents?: true

Size: 919 Bytes

Versions: 5

Compression:

Stored size: 919 Bytes

Contents

module Avo
  module Fields
    class CodeField < BaseField
      attr_reader :height
      attr_reader :language
      attr_reader :theme
      attr_reader :tab_size
      attr_reader :indent_with_tabs
      attr_reader :line_wrapping

      def initialize(name, **args, &block)
        @defaults = {
          partial_name: 'code-field',
        }

        hide_on :index

        super(name, **args, &block)

        @language = args[:language].present? ? args[:language].to_s : 'javascript'
        @theme = args[:theme].present? ? args[:theme].to_s : 'material-darker'
        @height = args[:height].present? ? args[:height].to_s : 'auto'
        @tab_size = args[:tab_size].present? ? args[:tab_size] : 2
        @indent_with_tabs = args[:indent_with_tabs].present? ? args[:indent_with_tabs] : false
        @line_wrapping = args[:line_wrapping].present? ? args[:line_wrapping] : true
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
avo-0.5.0.beta9 lib/avo/fields/code_field.rb
avo-0.5.0.beta8 lib/avo/fields/code_field.rb
avo-0.5.0.beta7 lib/avo/fields/code_field.rb
avo-0.5.0.beta6 lib/avo/fields/code_field.rb
avo-0.5.0.beta5 lib/avo/fields/code_field.rb