module Itkrt2y

Constants

VERSION

Public Class Methods

all() click to toggle source
# File lib/itkrt2y.rb, line 4
def all
  methods = Itkrt2y::methods(false) - [:all, :to_s]
  methods.map { |method| Itkrt2y.send(method) }
end
education() click to toggle source
# File lib/itkrt2y.rb, line 20
def education
  {
    junior_high_school: {
      title: "中学",
      name: "私立桐光学園中学校",
      entrance: "2001年4月入学",
      end: "2004年3月卒業"
    },
    high_school: {
      title: "高校",
      name: "私立桐光学園高等学校",
      entrance: "2004年4月入学",
      end: "2007年3月卒業"
    },
    college: {
      title: "大学",
      name: "東京農工大学",
      faculty: "農学部",
      department: "地域生態システム学科",
      entrance: "2008年4月入学",
      end: "2013年3月卒業"
    }
  }
end
email() click to toggle source
# File lib/itkrt2y.rb, line 16
def email
  { email: { title: "メールアドレス", value: "itkrt2y.591721200@gmail.com" } }
end
name() click to toggle source
# File lib/itkrt2y.rb, line 9
def name
  {
    full_name: { title: "氏名", value: "板倉 達也" },
    furigana: { title: "ふりがな", value: "いたくら たつや" }
  }
end
to_s(data_type = :all) click to toggle source
# File lib/itkrt2y.rb, line 45
def to_s(data_type = :all)
  data_params = Itkrt2y.send(data_type)

  string_data =
    case data_params
    when Array
      data_params.map do |params|
        format_hash(params)
      end
    when Hash
      format_hash(data_params)
    else
      puts "指定した型が間違っています"
    end

  string_data
end

Private Class Methods

format_hash(params) click to toggle source
# File lib/itkrt2y.rb, line 65
def self.format_hash(params)
  params.map do |key, val|
    data_keys = (val.keys - [:title])
    data = data_keys.map { |k| val[k] }.join(" ")
    "#{val[:title]} : #{data}\n"
  end
end

Private Instance Methods

all() click to toggle source
# File lib/itkrt2y.rb, line 4
def all
  methods = Itkrt2y::methods(false) - [:all, :to_s]
  methods.map { |method| Itkrt2y.send(method) }
end
education() click to toggle source
# File lib/itkrt2y.rb, line 20
def education
  {
    junior_high_school: {
      title: "中学",
      name: "私立桐光学園中学校",
      entrance: "2001年4月入学",
      end: "2004年3月卒業"
    },
    high_school: {
      title: "高校",
      name: "私立桐光学園高等学校",
      entrance: "2004年4月入学",
      end: "2007年3月卒業"
    },
    college: {
      title: "大学",
      name: "東京農工大学",
      faculty: "農学部",
      department: "地域生態システム学科",
      entrance: "2008年4月入学",
      end: "2013年3月卒業"
    }
  }
end
email() click to toggle source
# File lib/itkrt2y.rb, line 16
def email
  { email: { title: "メールアドレス", value: "itkrt2y.591721200@gmail.com" } }
end
name() click to toggle source
# File lib/itkrt2y.rb, line 9
def name
  {
    full_name: { title: "氏名", value: "板倉 達也" },
    furigana: { title: "ふりがな", value: "いたくら たつや" }
  }
end
to_s(data_type = :all) click to toggle source
# File lib/itkrt2y.rb, line 45
def to_s(data_type = :all)
  data_params = Itkrt2y.send(data_type)

  string_data =
    case data_params
    when Array
      data_params.map do |params|
        format_hash(params)
      end
    when Hash
      format_hash(data_params)
    else
      puts "指定した型が間違っています"
    end

  string_data
end