Class: TinyDyno::Fields::Standard

Inherits:
Object
  • Object
show all
Defined in:
lib/tiny_dyno/fields/standard.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ Standard

Create the new field with a name and optional additional options.

Examples:

Create the new field.

Field.new(:name, :type => String)

Parameters:

  • options (Hash) (defaults to: {})

    The field options.

Options Hash (options):

  • :type (Class)

    The class of the field.

  • :default (Object)

    The default value for the field.

  • :label (String)

    The field’s label.

Since:

  • 3.0.0



22
23
24
25
26
27
28
# File 'lib/tiny_dyno/fields/standard.rb', line 22

def initialize(name, options = {})
  @name = name
  @options = options
  @label = options[:label]
  @default_val = options[:default]
  @type = options[:type]
end

Instance Attribute Details

#default_valObject

Defines the behaviour for defined fields in the document. Set readers for the instance variables.



8
9
10
# File 'lib/tiny_dyno/fields/standard.rb', line 8

def default_val
  @default_val
end

#labelObject

Defines the behaviour for defined fields in the document. Set readers for the instance variables.



8
9
10
# File 'lib/tiny_dyno/fields/standard.rb', line 8

def label
  @label
end

#nameObject

Defines the behaviour for defined fields in the document. Set readers for the instance variables.



8
9
10
# File 'lib/tiny_dyno/fields/standard.rb', line 8

def name
  @name
end

#optionsObject

Defines the behaviour for defined fields in the document. Set readers for the instance variables.



8
9
10
# File 'lib/tiny_dyno/fields/standard.rb', line 8

def options
  @options
end