Class: HecksDomain::Parser::ValueField

Inherits:
Object
  • Object
show all
Defined in:
lib/hecks/domain/parser/value_field.rb

Direct Known Subclasses

BooleanField, CurrencyField, IntegerField, StringField

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ ValueField

Returns a new instance of ValueField.



8
9
10
# File 'lib/hecks/domain/parser/value_field.rb', line 8

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/hecks/domain/parser/value_field.rb', line 4

def name
  @name
end

#optional=(value) ⇒ Object (writeonly)

Sets the attribute optional

Parameters:

  • value

    the value to set the attribute optional to.



5
6
7
# File 'lib/hecks/domain/parser/value_field.rb', line 5

def optional=(value)
  @optional = value
end

#read_only=(value) ⇒ Object (writeonly)

Sets the attribute read_only

Parameters:

  • value

    the value to set the attribute read_only to.



6
7
8
# File 'lib/hecks/domain/parser/value_field.rb', line 6

def read_only=(value)
  @read_only = value
end

Instance Method Details

#as(name) ⇒ Object



42
43
44
45
# File 'lib/hecks/domain/parser/value_field.rb', line 42

def as(name)
  @as = name
  self
end

#attribute_nameObject



20
21
22
23
24
# File 'lib/hecks/domain/parser/value_field.rb', line 20

def attribute_name
  return name.to_s + ':' unless optional?

  name.to_s + ': nil'
end

#initial_stateObject



16
17
18
# File 'lib/hecks/domain/parser/value_field.rb', line 16

def initial_state
  name
end

#module_nameObject



34
35
36
# File 'lib/hecks/domain/parser/value_field.rb', line 34

def module_name
  @as
end

#optional?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/hecks/domain/parser/value_field.rb', line 12

def optional?
  @optional
end

#private_accessorObject



30
31
32
# File 'lib/hecks/domain/parser/value_field.rb', line 30

def private_accessor
  ":#{name}"
end

#public_accessorObject



26
27
28
# File 'lib/hecks/domain/parser/value_field.rb', line 26

def public_accessor
  ":#{name}"
end

#read_only?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/hecks/domain/parser/value_field.rb', line 38

def read_only?
  @read_only
end