Class: Phlex::Variants::VariantBuilder 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

Constructor Details

#initialize(view_class) ⇒ VariantBuilder

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 VariantBuilder.



113
114
115
# File 'lib/phlex/variants.rb', line 113

def initialize(view_class)
  @view_class = view_class
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ 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.

standard:disable Style/MissingRespondToMissing



117
118
119
120
121
# File 'lib/phlex/variants.rb', line 117

def method_missing(name, &) # standard:disable Style/MissingRespondToMissing
  variant_name = name.to_sym
  view_class::STYLE_VARIANTS[variant_name] = {}
  OptionsBuilder.build(view_class, variant_name, &)
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.



107
108
109
# File 'lib/phlex/variants.rb', line 107

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.



109
110
111
# File 'lib/phlex/variants.rb', line 109

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