Class: Phlex::Variants::StyleBuilder Private

Inherits:
Object
  • Object
show all
Defined in:
lib/phlex/variants.rb

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.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object (private)

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.

standard:disable Style/MissingRespondToMissing

Raises:

  • (NoMethodError)


99
100
101
102
# File 'lib/phlex/variants.rb', line 99

def method_missing(method, *args, &) # standard:disable Style/MissingRespondToMissing
  message = "undefined method '#{method}' for an instance of Phlex::Variants::StyleBuilder. The available methods are: 'base', 'variants' and 'defaults'"
  raise NoMethodError, message
end

Instance Attribute Details

#view_classObject (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.



68
69
70
# File 'lib/phlex/variants.rb', line 68

def view_class
  @view_class
end

Class Method Details

.build(view_class) ⇒ 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.



70
71
72
# File 'lib/phlex/variants.rb', line 70

def self.build(view_class, &)
  new(view_class).build(&)
end

Instance Method Details

#buildObject

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.



74
75
76
77
78
79
# File 'lib/phlex/variants.rb', line 74

def build(&)
  view_class.const_set(:STYLE_BASE, [])
  view_class.const_set(:STYLE_VARIANTS, {})
  view_class.const_set(:STYLE_DEFAULTS, {})
  instance_exec(&)
end