class TokyoMetro::Factory::Decorate::AppSubDecorator::InDocument

Public Instance Methods

render_button_domain() click to toggle source
# File lib/tokyo_metro/factory/decorate/app_sub_decorator/in_document.rb, line 3
def render_button_domain
  h.content_tag( :div , '' , class: [ :button_area , :clearfix ] )
end
render_infos() click to toggle source
# File lib/tokyo_metro/factory/decorate/app_sub_decorator/in_document.rb, line 7
  def render_infos
    h.render inline: <<-HAML , type: :haml , locals: { infos: infos_to_render }
%ul{ class: [ :sub_infos , :clearfix ] }
  - infos.each do | title , group |
    %li{ class: [ :title , :text_en ] }<
      = title
    %dl{ class: :clearfix }
      - group.each do | k , v |
        - if v.present?
          %dt{ class: [ :attr_title , :text_en ] }<
            = k.to_s + " :"
          %dd<
            = v.to_s
    HAML
  end

Private Instance Methods

infors_from_db_columns_of( obj ) click to toggle source
# File lib/tokyo_metro/factory/decorate/app_sub_decorator/in_document.rb, line 33
def infors_from_db_columns_of( obj )
  infos_from_methods_of( obj , obj.class.attribute_names )
end
infos_from_db_columns() click to toggle source
# File lib/tokyo_metro/factory/decorate/app_sub_decorator/in_document.rb, line 29
def infos_from_db_columns
  infors_from_db_columns_of( object )
end
infos_from_methods_of( obj , *method_names ) click to toggle source
# File lib/tokyo_metro/factory/decorate/app_sub_decorator/in_document.rb, line 45
def infos_from_methods_of( obj , *method_names )
  h = ::Hash.new
  method_names.flatten.each do | method_name |
    h[ method_name ] = obj.send( method_name )
  end
  h
end
infos_from_methods_of_decorator( *method_names ) click to toggle source
# File lib/tokyo_metro/factory/decorate/app_sub_decorator/in_document.rb, line 41
def infos_from_methods_of_decorator( *method_names )
  infos_from_methods_of( @decorator , *method_names )
end
infos_from_methods_of_object( *method_names ) click to toggle source
# File lib/tokyo_metro/factory/decorate/app_sub_decorator/in_document.rb, line 37
def infos_from_methods_of_object( *method_names )
  infos_from_methods_of( object , *method_names )
end
infos_to_render() click to toggle source
# File lib/tokyo_metro/factory/decorate/app_sub_decorator/in_document.rb, line 25
def infos_to_render
  { "Infos from Db Columns" => infos_from_db_columns }
end
render_name( regexp , name_str , p_class ) click to toggle source
# File lib/tokyo_metro/factory/decorate/app_sub_decorator/in_document.rb, line 53
  def render_name( regexp , name_str , p_class )
    _h_locals = {
      regexp: regexp ,
      name_str: name_str ,
      p_class: p_class
    }
    h.render inline: <<-HAML , type: :haml , locals: _h_locals
%p{ class: p_class }<
  - if regexp =~ name_str
    - out_of_parentheses = name_str.gsub( regexp , "" )
    - in_parentheses =  $1
    = out_of_parentheses
    %span{ class: :sub }<
      = in_parentheses
  - else
    = name_str
    HAML
  end