Module: Solid::Element

Included in:
Block, ConditionalBlock, LiquidExtensions::IfTag, Tag
Defined in:
lib/solid/element.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
# File 'lib/solid/element.rb', line 3

def self.included(base)
  base.extend(ClassMethods)
  base.send(:include, Solid::Iterable)
end

Instance Method Details

#argumentsObject



13
14
15
# File 'lib/solid/element.rb', line 13

def arguments
  @arguments
end

#current_contextObject



25
26
27
# File 'lib/solid/element.rb', line 25

def current_context
  @current_context or raise Solid::ContextError.new("There is currently no context, do you forget to call render ?")
end

#display(*args) ⇒ Object

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/solid/element.rb', line 29

def display(*args)
  raise NotImplementedError.new("Solid::Element implementations SHOULD define a #display method")
end

#initialize(tag_name, arguments_string, tokens, context = {}) ⇒ Object



8
9
10
11
# File 'lib/solid/element.rb', line 8

def initialize(tag_name, arguments_string, tokens, context = {})
   super
   @arguments = Solid::Arguments.parse(arguments_string)
end

#with_context(context) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/solid/element.rb', line 17

def with_context(context)
  previous_context = @current_context
  @current_context = context
  yield
ensure
  @current_context = previous_context
end