Class: Rox::Core::CustomProperty

Inherits:
Object
  • Object
show all
Defined in:
lib/rox/core/properties/custom_property.rb

Direct Known Subclasses

DeviceProperty

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type, value = nil, &block) ⇒ CustomProperty

Returns a new instance of CustomProperty.



6
7
8
9
10
11
# File 'lib/rox/core/properties/custom_property.rb', line 6

def initialize(name, type, value = nil, &block)
  @name = name
  @type = type
  @value = value
  @block = block
end

Instance Attribute Details

#blockObject

Returns the value of attribute block.



4
5
6
# File 'lib/rox/core/properties/custom_property.rb', line 4

def block
  @block
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/rox/core/properties/custom_property.rb', line 4

def name
  @name
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/rox/core/properties/custom_property.rb', line 4

def type
  @type
end

Instance Method Details

#value(context) ⇒ Object



13
14
15
# File 'lib/rox/core/properties/custom_property.rb', line 13

def value(context)
  @block.nil? ? @value : @block.call(context)
end