Class: Trax::Core::Property

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/trax/core/transformer.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, transformer) ⇒ Property

Returns a new instance of Property.



227
228
229
230
231
232
233
# File 'lib/trax/core/transformer.rb', line 227

def initialize(value, transformer)
  @value = value

  if self.class.try(:with)
    @value = self.class.with.arity > 1 ? self.class.with.call(@value, transformer) : self.class.with.call(@value)
  end
end

Class Method Details

.from_parent?Boolean

Returns:

  • (Boolean)


223
224
225
# File 'lib/trax/core/transformer.rb', line 223

def self.from_parent?
  @from_parent ||= !!try(:from_parent)
end

.is_nested?Boolean

Returns:

  • (Boolean)


215
216
217
# File 'lib/trax/core/transformer.rb', line 215

def self.is_nested?
  @is_nested ||= !!self.try(:parent_definition)
end

.is_translated?Boolean

Returns:

  • (Boolean)


219
220
221
# File 'lib/trax/core/transformer.rb', line 219

def self.is_translated?
  @is_translated ||= !!self.try(:from)
end

Instance Method Details

#__getobj__Object



239
240
241
# File 'lib/trax/core/transformer.rb', line 239

def __getobj__
  @value
end

#nil?Boolean

Returns:

  • (Boolean)


235
236
237
# File 'lib/trax/core/transformer.rb', line 235

def nil?
  __getobj__.nil?
end