Class: Ostructer::OsOpenStructNil

Inherits:
OsBase show all
Defined in:
lib/ostructer.rb

Instance Attribute Summary

Attributes inherited from OsBase

#field, #logger, #parent

Instance Method Summary collapse

Methods inherited from OsBase

#full_dot_path

Constructor Details

#initialize(parent, field, logger) ⇒ OsOpenStructNil

Returns a new instance of OsOpenStructNil.



136
137
138
139
140
# File 'lib/ostructer.rb', line 136

def initialize( parent, field, logger )
  @parent = parent
  @field  = "!#{field}"  # mark missing field with starting ! (exclamation mark)
  @logger = logger
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(mn, *a) ⇒ Object



168
169
170
171
172
173
174
# File 'lib/ostructer.rb', line 168

def method_missing(mn,*a) 
  ## NEW: added; add to org
  mn = mn.to_s
   
  logger.warn "OsOpenStructNil - feld '#{mn}' nicht gefunden using path '#{full_dot_path}'; returning OsOpenStructNil"
  OsOpenStructNil.new( self, mn, logger )
end

Instance Method Details

#nil?Boolean

Returns:

  • (Boolean)


142
143
144
145
# File 'lib/ostructer.rb', line 142

def nil?
  logger.debug "calling OsNil#nil?"
  true
end

#to_boolObject



162
163
164
165
# File 'lib/ostructer.rb', line 162

def to_bool
  logger.debug "calling OsNil#to_bool"
  nil
end

#to_dateObject



157
158
159
160
# File 'lib/ostructer.rb', line 157

def to_date
  logger.debug "calling OsNil#to_date"
  nil
end

#to_iObject



152
153
154
155
# File 'lib/ostructer.rb', line 152

def to_i
  logger.debug "calling OsNil#to_i"
  nil
end

#to_sObject



147
148
149
150
# File 'lib/ostructer.rb', line 147

def to_s
  logger.debug "calling OsNil#to_s"
  nil
end