Class: Synchronisable::DSL::Macro::Expression Private

Inherits:
Object
  • Object
show all
Defined in:
lib/synchronisable/dsl/macro/expression.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Serves as storage and provides lazy evaluation for expression. You can override attributes in subclasses, for example you can change the default value.

See Also:

Direct Known Subclasses

Attribute, Method

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Expression

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Expression.


16
17
18
# File 'lib/synchronisable/dsl/macro/expression.rb', line 16

def initialize(options)
  @default = options[:default]
end

Instance Attribute Details

#defaultObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


14
15
16
# File 'lib/synchronisable/dsl/macro/expression.rb', line 14

def default
  @default
end

#sourceObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


14
15
16
# File 'lib/synchronisable/dsl/macro/expression.rb', line 14

def source
  @source
end

Instance Method Details

#handle(args, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


20
21
22
23
# File 'lib/synchronisable/dsl/macro/expression.rb', line 20

def handle(args, &block)
  has_value = block || args.present?
  has_value ? save(args, block) : value
end