Sha256: 0d3304bd515ec41acd81ca2a8de8c48f3439e1b794c0bed93d4f2ea6af56a495

Contents?: true

Size: 803 Bytes

Versions: 6

Compression:

Stored size: 803 Bytes

Contents

class ViewModels::SubSubclass < ViewModels::Subclass
  
  controller_method :logger
  
  model_reader :some_untouched_attribute
  model_reader :some_filtered_attribute, :filter_through => :h
  model_reader :some_doubly_doubled_attribute, :filter_through => [:doubled]*2
  model_reader :some_mangled_attribute, :filter_through => [:reverse, :cutoff, :doubled, :upcase]
  
  # h as we know it.
  #
  def h v
    CGI.escape v
  end
  
  # Multiplies the text by 2.
  #
  def doubled text
    text*2
  end
  
  # Cuts off the last 2 characters. Or all, if less than size 2.
  #
  def cutoff text
    text[0..-2]
  end
  
  def reverse text
    text.reverse
  end
  
  def upcase text
    text.upcase
  end
  
  # Captures the block as a string.
  #
  def capture_block &block
    capture &block
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
view_models-1.5.7 spec/integration/view_models/sub_subclass.rb
view_models-1.5.6 spec/integration/view_models/sub_subclass.rb
view_models-1.5.5 spec/integration/view_models/sub_subclass.rb
view_models-1.5.4 spec/integration/view_models/sub_subclass.rb
view_models-1.5.3 spec/integration/view_models/sub_subclass.rb
view_models-1.5.2 spec/integration/view_models/sub_subclass.rb