Exception: Pocolog::Upgrade::CannotAddNonContainerField

Inherits:
InvalidCast
  • Object
show all
Defined in:
lib/pocolog/upgrade/exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, field_name) ⇒ CannotAddNonContainerField

Returns a new instance of CannotAddNonContainerField



42
43
44
45
# File 'lib/pocolog/upgrade/exceptions.rb', line 42

def initialize(type, field_name)
    @type = type
    @field_name = field_name
end

Instance Attribute Details

#field_nameObject (readonly)

Returns the value of attribute field_name



40
41
42
# File 'lib/pocolog/upgrade/exceptions.rb', line 40

def field_name
  @field_name
end

#typeObject (readonly)

Returns the value of attribute type



39
40
41
# File 'lib/pocolog/upgrade/exceptions.rb', line 39

def type
  @type
end

Instance Method Details

#pretty_print(pp) ⇒ Object



47
48
49
50
51
52
53
54
55
56
# File 'lib/pocolog/upgrade/exceptions.rb', line 47

def pretty_print(pp)
    pp.text "cannot automatically convert if the new type adds a non-container field"
    pp.breakable
    pp.text "#{type.name} adds #{field_name}"
    pp.breakable
    pp.nest(2) do
        pp.breakable
        type.pretty_print(pp)
    end
end